From 02022dc2c7dca5f12d37feb3c4edbb1c7b7dad36 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 9 Dec 2014 16:09:36 +0100 Subject: [PATCH] =?utf8?q?orderitems=20persistent=20machen.=20bei=20vorlag?= =?utf8?q?e=20als=20und=20position=20l=C3=B6schen=20entsprechend=20die=20i?= =?utf8?q?ds=20l=C3=B6schen,=20sodass=20diese=20beim=20speichern=20des=20n?= =?utf8?q?euen=20beleges,=20bzw.=20beim=20neu=20erstellen=20der=20position?= =?utf8?q?en=20erzeugt=20werden.=20Folgende=20Szenarien=20gepr=C3=BCft:=20?= =?utf8?q?Von=20Angebot:=20->=20erneuern=20=20=20=20=20=20=20=20=20=20=20?= =?utf8?q?=20=20=20=20=20=20=20=20=20=20=20=20i.O.=20->=20mittlere=20Posit?= =?utf8?q?ion=20l=C3=B6schen=20=20=20=20=20=20i.O.=20->=20als=20neu=20spei?= =?utf8?q?chern=20=20=20=20=20=20=20=20=20=20=20=20=20=20i.O.=20->=20Speic?= =?utf8?q?hern,=20L=C3=B6schen,=20neue=20Pos=20=20=20i.O.=20->=20Angebot?= =?utf8?q?=20->=20Auftrag=20=20=20=20=20=20=20=20=20=20=20=20=20i.O.=20R?= =?utf8?q?=C3=BCckspr=C3=BCnge=20von:=20->=20Auftrag=20->=20Angebot=20(quo?= =?utf8?q?tation=20in=20io.pl!)=20i.O.=20->=20Lieferantenauftrag=20->=20Ve?= =?utf8?q?rkaufsauftrag=20=20=20=20i.O.=20->=20Lieferantenauftrag=20->=20L?= =?utf8?q?ieferantenanfrage=20i.O.=20->=20Verkaufs-Rechnung=20->=20Auftrag?= =?utf8?q?=20(keine=20orderitems=20vorhanden)=20i.O.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/io.pl | 7 ++++++- bin/mozilla/oe.pl | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) 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_$_"}; }; }; -- 2.20.1