From 7a364ba1ae70e219988264ca2b9aeb528e0cb14a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 2 Aug 2021 09:55:45 +0200 Subject: [PATCH] =?utf8?q?Falls=20der=20WF=20Auftrag=20->=20Lieferschein?= =?utf8?q?=20genutzt=20wird,=20min.=201=20Position=20=C3=BCbernehmen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Damit auch wirklich der Geliefert Status pro Position korrekt gesetzt werden kann, muss mindestens eine Position aus dem Original-Auftrag im Workflow vorhanden sein. --- bin/mozilla/do.pl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 0905b4876..6adf190ea 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -943,7 +943,20 @@ sub save { } $form->{id} = 0 if $form->{saveasnew}; - + # we rely on converted_from_orderitems, if the workflow is used + # be sure that at least one position is linked to the original orderitem + if ($form->{convert_from_oe_ids}) { + my $has_linked_pos; + for my $i (1 .. $form->{rowcount}) { + if ($form->{"converted_from_orderitems_id_$i"}) { + $has_linked_pos = 1; + last; + } + } + if (!$has_linked_pos) { + $form->error($locale->text('Need at least one original position for the workflow Order to Delivery Order!')); + } + } DO->save(); # saving the history if(!exists $form->{addition}) { -- 2.20.1