Bugzilla – Attachment 95208 Details for
Bug 23851
Auto generate accession number format <branchcode>yymm0001 fails to add branchcode prefix(branchcode) for multiple item addition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items
Bug-23851-Add-the-homebranch-prefix-to-the-barcode.patch (text/plain), 2.31 KB, created by
Marcel de Rooy
on 2019-11-08 11:27:43 UTC
(
hide
)
Description:
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-11-08 11:27:43 UTC
Size:
2.31 KB
patch
obsolete
>From c9369be4fc85d2e4b66dbb00937235a1865306f6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 22 Oct 2019 11:36:28 +0200 >Subject: [PATCH] Bug 23851: Add the homebranch prefix to the barcode when > adding multiple copies of an items >Content-Type: text/plain; charset=utf-8 > >See the comment in the code for more information. > >Test plan: >- Set autoBarcode to hbyymmincr >- Create an item and click on the barcode field >- A barcode prefixed by the homebranch is generated >- Click the "Add multiple copies of this item" and enter 4 >- Save >=> Without this patch only the first item has the homebranch prefix >=> With this patch applied they all have a barcode in the same format > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > cataloguing/additem.pl | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 52a8ca13a9..2c371def28 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -577,7 +577,17 @@ if ($op eq "additem") { > > # Putting it into the record > if ($barcodevalue) { >- $record->field($tagfield)->update($tagsubfield => $barcodevalue); >+ if ( C4::Context->preference("autoBarcode") eq 'hbyymmincr' && $i > 0 ) { # The first copy already contains the homebranch prefix >+ # This is terribly hacky but the easiest way to fix the way hbyymmincr is working >+ # Contrary to what one might think, the barcode plugin does not prefix the returned string with the homebranch >+ # For a single item, it is handled with some JS code (see cataloguing/value_builder/barcode.pl) >+ # But when adding multiple copies we need to prefix it here, >+ # so we retrieve the homebranch from the item and prefix the barcode with it. >+ my ($hb_field, $hb_subfield) = GetMarcFromKohaField( "items.homebranch" ); >+ my $homebranch = $record->subfield($hb_field, $hb_subfield); >+ $barcodevalue = $homebranch . $barcodevalue; >+ } >+ $record->field($tagfield)->update($tagsubfield => $barcodevalue); > } > > # Checking if the barcode already exists >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23851
:
94430
|
94519
|
94974
| 95208