340 |
340 |
}
|
341 |
341 |
|
342 |
342 |
sub select_project {
|
343 |
|
$main::lxdebug->enter_sub();
|
344 |
|
|
345 |
|
my $form = $main::form;
|
346 |
|
my $locale = $main::locale;
|
347 |
|
my $cgi = $main::cgi;
|
|
343 |
$::lxdebug->enter_sub;
|
348 |
344 |
|
349 |
|
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
350 |
|
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
|
|
345 |
$::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
|
346 |
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
|
351 |
347 |
|
352 |
348 |
my ($is_global, $nextsub) = @_;
|
|
349 |
my $project_list = delete $::form->{project_list};
|
353 |
350 |
|
354 |
|
my @column_index = qw(ndx projectnumber description);
|
355 |
|
|
356 |
|
my %column_data;
|
357 |
|
$column_data{ndx} = qq|<th> </th>|;
|
358 |
|
$column_data{projectnumber} = qq|<th>| . $locale->text('Number') . qq|</th>|;
|
359 |
|
$column_data{description} =
|
360 |
|
qq|<th>| . $locale->text('Description') . qq|</th>|;
|
361 |
|
|
362 |
|
# list items with radio button on a form
|
363 |
|
$form->header;
|
364 |
|
|
365 |
|
my $title = $locale->text('Select from one of the projects below');
|
366 |
|
|
367 |
|
print qq|
|
368 |
|
<body>
|
369 |
|
|
370 |
|
<form method=post action=$form->{script}>
|
371 |
|
|
372 |
|
<input type=hidden name=rownumber value=$form->{rownumber}>
|
373 |
|
|
374 |
|
<table width=100%>
|
375 |
|
<tr>
|
376 |
|
<th class=listtop>$title</th>
|
377 |
|
</tr>
|
378 |
|
<tr space=5></tr>
|
379 |
|
<tr>
|
380 |
|
<td>
|
381 |
|
<table width=100%>
|
382 |
|
<tr class=listheading>|;
|
383 |
|
|
384 |
|
map { print "\n$column_data{$_}" } @column_index;
|
385 |
|
|
386 |
|
print qq|
|
387 |
|
</tr>
|
388 |
|
|;
|
389 |
|
|
390 |
|
my $i = 0;
|
391 |
|
my $j;
|
392 |
|
foreach my $ref (@{ $form->{project_list} }) {
|
393 |
|
my $checked = ($i++) ? "" : "checked";
|
394 |
|
|
395 |
|
$ref->{name} =~ s/\"/"/g;
|
396 |
|
|
397 |
|
$column_data{ndx} =
|
398 |
|
qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
|
399 |
|
$column_data{projectnumber} =
|
400 |
|
qq|<td><input name="new_projectnumber_$i" type=hidden value="$ref->{projectnumber}">$ref->{projectnumber}</td>|;
|
401 |
|
$column_data{description} = qq|<td>$ref->{description}</td>|;
|
402 |
|
|
403 |
|
$j++;
|
404 |
|
$j %= 2;
|
405 |
|
print qq|
|
406 |
|
<tr class=listrow$j>|;
|
407 |
|
|
408 |
|
map { print "\n$column_data{$_}" } @column_index;
|
409 |
|
|
410 |
|
print qq|
|
411 |
|
</tr>
|
412 |
|
|
413 |
|
<input name="new_id_$i" type=hidden value=$ref->{id}>
|
414 |
|
|
415 |
|
|;
|
416 |
|
|
417 |
|
}
|
418 |
|
|
419 |
|
print qq|
|
420 |
|
</table>
|
421 |
|
</td>
|
422 |
|
</tr>
|
423 |
|
<tr>
|
424 |
|
<td><hr size=3 noshade></td>
|
425 |
|
</tr>
|
426 |
|
</table>
|
427 |
|
|
428 |
|
<input name=lastndx type=hidden value=$i>
|
429 |
|
|
430 |
|
|;
|
|
351 |
map { delete $::form->{$_} } qw(action header update);
|
431 |
352 |
|
432 |
|
# delete action variable
|
433 |
|
map { delete $form->{$_} } qw(action project_list header update);
|
434 |
|
|
435 |
|
# save all other form variables
|
436 |
|
foreach my $key (keys %${form}) {
|
437 |
|
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
|
438 |
|
$form->{$key} =~ s/\"/"/g;
|
439 |
|
print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
|
|
353 |
my @hiddens;
|
|
354 |
for my $key (keys %$::form) {
|
|
355 |
next if $key eq 'login' || $key eq 'password' || '' ne ref $::form->{$key};
|
|
356 |
push @hiddens, { key => $key, value => $::form->{$key} };
|
440 |
357 |
}
|
|
358 |
push @hiddens, { key => 'is_global', value => $is_global },
|
|
359 |
{ key => 'project_selected_nextsub', value => $nextsub };
|
441 |
360 |
|
442 |
|
print
|
443 |
|
$cgi->hidden('-name' => 'is_global', '-default' => [$is_global])
|
444 |
|
. $cgi->hidden('-name' => 'project_selected_nextsub', '-default' => [$nextsub])
|
445 |
|
. qq|<input type=hidden name=nextsub value=project_selected>
|
446 |
|
|
447 |
|
<br>
|
448 |
|
<input class=submit type=submit name=action value="|
|
449 |
|
. $locale->text('Continue') . qq|">
|
450 |
|
</form>
|
|
361 |
$::form->header;
|
|
362 |
print $::form->parse_html_template('arap/select_project', { hiddens => \@hiddens, project_list => $project_list });
|
451 |
363 |
|
452 |
|
</body>
|
453 |
|
</html>
|
454 |
|
|;
|
455 |
|
|
456 |
|
$main::lxdebug->leave_sub();
|
|
364 |
$::lxdebug->leave_sub;
|
457 |
365 |
}
|
458 |
366 |
|
459 |
367 |
sub project_selected {
|
select_project in templates ausgelagert