From: Moritz Bunkus Date: Tue, 12 Jun 2007 12:20:59 +0000 (+0000) Subject: Kundenauftrag/Lieferantenbestellung: Wenn alle Positionen vollständig geliefert wurde... X-Git-Tag: release-2.4.3^2~161 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d7fef83ac63cdf341b5719daa6306acdc4371269;p=kivitendo-erp.git Kundenauftrag/Lieferantenbestellung: Wenn alle Positionen vollständig geliefert wurden (also in allen Positionen der Lagerein-/-ausgang == Anzahl ist), so wird beim Speichern das Flag "Gelifert" automatisch gesetzt. --- 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');