IS.pm: SL::TransNumber anstelle von Form->update_defaults für Nummernkreise nutzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 8 Jan 2014 12:05:06 +0000 (13:05 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 8 Jan 2014 12:05:06 +0000 (13:05 +0100)
SL/IS.pm

index b00e809..9470f1a 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -50,6 +50,7 @@ use SL::IO;
 use SL::TransNumber;
 use SL::DB::Default;
 use SL::DB::Tax;
+use SL::TransNumber;
 use Data::Dumper;
 
 use strict;
@@ -582,9 +583,8 @@ sub post_invoice {
       do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"}, $form->{currency});
 
       if (!$form->{invnumber}) {
-        $form->{invnumber} =
-          $form->update_defaults($myconfig, $form->{type} eq "credit_note" ?
-                                 "cnnumber" : "invnumber", $dbh);
+        my $trans_number   = SL::TransNumber->new(type => $form->{type}, dbh => $dbh, number => $form->{invnumber}, id => $form->{id});
+        $form->{invnumber} = $trans_number->create_unique;
       }
     }
   }