Bugzilla – Attachment 87153 Details for
Bug 10345
Copy number should be incremented when adding multiple items at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10345: Increment copy number when adding multiple copies.
Bug-10345-Increment-copy-number-when-adding-multip.patch (text/plain), 2.65 KB, created by
Björn Nylén
on 2019-03-29 08:09:43 UTC
(
hide
)
Description:
Bug 10345: Increment copy number when adding multiple copies.
Filename:
MIME Type:
Creator:
Björn Nylén
Created:
2019-03-29 08:09:43 UTC
Size:
2.65 KB
patch
obsolete
>From 085ca1aa02a90193a258ce76cf64e5db21f496a9 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Nyl=C3=A9n?= <bjorn.nylen@ub.lu.se> >Date: Thu, 28 Mar 2019 10:28:29 +0100 >Subject: [PATCH] Bug 10345: Increment copy number when adding multiple copies. > >To test: >1. Add multiple copies of an item with data in the 'Copy number' field. Note that tha data will be identical for all items. >2. Apply patch. >3. Add multiple copies of an item with a positive integer (ie. only digits) in the 'Copy number' field. Note that the copy number is incremented for each item. >4. Add multiple copies of an item with some other type of data in the 'Copy number' field. Note that the copy number field remains unchanged for the added items. >--- > cataloguing/additem.pl | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 7b6d5e4..ec3750b 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -536,9 +536,11 @@ if ($op eq "additem") { > > use C4::Barcodes; > my $barcodeobj = C4::Barcodes->new; >+ my $copynumber = $addedolditem->{'copynumber'}; > my $oldbarcode = $addedolditem->{'barcode'}; > my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); >- >+ my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField("items.copynumber",$frameworkcode); >+ > # If there is a barcode and we can't find their new values, we can't add multiple copies > my $testbarcode; > $testbarcode = $barcodeobj->next_value($oldbarcode) if $barcodeobj; >@@ -567,11 +569,15 @@ if ($op eq "additem") { > if ($barcodevalue) { > $record->field($tagfield)->update($tagsubfield => $barcodevalue); > } >- >+ > # Checking if the barcode already exists > $exist_itemnumber = get_item_from_barcode($barcodevalue); > } >- >+ # Updating record with the new copynumber >+ if ( $copynumber ){ >+ $record->field($copytagfield)->update($copytagsubfield => $copynumber); >+ } >+ > # Adding the item > if (!$exist_itemnumber) { > my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); >@@ -581,6 +587,8 @@ if ($op eq "additem") { > # That way, all items are added, even if there was some already existing barcodes > # FIXME : Please note that there is a risk of infinite loop here if we never find a suitable barcode > $i++; >+ # Only increment copynumber if item was really added >+ $copynumber++ if ( $copynumber && $copynumber =~ m/^\d+$/ ); > } > > # Preparing the next iteration >-- >2.1.4
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 10345
:
87153
|
87237
|
87353