From d7fef83ac63cdf341b5719daa6306acdc4371269 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 12 Jun 2007 12:20:59 +0000 Subject: [PATCH] =?utf8?q?Kundenauftrag/Lieferantenbestellung:=20Wenn=20al?= =?utf8?q?le=20Positionen=20vollst=C3=A4ndig=20geliefert=20wurden=20(also?= =?utf8?q?=20in=20allen=20Positionen=20der=20Lagerein-/-ausgang=20=3D=3D?= =?utf8?q?=20Anzahl=20ist),=20so=20wird=20beim=20Speichern=20das=20Flag=20?= =?utf8?q?"Gelifert"=20automatisch=20gesetzt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/oe.pl | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index f66ad04cf..de5d6a225 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1935,12 +1935,37 @@ sub subtotal { $lxdebug->leave_sub(); } +sub check_delivered_flag { + $lxdebug->enter_sub(); + + if (($form->{type} ne 'sales_order') && ($form->{type} ne 'purchase_order')) { + return $lxdebug->leave_sub(); + } + + my $all_delivered = 0; + + foreach my $i (1 .. $form->{rowcount}) { + next if (!$form->{"id_$i"}); + + if ($form->parse_amount(\%myconfig, $form->{"qty_$i"}) == $form->parse_amount(\%myconfig, $form->{"ship_$i"})) { + $all_delivered = 1; + next; + } + + $all_delivered = 0; + last; + } + + $form->{delivered} = 1 if $all_delivered; + + $lxdebug->leave_sub(); +} + sub save_and_close { $lxdebug->enter_sub(); $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); - if ($form->{type} =~ /_order$/) { $form->isblank("transdate", $locale->text('Order Date missing!')); } else { @@ -1993,6 +2018,8 @@ sub save_and_close { $err = $locale->text('Cannot save order!'); + check_delivered_flag(); + } else { if ($form->{type} eq 'sales_quotation') { $form->{label} = $locale->text('Quotation'); @@ -2091,6 +2118,8 @@ sub save { $err = $locale->text('Cannot save order!'); + check_delivered_flag(); + } else { if ($form->{type} eq 'sales_quotation') { $form->{label} = $locale->text('Quotation'); -- 2.20.1