Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode
authorFrédéric Demians <f.demians@tamil.fr>
Mon, 3 Dec 2018 17:02:03 +0000 (18:02 +0100)
committerLucas Gass <lucas@bywatersolutions.com>
Mon, 13 May 2019 07:50:29 +0000 (07:50 +0000)
This patch fix the barcode annual builder. The test should pass.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 31ace6a9347a8260532f6cc50d55fc36f87f1b44)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 9109d862a08a53dd6328eed902dd4ed45de7f673)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

C4/Barcodes/ValueBuilder.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref

index 81747de..ef9f28e 100644 (file)
@@ -89,7 +89,7 @@ sub get_barcode {
     my $nextnum;
     my $query = "select max(cast( substring_index(barcode, '-',-1) as signed)) from items where barcode like ?";
     my $sth=C4::Context->dbh->prepare($query);
-    $sth->execute("$args->{year}%");
+    $sth->execute($args->{year} . '-%');
     while (my ($count)= $sth->fetchrow_array) {
         warn "Examining Record: $count" if $DEBUG;
         $nextnum = $count if $count;
index c25164d..00f9fc0 100644 (file)
@@ -105,8 +105,8 @@ Cataloging:
             - pref: autoBarcode
               choices:
                   incremental: generated in the form 1, 2, 3.
-                  annual: generated in the form &lt;year&gt;-0001, &lt;year&gt;-0002.
-                  hbyymmincr: generated in the form &lt;branchcode&gt;yymm0001.
+                  annual: generated in the form <year>-0001, <year>-0002.
+                  hbyymmincr: generated in the form <branchcode>yymm0001.
                   EAN13: incremental EAN-13 barcodes
                   "OFF": not generated automatically.
         -