Revision 6ea1dd9b
Von Bernd Bleßmann vor mehr als 9 Jahren hinzugefügt
bin/mozilla/io.pl | ||
---|---|---|
497 | 497 |
$main::lxdebug->enter_sub(); |
498 | 498 |
|
499 | 499 |
my %params = @_; |
500 |
my $mode = $params{mode} || croak "Missing parameter 'mode'";
|
|
501 |
|
|
500 |
my $mode = $params{mode} || croak "Missing parameter 'mode'";
|
|
501 |
my $pre_entered_qty = $params{pre_entered_qty} || 1; |
|
502 | 502 |
_check_io_auth(); |
503 | 503 |
|
504 | 504 |
my $previous_form = $::auth->save_form_in_session(form => $::form); |
... | ... | |
513 | 513 |
# delete action variable |
514 | 514 |
delete @{$::form}{qw(action item_list)}; |
515 | 515 |
|
516 |
print $::form->parse_html_template('io/select_item', { PREVIOUS_FORM => $previous_form, |
|
517 |
MODE => $mode, |
|
518 |
ITEM_LIST => \@item_list, |
|
519 |
IS_ASSEMBLY => $mode eq 'IC', |
|
520 |
IS_PURCHASE => $mode eq 'IS' }); |
|
516 |
print $::form->parse_html_template('io/select_item', { PREVIOUS_FORM => $previous_form, |
|
517 |
MODE => $mode, |
|
518 |
ITEM_LIST => \@item_list, |
|
519 |
IS_ASSEMBLY => $mode eq 'IC', |
|
520 |
IS_PURCHASE => $mode eq 'IS', |
|
521 |
PRE_ENTERED_QTY => $pre_entered_qty, }); |
|
521 | 522 |
|
522 | 523 |
$main::lxdebug->leave_sub(); |
523 | 524 |
} |
... | ... | |
536 | 537 |
|
537 | 538 |
$::auth->restore_form_from_session($form->{select_item_previous_form} || croak('Missing previous form ID'), form => $form); |
538 | 539 |
|
539 |
my $mode = delete($form->{select_item_mode}) || croak 'Missing item selection mode'; |
|
540 |
my $id = delete($form->{select_item_id}) || croak 'Missing item selection ID'; |
|
541 |
my $i = $form->{ $mode eq 'IC' ? 'assembly_rows' : 'rowcount' }; |
|
540 |
my $mode = delete($form->{select_item_mode}) || croak 'Missing item selection mode'; |
|
541 |
my $row_key = $mode eq 'IC' ? 'assembly_rows' : 'rowcount'; |
|
542 |
my $curr_row = $form->{ $row_key }; |
|
543 |
|
|
544 |
my $row = $curr_row; |
|
545 |
|
|
546 |
if ($myconfig{item_multiselect}) { |
|
547 |
foreach (grep(/^select_qty_/, keys(%{ $form }))) { |
|
548 |
next unless $form->{$_}; |
|
549 |
$_ =~ /^select_qty_(\d+)/; |
|
550 |
$form->{"id_${row}"} = $1; |
|
551 |
$form->{"qty_${row}"} = $form->{$_}; |
|
552 |
$row++; |
|
553 |
} |
|
554 |
} else { |
|
555 |
$form->{"id_${row}"} = delete($form->{select_item_id}) || croak 'Missing item selection ID'; |
|
556 |
$row++; |
|
557 |
} |
|
558 |
|
|
559 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } |
|
560 |
qw(sellprice listprice weight); |
|
542 | 561 |
|
543 | 562 |
if ( $mode eq 'IC' ) { |
544 | 563 |
# assembly mode: |
545 |
# the qty variables of the existing assembly items are all still formatted, so we parse them here (1 .. $i-1) |
|
546 |
# including the qty of the just added part ($i) |
|
547 |
$form->{"qty_$_"} = $form->parse_amount(\%myconfig, $form->{"qty_$_"}) for (1 .. $i); |
|
564 |
# the qty variables of the existing assembly items are all still formatted, so we parse them here |
|
565 |
# including the qty of the just added part |
|
566 |
$form->{"qty_$_"} = $form->parse_amount(\%myconfig, $form->{"qty_$_"}) for (1 .. $row - 1); |
|
567 |
} else { |
|
568 |
if ($myconfig{item_multiselect}) { |
|
569 |
# other modes and multiselection: |
|
570 |
# parse all newly entered qtys |
|
571 |
$form->{"qty_$_"} = $form->parse_amount(\%myconfig, $form->{"qty_$_"}) for ($curr_row .. $row - 1); |
|
572 |
} |
|
548 | 573 |
} |
549 | 574 |
|
550 |
$form->{"id_${i}"} = $id; |
|
575 |
for my $i ($curr_row .. $row - 1) { |
|
576 |
$form->{ $row_key } = $i; |
|
577 |
|
|
578 |
my $id = $form->{"id_${i}"}; |
|
579 |
|
|
580 |
delete $form->{item_list}; |
|
551 | 581 |
|
552 | 582 |
if ($mode eq 'IS') { |
553 | 583 |
IS->retrieve_item(\%myconfig, \%$form); |
... | ... | |
617 | 647 |
} |
618 | 648 |
} |
619 | 649 |
|
620 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } |
|
621 |
qw(sellprice listprice weight); |
|
622 |
|
|
623 | 650 |
# at this stage qty of newly added part needs to be have been parsed |
624 | 651 |
$form->{weight} += ($form->{"weight_$i"} * $form->{"qty_$i"}); |
625 | 652 |
|
... | ... | |
640 | 667 |
|
641 | 668 |
$form->{"runningnumber_$i"} = $i; |
642 | 669 |
|
643 |
delete $form->{nextsub}; |
|
644 |
|
|
645 | 670 |
# format amounts |
646 | 671 |
map { |
647 | 672 |
$form->{"${_}_$i"} = |
648 | 673 |
$form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) |
649 | 674 |
} qw(sellprice listprice lastcost qty) if $form->{item} ne 'assembly'; |
650 | 675 |
|
676 |
delete $form->{nextsub}; |
|
677 |
|
|
678 |
} |
|
679 |
|
|
651 | 680 |
&display_form; |
652 | 681 |
|
653 | 682 |
$main::lxdebug->leave_sub(); |
Auch abrufbar als: Unified diff
item_selected: Multiselect bzw. Mengeneingabe beim Artikelselektor
Dieses Feature kann in den Benutzereinstellungen aktiviert werden.