Bug 10484: serials-edit.pl not checking for barcode field before checking for barcode...
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 17 Jun 2013 16:28:13 +0000 (12:28 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 1 Jul 2013 02:02:15 +0000 (19:02 -0700)
The script serials-edit.pl is not checking for the existence of the
barcode field before checking for barcode subfield for autoBarcode =
incremental. If the barcode field doesn't exist, the script dies with
errors.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script.
Checked that adding items on serial receive still works.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

serials/serials-edit.pl

index 66d3a4e..34f1031 100755 (executable)
@@ -318,8 +318,12 @@ if ( $op and $op eq 'serialchangestatus' ) {
                     if ( C4::Context->preference('autoBarcode') eq
                         'incremental' )
                     {
-                        if ( !$bib_record->field($barcodetagfield)
-                            ->subfield($barcodetagsubfield) )
+                        if (
+                            !(
+                                   $bib_record->field($barcodetagfield)
+                                && $bib_record->field($barcodetagfield)->subfield($barcodetagsubfield)
+                            )
+                          )
                         {
                             my $sth_barcode = $dbh->prepare(
                                 'select max(abs(barcode)) from items');