X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIS.pm;h=3896277c917b49118b3fb36ff0dd596b1e44fed0;hb=abd6359e164d3e7eaffd45a2549ee1e6c167f995;hp=e9e4711b1c02fa6830434a2336a906bff1e5b1a6;hpb=7d2c69950a1d3bf8a516a7d8df01be491319e264;p=kivitendo-erp.git diff --git a/SL/IS.pm b/SL/IS.pm index e9e4711b1..3896277c9 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -46,6 +46,7 @@ use SL::GenericTranslations; use SL::MoreCommon; use SL::IC; use SL::IO; +use SL::TransNumber; use Data::Dumper; use strict; @@ -515,7 +516,7 @@ sub post_invoice { my ($self, $myconfig, $form, $provided_dbh, $payments_only) = @_; # connect to database, turn off autocommit - my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); + my $dbh = $provided_dbh ? $provided_dbh : $form->get_standard_dbh; my ($query, $sth, $null, $project_id, @values); my $exchangerate = 0; @@ -538,6 +539,9 @@ sub post_invoice { &reverse_invoice($dbh, $form); } else { + my $trans_number = SL::TransNumber->new(type => $form->{type}, dbh => $dbh, number => $form->{invnumber}, save => 1); + $form->{invnumber} = $trans_number->create_unique unless $trans_number->is_unique; + $query = qq|SELECT nextval('glid')|; ($form->{"id"}) = selectrow_query($form, $dbh, $query);