Bugzilla – Attachment 149700 Details for
Bug 32959
Item templates will apply the same barcode each time template is applied if autobarcode is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32959: Don't store results of autobarcode in item editor templates
Bug-32959-Dont-store-results-of-autobarcode-in-ite.patch (text/plain), 2.39 KB, created by
Phil Ringnalda
on 2023-04-14 17:34:27 UTC
(
hide
)
Description:
Bug 32959: Don't store results of autobarcode in item editor templates
Filename:
MIME Type:
Creator:
Phil Ringnalda
Created:
2023-04-14 17:34:27 UTC
Size:
2.39 KB
patch
obsolete
>From 9fe62396dbfe44a2e861dfeb4db1cc0da10ebe8c Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Tue, 14 Feb 2023 08:51:13 -0500 >Subject: [PATCH] Bug 32959: Don't store results of autobarcode in item editor > templates > >Test Plan: >1) Enable autobarcode >2) Create a new item template, leave the barcode field blank >3) Apply that item template >4) Note the template prefills the barcode field >5) Delete that item template >6) Apply this patch >7) Restart all the things! >8) Repeat steps 2-4 >9) Note the barcode field remains empty! > >Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> >--- > cataloguing/additem.pl | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 5ba7ab5199..4630eec0a4 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -276,6 +276,7 @@ if ($op eq "additem") { > } > > # if autoBarcode is set to 'incremental', calculate barcode... >+ my $submitted_barcode = $item->barcode; > if ( ! defined $item->barcode && C4::Context->preference('autoBarcode') eq 'incremental' ) { > my ( $barcode ) = C4::Barcodes::ValueBuilder::incremental::get_barcode; > $item->barcode($barcode); >@@ -288,13 +289,16 @@ if ($op eq "additem") { > my $template_is_shared = $input->param('template_is_shared'); > my $replace_template_id = $input->param('replace_template_id'); > >+ my $contents = $item->unblessed; >+ $contents->{barcode} = $submitted_barcode; # Don't save the autobarcode in the template >+ > if ($replace_template_id) { > my $template = Koha::Item::Templates->find($replace_template_id); > $template->update( > { > id => $replace_template_id, > is_shared => $template_is_shared ? 1 : 0, >- contents => $item->unblessed, >+ contents => $contents, > } > ) if $template && ( > $template->patron_id eq $loggedinuser >@@ -308,7 +312,7 @@ if ($op eq "additem") { > name => $template_name, > patron_id => $loggedinuser, > is_shared => $template_is_shared ? 1 : 0, >- contents => $item->unblessed, >+ contents => $contents, > } > )->store(); > } >-- >2.40.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 32959
:
146615
|
149700
|
150694
|
150832