bug 2884: followup patch
[koha.git] / C4 / Labels.pm
index 6531164..3a21bbd 100644 (file)
@@ -275,7 +275,9 @@ sub add_batch ($;$) {
        my $table = (@_ and 'patroncards' eq shift) ? 'patroncards' : 'labels';
     my $batch_list = (@_) ? shift : undef;
     my $dbh = C4::Context->dbh;
-    my $q ="SELECT MAX(DISTINCT batch_id) FROM $table";
+    # FIXME : batch_id  should be an auto_incr INT.  Temporarily casting as int ( see koha bug 2555 )
+    # until a label_batches table is added, and we can convert batch_id to int.
+    my $q ="SELECT MAX( CAST(batch_id AS SIGNED) ) FROM $table";
     my $sth = $dbh->prepare($q);
     $sth->execute();
     my ($batch_id) = $sth->fetchrow_array || 0;
@@ -992,7 +994,7 @@ sub split_fcn {
     # Split fiction call numbers based on spaces
     SPLIT_FCN:
     while ($fcn) {
-        if ($fcn =~ m/([A-Za-z0-9]+)(\W?).*?/x) {
+        if ($fcn =~ m/([A-Za-z0-9]+\.?[0-9]?)(\W?).*?/x) {
             push (@fcn_split, $1);
             $fcn = $';
         }
@@ -1096,6 +1098,7 @@ sub DrawSpineText {
             }
             # loop for each string line
             foreach my $str (@strings) {
+                next if $str eq '';
                 my $hPos = 0;
                 my $stringwidth = prStrWidth($str, $fontname, $fontsize);
                 if ( $$conf_data->{'text_justify'} eq 'R' ) {