Bugzilla – Attachment 94036 Details for
Bug 23435
Add multiple copies of an item when receiving in serials
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23435: Add multiple copies of an item when receiving in serials
Bug-23435-Add-multiple-copies-of-an-item-when-rece.patch (text/plain), 7.67 KB, created by
Katrin Fischer
on 2019-10-12 10:45:02 UTC
(
hide
)
Description:
Bug 23435: Add multiple copies of an item when receiving in serials
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-10-12 10:45:02 UTC
Size:
7.67 KB
patch
obsolete
>From 49c021ed1345db4f4b6917a7a0c4e2d215864a2d Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Fri, 9 Aug 2019 03:34:45 +0000 >Subject: [PATCH] Bug 23435: Add multiple copies of an item when receiving in > serials > >This feature allows you to add multiple item records when receiving a >serial, if the subscription is set to 'create item record when receiving >serials'. Please note this is not the same as multi-receiving, more like >multi-adding! > >To test: >1) Create a subscription, ensure the 'Create an item record when >receiving this serial' option is selected >2) Receive a serial >3) Expand the item form by selecting 'click to add item' >4) Fill in details, including a barcode. Leave 'number of copies' as 1 >and Save. >5) Confirm the serial is received as expected. >6) In another tab, open the bibliographic record attached to this >subscription >7) Confirm the item record was created upon receiving the serial >8) Go back to the serial collection and receive next serial >9) Expand the item form by selecting 'click to add item' >10) Fill in details again, this time change 'number of copies' to a >different number e.g. 3, and Save >11) Confirm the serial is received as expected. >12) Check back at the biblio record that 3 item records were created and >the barcode was incremented for each additional item. > >Sponsored-by: Brimbank City Council >Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/serials/serials-edit.tt | 15 ++++++++-- > serials/serials-edit.pl | 35 +++++++++++++++------- > 2 files changed, 37 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >index 7d95e0564d..297967cc30 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >@@ -258,8 +258,14 @@ $(document).ready(function() { > [% END %] > [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %] > </div></li> >+ > [% END %]</ol></div><!-- /iteminformation --> >- >+ >+ <hr> >+ <div class="subfield_line"> >+ <label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" size="2"> <span class="hint">The barcode you enter will be incremented for each additional item.</p> >+ </div> >+ > <input type="hidden" name="moditem" value="" /> > <input type="hidden" name="tag" value="[% item.itemtagfield | html %]" /> > <input type="hidden" name="subfield" value="[% item.itemtagsubfield | html %]" /> >@@ -405,7 +411,12 @@ $(document).ready(function() { > [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %] > </div> > </li>[% END %]</ol> >- >+ >+ <hr> >+ <div class="subfield_line"> >+ <label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" size="2"> <span class="hint">The barcode you enter will be incremented for each additional item.</p> >+ </div> >+ > <input type="hidden" name="moditem" value="" /> > <input type="hidden" name="tag" value="[% newserialloo.itemtagfield | html %]" /> > <input type="hidden" name="subfield" value="[% newserialloo.itemtagsubfield | html %]" /> >diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl >index 9873fc99db..749e126216 100755 >--- a/serials/serials-edit.pl >+++ b/serials/serials-edit.pl >@@ -284,6 +284,7 @@ if ( $op and $op eq 'serialchangestatus' ) { > my @itemid = $query->multi_param('itemid'); > my @ind_tag = $query->multi_param('ind_tag'); > my @indicator = $query->multi_param('indicator'); >+ my @num_copies = $query->multi_param('number_of_copies'); > > #Rebuilding ALL the data for items into a hash > # parting them on $itemid. >@@ -310,6 +311,7 @@ if ( $op and $op eq 'serialchangestatus' ) { > $field_values[$i]; > push @{ $itemhash{ $itemid[$i] }->{'ind_tag'} }, $ind_tag[$i]; > push @{ $itemhash{ $itemid[$i] }->{'indicator'} }, $indicator[$i]; >+ push @{ $itemhash{ $itemid[$i] }->{'num_copies'} }, $num_copies[$i]; > } > foreach my $item ( keys %itemhash ) { > >@@ -333,11 +335,15 @@ if ( $op and $op eq 'serialchangestatus' ) { > $itemhash{$item}->{'ind_tag'} > ); > >- # warn $xml; >+ # warn $xml; > my $bib_record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); > if ( $item =~ /^N/ ) { > >- #New Item >+ $itemhash{$item}->{'num_copies'} //= 1; >+ >+ for (my $copy = 0; $copy < $itemhash{$item}->{'num_copies'}[$index];){ >+ >+ # New Item > > # if autoBarcode is set to 'incremental', calculate barcode... > my ( $barcodetagfield, $barcodetagsubfield ) = GetMarcFromKohaField( 'items.barcode' ); >@@ -356,21 +362,24 @@ if ( $op and $op eq 'serialchangestatus' ) { > $sth_barcode->execute; > my ($newbarcode) = $sth_barcode->fetchrow; > >-# OK, we have the new barcode, add the entry in MARC record # FIXME -> should be using barcode plugin here. >- $bib_record->field($barcodetagfield) >- ->update( $barcodetagsubfield => ++$newbarcode ); >+ # OK, we have the new barcode, add the entry in MARC record # FIXME -> should be using barcode plugin here. >+ $bib_record->field($barcodetagfield)->update( $barcodetagsubfield => ++$newbarcode ); > } > } > > # check for item barcode # being unique > my $exists; >- if ( >- $bib_record->subfield( >- $barcodetagfield, $barcodetagsubfield >- ) >- ) >- { >+ if ( $bib_record->subfield( $barcodetagfield, $barcodetagsubfield ) ) { > my $barcode = $bib_record->subfield( $barcodetagfield, $barcodetagsubfield ); >+ >+ if ($copy > 0){ >+ use C4::Barcodes; >+ my $barcodeobj = C4::Barcodes->new; >+ my $newbarcode = $barcodeobj->next_value($barcode); >+ $barcode = $newbarcode; >+ $bib_record->field($barcodetagfield)->update($barcodetagsubfield => $barcode); >+ } >+ > $exists = Koha::Items->find({barcode => $barcode}); > } > >@@ -387,7 +396,11 @@ if ( $op and $op eq 'serialchangestatus' ) { > AddItem2Serial( $itemhash{$item}->{serial}, > $itemnumber ); > } >+ $copy++; > } >+ >+ } # num_copies for loop >+ > else { > > #modify item >-- >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 23435
:
92100
|
92122
|
93827
| 94036