From: Jan Büren Date: Tue, 9 Dec 2014 15:09:36 +0000 (+0100) Subject: orderitems persistent machen. X-Git-Tag: release-3.2.0beta~195 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=02022dc2c7dca5f12d37feb3c4edbb1c7b7dad36;p=kivitendo-erp.git orderitems persistent machen. bei vorlage als und position löschen entsprechend die ids löschen, sodass diese beim speichern des neuen beleges, bzw. beim neu erstellen der positionen erzeugt werden. Folgende Szenarien geprüft: Von Angebot: -> erneuern i.O. -> mittlere Position löschen i.O. -> als neu speichern i.O. -> Speichern, Löschen, neue Pos i.O. -> Angebot -> Auftrag i.O. Rücksprünge von: -> Auftrag -> Angebot (quotation in io.pl!) i.O. -> Lieferantenauftrag -> Verkaufsauftrag i.O. -> Lieferantenauftrag -> Lieferantenanfrage i.O. -> Verkaufs-Rechnung -> Auftrag (keine orderitems vorhanden) i.O. --- diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 5af1b8817..5a17d680a 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -760,7 +760,7 @@ sub remove_emptied_rows { sellprice_pg pricegroup_old price_old price_new unit_old ordnumber donumber transdate longdescription basefactor marge_total marge_percent marge_price_factor lastcost price_factor_id partnotes - stock_out stock_in has_sernumber reqdate); + stock_out stock_in has_sernumber reqdate orderitems_id); my $ic_cvar_configs = CVar->get_configs(module => 'IC'); push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; @@ -917,6 +917,11 @@ sub quotation { _check_io_auth(); + # we are coming from *_order and convert to quotation + # it seems that quotation is only called if we have a existing order + if ($form->{type} =~ /(sales|purchase)_order/) { + delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; + } if ($form->{second_run}) { $form->{print_and_post} = 0; } diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 59b5c6206..66b2dbaa8 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1612,6 +1612,7 @@ sub save_as_new { $form->{saveasnew} = 1; map { delete $form->{$_} } qw(printed emailed queued delivered closed); + delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; # Let kivitendo assign a new order number if the user hasn't changed the # previous one. If it has been changed manually then use it as-is. @@ -1810,6 +1811,7 @@ sub poso { # reset map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered ordnumber); + delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; # if purchase_order was generated from sales_order, use lastcost_$i as sellprice_$i # also reset discounts @@ -1817,6 +1819,7 @@ sub poso { for my $i (1 .. $form->{rowcount}) { $form->{"sellprice_${i}"} = $form->{"lastcost_${i}"}; $form->{"discount_${i}"} = 0; + delete $form->{"orderitems_id_$_"}; }; };