From aff323443f53c620df903bce841d92ad71c372ba Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 8 Jan 2014 12:21:03 +0100 Subject: [PATCH] =?utf8?q?OE.pm:=20SL::TransNumber=20anstelle=20von=20Form?= =?utf8?q?->update=5Fdefaults=20f=C3=BCr=20Nummernkreise=20nutzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/OE.pm | 5 +++++ bin/mozilla/oe.pl | 10 ++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/SL/OE.pm b/SL/OE.pm index 797eb9717..3d92746b5 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -46,6 +46,7 @@ use SL::DB::Status; use SL::DB::Tax; use SL::DBUtils; use SL::IC; +use SL::TransNumber; use strict; @@ -314,6 +315,10 @@ sub save { my $ml = ($form->{type} eq 'sales_order') ? 1 : -1; + my $number_field = $form->{type} =~ m{order} ? 'ordnumber' : 'quonumber'; + my $trans_number = SL::TransNumber->new(type => $form->{type}, dbh => $dbh, number => $form->{$number_field}, id => $form->{id}); + $form->{$number_field} ||= $trans_number->create_unique; + if ($form->{id}) { $query = qq|DELETE FROM custom_variables WHERE (config_id IN (SELECT id FROM custom_variable_configs WHERE module = 'IC')) diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 3ee71e67f..b6c22624c 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1122,10 +1122,8 @@ sub save_and_close { } - # get new number in sequence if no number is given or if saveasnew was requested - if (!$form->{$ordnumber} || $form->{saveasnew}) { - $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld); - } + # get new number in sequence if saveasnew was requested + delete $form->{$ordnumber} if $form->{saveasnew}; relink_accounts(); @@ -1232,10 +1230,6 @@ sub save { } - # value of $ordnumber is ordnumber or quonumber - $form->{$ordnumber} = $form->update_defaults(\%myconfig, $numberfld) - unless $form->{$ordnumber}; - relink_accounts(); OE->save(\%myconfig, \%$form); -- 2.20.1