From 583f1f0fb395147c5e6459d9c6569bdf8735ec3f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 9 Jun 2016 15:05:42 +0200 Subject: [PATCH] =?utf8?q?Weitere=20=C3=84nderungen=20f=C3=BCr=20den=20rev?= =?utf8?q?ert=20von=207735019=20Damit=20ist=20das=20Ticket=20#144=20erledi?= =?utf8?q?gt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/OE.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SL/OE.pm b/SL/OE.pm index 3666f7d90..c4e768be0 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -658,8 +658,12 @@ SQL dbh => $dbh); # link previous items with orderitems - foreach (qw(orderitems invoice)) { - if (!$form->{saveasnew} && !$form->{useasnew} && $form->{"converted_from_${_}_id_$i"}) { + # assume we have a new workflow if we link from invoice or order to quotation + # unluckily orderitems are used for quotation and orders - therefore one more + # check to be sure NOT to link from order to quotation + foreach (qw(orderitems)) { + if (!$form->{saveasnew} && !$form->{useasnew} && $form->{"converted_from_${_}_id_$i"} + && $form->{type} !~ 'quotation') { RecordLinks->create_links('dbh' => $dbh, 'mode' => 'ids', 'from_table' => $_, @@ -762,7 +766,7 @@ SQL $form->{convert_from_oe_ids} =~ s/\s+$//; my @convert_from_oe_ids = split m/\s+/, $form->{convert_from_oe_ids}; delete $form->{convert_from_oe_ids}; - if (scalar @convert_from_oe_ids) { + if (!$form->{useasnew} && scalar @convert_from_oe_ids) { RecordLinks->create_links('dbh' => $dbh, 'mode' => 'ids', 'from_table' => 'oe', @@ -920,7 +924,7 @@ sub retrieve { # if called in multi id mode, and still only got one id, switch back to single id if ($form->{"rowcount"} and $#ids == 0) { - $form->{"id"} = $ids[0]; + $form->{"id"} = $ids[0]; undef @ids; delete $form->{convert_from_oe_ids}; } -- 2.20.1