From b810b2e9c9384cace8b78db3e6acbc3916da5aea Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 16 Jan 2013 17:54:11 +0100 Subject: [PATCH] =?utf8?q?Kundentypnummernkreis=20nur=20ber=C3=BCcksichtig?= =?utf8?q?en,=20falls=20daf=C3=BCr=20Nummernkreis=20gesetzt=20ist?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Gilt analog für Lieferanten. Siehe #2138. --- SL/TransNumber.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SL/TransNumber.pm b/SL/TransNumber.pm index 47cdcd096..4f8cb4345 100644 --- a/SL/TransNumber.pm +++ b/SL/TransNumber.pm @@ -124,10 +124,11 @@ SQL my %numbers_in_use = selectall_as_map($form, $self->dbh, $query, $filters{trans_number}, 'in_use'); - my $number; - ($number) = selectfirst_array_query($form, $self->dbh, qq|SELECT customernumberinit FROM business WHERE id = ?|, $self->business_id) if $self->business_id; - ($number) = selectfirst_array_query($form, $self->dbh, qq|SELECT $filters{numberfield} FROM defaults|) if !$number; - $number ||= ''; + my $business_number; + ($business_number) = selectfirst_array_query($form, $self->dbh, qq|SELECT customernumberinit FROM business WHERE id = ?|, $self->business_id) if $self->business_id; + my $number = $business_number; + ($number) = selectfirst_array_query($form, $self->dbh, qq|SELECT $filters{numberfield} FROM defaults|) if !$number; + $number ||= ''; do { if ($number =~ m/\d+$/) { @@ -141,7 +142,7 @@ SQL } while ($numbers_in_use{$number}); if ($self->save) { - if ($self->business_id) { + if ($self->business_id && $business_number) { do_query($form, $self->dbh, qq|UPDATE business SET customernumberinit = ? WHERE id = ?|, $number, $self->business_id); } else { do_query($form, $self->dbh, qq|UPDATE defaults SET $filters{numberfield} = ?|, $number); -- 2.20.1