From 6f1f8790e7b0b8297e72dba4bde7ed4252218033 Mon Sep 17 00:00:00 2001 From: Charles Farmer Date: Fri, 30 Mar 2018 10:18:09 -0400 Subject: [PATCH] Bug15239: feed branch to Barcode constructor, in case of hbyymmincr --- cataloguing/additem.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index a6aa25c..6d5e8be 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -439,6 +439,9 @@ if ($prefillitem) { } } +#---- finds where items.homebranch is stored +my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", $frameworkcode); + #------------------------------------------------------------------------------- if ($op eq "additem") { @@ -527,9 +530,18 @@ if ($op eq "additem") { if ($add_multiple_copies_submit) { use C4::Barcodes; - my $barcodeobj = C4::Barcodes->new; my $oldbarcode = $addedolditem->{'barcode'}; my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); + my $barcodeobj; + if ( C4::Context->preference('autoBarcode') eq 'hbyymmincr' ) { + my $record_branch = + $record + ->field($branchtagfield) + ->subfield($branchtagsubfield); + $barcodeobj = C4::Barcodes->new('hbyymmincr', $record_branch); + } else { + $barcodeobj = C4::Barcodes->new(); + } # If there is a barcode and we can't find their new values, we can't add multiple copies my $testbarcode; @@ -733,7 +745,6 @@ my %witness; #---- stores the list of subfields used at least once, with the "me my @big_array; #---- finds where items.itemnumber is stored my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", $frameworkcode); -my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", $frameworkcode); C4::Biblio::EmbedItemsInMarcBiblio($temp, $biblionumber); my @fields = $temp->fields(); -- 2.7.4