From fa73b8373361cf1929f70ba5324de27d6edfe379 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 18 May 2009 13:03:32 +0000 Subject: [PATCH] =?utf8?q?Beim=20Einlagern=20aus=20dem=20Lagersystem=20neu?= =?utf8?q?e=20Waren=20auch=20anlegen.=20Note:=20F=C3=BCr=20Erzeugnisse=20f?= =?utf8?q?unktioniert=20dieser=20Mechanismus=20nicht,=20weil=20irgendwer?= =?utf8?q?=20es=20f=C3=BCr=20wahnsinnig=20schlau=20hielt,=20Assemblies=20s?= =?utf8?q?o=20zu=20coden,d=20ass=20sie=20reaonly=20sind,=20sobald=20previo?= =?utf8?q?us=5Fform=20gesetzt=20ist.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Partieller Fix für Bug 937. --- bin/mozilla/wh.pl | 42 +++++++++++++++++++++++++++++++++++++----- locale/de/wh | 1 + 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index d632d5d96..c3932ac86 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -292,7 +292,9 @@ sub transfer_stock_update_part { my $parts = Common->retrieve_parts(\%myconfig, $form, 'description', 1); - if (scalar @{ $parts } == 1) { + if (!scalar @{ $parts }) { + new_item(action => "transfer_stock_update_part"); + } elsif (scalar @{ $parts } == 1) { @{$form}{qw(parts_id partnumber description ean)} = @{$parts->[0]}{qw(id partnumber description ean)}; transfer_stock_get_partunit(); transfer_warehouse_selection(); @@ -311,7 +313,7 @@ sub transfer_stock_update_part { # -------------------------------------------------------------------- # Transfer: assemblies -# Dies ist die Auswahlmaske für ein assembly. +# Dies ist die Auswahlmaske für ein assembly. # Die ist einfach von transfer_assembly_update_part kopiert und nur um den trans_type (assembly) korrigiert worden # Es wäre schön, hier nochmal check_assembly_max_create auf, um die max. Fertigungszahl herauszufinden. # Ich lass das mal als auskommentierte Idee bestehen jb 18.3.09 @@ -345,7 +347,7 @@ sub transfer_assembly_update_part { } # hier die oben benannte idee -# my $maxcreate = Common->check_assembly_max_create(assembly_id => $form->{parts_id}, dbh => $my_dbh); +# my $maxcreate = Common->check_assembly_max_create(assembly_id => $form->{parts_id}, dbh => $my_dbh); $lxdebug->leave_sub(); } sub transfer_stock_part_selected { @@ -386,11 +388,11 @@ sub create_assembly { if ($form->{qty} <= 0) { $form->show_generic_error($locale->text('Invalid quantity.'), 'back_button' => 1); } - # TODO Es wäre schön, hier schon die maximale Anzahl der zu fertigenden Erzeugnisse zu haben + # TODO Es wäre schön, hier schon die maximale Anzahl der zu fertigenden Erzeugnisse zu haben #else { if ($form->{qty} > $maxcreate) { #s.o. # $form->show_generic_error($locale->text('Can not create that quantity with current stock'), 'back_button' => 1); # $form->show_generic_error('Maximale Stückzahl' . $maxcreate , 'back_button' => 1); - # } + # } # } if (!$form->{warehouse_id} || !$form->{bin_id}) { @@ -880,6 +882,36 @@ sub get_bin_idx { return -1; } +=item new_item + +call new item dialogue from warehouse masks. + +PARAMS: + action => name of sub to be called when new item is done + +=cut +sub new_item { + $main::lxdebug->enter_sub(); + my %params = @_; + + # change callback + $form->{old_callback} = $form->escape($form->{callback}, 1); + $form->{callback} = $form->escape("$form->{script}?action=$params{action}", 1); + + # save all form variables except action in a previousform variable + my $previousform = join '&', map { my $value = $form->{$_}; $value =~ s/&/%26/; "$_=$value" } grep { !/action/ } keys %$form; + +# push @HIDDENS, { 'name' => 'previousform', 'value' => $form->escape($previousform, 1) }; + push @HIDDENS, map +{ 'name' => $_, 'value' => $form->{$_} }, qw(partnumber description unit vc sellprice ean); + push @HIDDENS, { 'name' => 'taxaccount2', 'value' => $form->{taxaccounts} }; + push @HIDDENS, { 'name' => 'notes', 'value' => $form->{longdescription} }; + + $form->header(); + print $form->parse_html_template("generic/new_item", { HIDDENS => [ sort { $a->{name} cmp $b->{name} } @HIDDENS ] } ); + + $main::lxdebug->leave_sub(); +} + sub update { call_sub($form->{update_nextsub} || $form->{nextsub}); } diff --git a/locale/de/wh b/locale/de/wh index 061187746..54ea75c08 100644 --- a/locale/de/wh +++ b/locale/de/wh @@ -248,6 +248,7 @@ $self->{subs} = { 'gl_transaction' => 'gl_transaction', 'journal' => 'journal', 'mark_as_paid_common' => 'mark_as_paid_common', + 'new_item' => 'new_item', 'part_selection_internal' => 'part_selection_internal', 'reformat_numbers' => 'reformat_numbers', 'removal_parts_selection' => 'removal_parts_selection', -- 2.20.1