From: Moritz Bunkus Date: Wed, 8 Jan 2014 11:21:03 +0000 (+0100) Subject: OE.pm: SL::TransNumber anstelle von Form->update_defaults für Nummernkreise nutzen X-Git-Tag: release-3.1.0beta1~22^2~22^2~10^2^2~7 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=aff323443f53c620df903bce841d92ad71c372ba;p=kivitendo-erp.git OE.pm: SL::TransNumber anstelle von Form->update_defaults für Nummernkreise nutzen --- 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);