From 5ea712a250510e49b93e8cc82b7426229bb890b6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 29 Jul 2013 16:31:31 +0200 Subject: [PATCH] =?utf8?q?Lagerpl=C3=A4tze=20anlegen:=20Nummerierung=20mit?= =?utf8?q?=20Anzahl=20existierender=20Lagerpl=C3=A4tze=20starten?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ...und nicht mit 1, weil ansonsten beim mehrfachen Anlegen die Nummern doppelt und dreifach vergeben werden. Fixt #2325. --- SL/AM.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SL/AM.pm b/SL/AM.pm index cf48de61c..5764c6a3e 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1785,11 +1785,12 @@ sub save_warehouse { $form->{description}, $form->{invalid} ? 't' : 'f', conv_i($form->{id})); if (0 < $form->{number_of_new_bins}) { + my ($num_existing_bins) = selectfirst_array_query($form, $dbh, qq|SELECT COUNT(*) FROM bin WHERE warehouse_id = ?|, $form->{id}); $query = qq|INSERT INTO bin (warehouse_id, description) VALUES (?, ?)|; $sth = prepare_query($form, $dbh, $query); foreach my $i (1..$form->{number_of_new_bins}) { - do_statement($form, $sth, $query, conv_i($form->{id}), "$form->{prefix}${i}"); + do_statement($form, $sth, $query, conv_i($form->{id}), "$form->{prefix}" . ($i + $num_existing_bins)); } $sth->finish(); -- 2.20.1