From 6dcf04cf16223f241b648b961ba4bb09ec21c11e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 29 Dec 2010 10:51:19 +0100 Subject: [PATCH] Beim Buchen von Verkaufsrechnungen erzwingen, dass die Rechnungsnummer eindeutig ist MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix für Bug 1454. --- SL/IS.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.20.1