Bugzilla – Attachment 126430 Details for
Bug 22204
Leading spaces in barcode should not allowed in cataloguing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[21.05] Bug 22204: Use barcodedecode in additem.pl
2105-Bug-22204-Use-barcodedecode-in-additempl.patch (text/plain), 1.95 KB, created by
Julian Maurice
on 2021-10-18 11:46:29 UTC
(
hide
)
Description:
[21.05] Bug 22204: Use barcodedecode in additem.pl
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2021-10-18 11:46:29 UTC
Size:
1.95 KB
patch
obsolete
>From 856905a78c64077d07d7621ab53926dc2d2f0c6e Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 14 Oct 2021 12:18:36 +0200 >Subject: [PATCH] [21.05] Bug 22204: Use barcodedecode in additem.pl >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: >1. Set syspref itemBarcodeInputFilter to 'whitespace' >2. Create an item with barcode "1" >3. Try to create an item with barcode " 1 " and verify that it is > blocked >4. Create an item with barcode " XXXXX " and verify that it is saved > without spaces in database: > SELECT barcode FROM items WHERE barcode LIKE '%XXXXX%' > >Co-authored-by: Jérémy Breuillard <jeremy.breuillard@biblibre.com> >--- > cataloguing/additem.pl | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index d33723b798..7c65a4b140 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -88,6 +88,18 @@ sub set_item_default_location { > $item->store; > } > >+sub _barcodedecode { >+ my ($record) = @_; >+ >+ my ($tagfield, $tagsubfield) = GetMarcFromKohaField('items.barcode'); >+ my $item_field = $record->field($tagfield); >+ my $barcode = $item_field->subfield($tagsubfield); >+ if ($barcode) { >+ $barcode = barcodedecode($barcode); >+ $item_field->update($tagsubfield => $barcode); >+ } >+} >+ > # NOTE: This code is subject to change in the future with the implemenation of ajax based autobarcode code > # NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript > sub _increment_barcode { >@@ -511,6 +523,8 @@ if ($op eq "additem") { > $add_duplicate_submit = 1 if ($prefillitem); > $justaddeditem = 1; > >+ _barcodedecode($record); >+ > # if autoBarcode is set to 'incremental', calculate barcode... > if ( C4::Context->preference('autoBarcode') eq 'incremental' ) { > $record = _increment_barcode($record, $frameworkcode); >-- >2.20.1
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 22204
:
126266
|
126344
| 126430