Revision 9816fbfe
Von Sven Schöling vor mehr als 13 Jahren hinzugefügt
bin/mozilla/arap.pl | ||
---|---|---|
}
|
||
|
||
sub select_project {
|
||
$main::lxdebug->enter_sub();
|
||
|
||
my $form = $main::form;
|
||
my $locale = $main::locale;
|
||
my $cgi = $main::cgi;
|
||
$::lxdebug->enter_sub;
|
||
|
||
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
||
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
|
||
$::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
||
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
|
||
|
||
my ($is_global, $nextsub) = @_;
|
||
my $project_list = delete $::form->{project_list};
|
||
|
||
my @column_index = qw(ndx projectnumber description);
|
||
|
||
my %column_data;
|
||
$column_data{ndx} = qq|<th> </th>|;
|
||
$column_data{projectnumber} = qq|<th>| . $locale->text('Number') . qq|</th>|;
|
||
$column_data{description} =
|
||
qq|<th>| . $locale->text('Description') . qq|</th>|;
|
||
|
||
# list items with radio button on a form
|
||
$form->header;
|
||
|
||
my $title = $locale->text('Select from one of the projects below');
|
||
|
||
print qq|
|
||
<body>
|
||
|
||
<form method=post action=$form->{script}>
|
||
|
||
<input type=hidden name=rownumber value=$form->{rownumber}>
|
||
|
||
<table width=100%>
|
||
<tr>
|
||
<th class=listtop>$title</th>
|
||
</tr>
|
||
<tr space=5></tr>
|
||
<tr>
|
||
<td>
|
||
<table width=100%>
|
||
<tr class=listheading>|;
|
||
|
||
map { print "\n$column_data{$_}" } @column_index;
|
||
|
||
print qq|
|
||
</tr>
|
||
|;
|
||
|
||
my $i = 0;
|
||
my $j;
|
||
foreach my $ref (@{ $form->{project_list} }) {
|
||
my $checked = ($i++) ? "" : "checked";
|
||
|
||
$ref->{name} =~ s/\"/"/g;
|
||
|
||
$column_data{ndx} =
|
||
qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
|
||
$column_data{projectnumber} =
|
||
qq|<td><input name="new_projectnumber_$i" type=hidden value="$ref->{projectnumber}">$ref->{projectnumber}</td>|;
|
||
$column_data{description} = qq|<td>$ref->{description}</td>|;
|
||
|
||
$j++;
|
||
$j %= 2;
|
||
print qq|
|
||
<tr class=listrow$j>|;
|
||
|
||
map { print "\n$column_data{$_}" } @column_index;
|
||
|
||
print qq|
|
||
</tr>
|
||
|
||
<input name="new_id_$i" type=hidden value=$ref->{id}>
|
||
|
||
|;
|
||
|
||
}
|
||
|
||
print qq|
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><hr size=3 noshade></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<input name=lastndx type=hidden value=$i>
|
||
|
||
|;
|
||
map { delete $::form->{$_} } qw(action header update);
|
||
|
||
# delete action variable
|
||
map { delete $form->{$_} } qw(action project_list header update);
|
||
|
||
# save all other form variables
|
||
foreach my $key (keys %${form}) {
|
||
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
|
||
$form->{$key} =~ s/\"/"/g;
|
||
print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
|
||
my @hiddens;
|
||
for my $key (keys %$::form) {
|
||
next if $key eq 'login' || $key eq 'password' || '' ne ref $::form->{$key};
|
||
push @hiddens, { key => $key, value => $::form->{$key} };
|
||
}
|
||
push @hiddens, { key => 'is_global', value => $is_global },
|
||
{ key => 'project_selected_nextsub', value => $nextsub };
|
||
|
||
print
|
||
$cgi->hidden('-name' => 'is_global', '-default' => [$is_global])
|
||
. $cgi->hidden('-name' => 'project_selected_nextsub', '-default' => [$nextsub])
|
||
. qq|<input type=hidden name=nextsub value=project_selected>
|
||
|
||
<br>
|
||
<input class=submit type=submit name=action value="|
|
||
. $locale->text('Continue') . qq|">
|
||
</form>
|
||
$::form->header;
|
||
print $::form->parse_html_template('arap/select_project', { hiddens => \@hiddens, project_list => $project_list });
|
||
|
||
</body>
|
||
</html>
|
||
|;
|
||
|
||
$main::lxdebug->leave_sub();
|
||
$::lxdebug->leave_sub;
|
||
}
|
||
|
||
sub project_selected {
|
templates/webpages/arap/select_project.html | ||
---|---|---|
[%- USE HTML %]
|
||
[%- USE T8 %]
|
||
[%- USE L %]
|
||
[%- USE LxERP %]
|
||
<body>
|
||
|
||
<h1>[% 'Select from one of the projects below' | $T8 %]</h1>
|
||
|
||
<form method=post action="[% script %]">
|
||
|
||
<table width=100%>
|
||
<tr class=listheading>
|
||
<th> </th>
|
||
<th>[% 'Number' | $T8 %]</th>
|
||
<th>[% 'Description' | $T8 %]</th>
|
||
</tr>
|
||
[%- FOREACH row IN project_list %]
|
||
<tr class=listrow[% loop.count % 2 %]>
|
||
<td>[% L.radio_button_tag('ndx', value=loop.count, checked=loop.first) %]</td>
|
||
<td>[% row.projectnumber | html %]</td>
|
||
<td>[% row.description | html %]</td>
|
||
[% L.hidden_tag('new_id_' _ loop.count, row.id) %]
|
||
[% L.hidden_tag('new_projectnumber_' _ loop.count, row.projectnumber) %]
|
||
</tr>
|
||
[%- END %]
|
||
</table>
|
||
|
||
<hr size=3 noshade>
|
||
|
||
[% L.hidden_tag(row.key, row.value) FOREACH row = hiddens %]
|
||
[% L.hidden_tag('lastndx', project_list.size) %]
|
||
[% L.hidden_tag('nextsub', 'project_selected') %]
|
||
[% L.hidden_tag('rownumber', rownumber) %]
|
||
[% L.submit_tag('action', LxERP.t8('Continue')) %]
|
||
|
||
</form>
|
||
|
||
</body>
|
||
</html>
|
Auch abrufbar als: Unified diff
select_project in templates ausgelagert