Bug 15042

Summary: Barcode <branchcode>yymm0001 does not work when receiving serials
Product: Koha Reporter: Magnus Enger <magnus>
Component: SerialsAssignee: Magnus Enger <magnus>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: chris, colin.campbell, jonathan.druart, liz, tomascohen, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Item form with id=f
Item form without id=f
Bug 15042 - Barcode hbyymmincr does not work when receiving serials
Bug 15042 - Barcode hbyymmincr does not work when receiving serials
Bug 15042 - Barcode hbyymmincr does not work when receiving serials

Description Magnus Enger 2015-10-21 08:26:38 UTC
To reproduce: 

- Set autoBarcode = <branchcode>yymm0001
- Make sure you have a serial that is set to "create an item record when receiving this serial"
- Receive an issue
- Click in the barcode field - nothing happens

Bug 11273, attachment 42372 [details] [review] changes the logic around locating the barcode field in the item table from this:

-        for (i=0 ; i<document.f.field_value.length ; i++) {
-            if (document.f.tag[i].value == '$args->{loctag}' && document.f.subfield[i].value == '$args->{locsubfield}') {

To this:

+        var form = document.getElementById('f');
+        if ( !form ) {
+            form = document.getElementById('Aform');
+        }
+        for (i=0 ; i<form.field_value.length ; i++) {
+            if (form.tag[i].value == '$args->{loctag}' && form.subfield[i].value == '$args->{locsubfield}') {

This works for the item table that adds items to a bib record: 

<form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">

but not for the item table that you get when receiving a serials issue, which is missing the id="f": 

<form method="post" name="f" action="serials-edit.pl" id="serials_edit">

Patch coming!
Comment 1 Magnus Enger 2015-10-21 09:20:22 UTC
Created attachment 43680 [details]
Item form with id=f
Comment 2 Magnus Enger 2015-10-21 09:20:48 UTC
Created attachment 43681 [details]
Item form without id=f
Comment 3 Magnus Enger 2015-10-21 09:21:48 UTC
I thought this would be as easy as adding id="f" to the item form for receiving serials, but that changes the whole look of the form. See attached screenshots.
Comment 4 Magnus Enger 2015-10-21 11:11:16 UTC
D'oh, the form already has id="serials_edit". Patch coming in a sec.
Comment 5 Magnus Enger 2015-10-21 11:17:21 UTC Comment hidden (obsolete)
Comment 6 Marc Véron 2015-10-22 08:06:09 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2015-10-22 08:36:38 UTC
Created attachment 43743 [details] [review]
Bug 15042 - Barcode hbyymmincr does not work when receiving serials

To test:
- Set autoBarcode = <branchcode>yymm0001
- Make sure you have a serial that is set to "create an item record
  when receiving this serial"
- Receive an issue
- Click in the barcode field - nothing happens
- Apply patch and reload page
- Receive an issue
- Click in the barcode field - a barcode conforming to the
  hbyymmincr setting appears

Patch works as advertised.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2015-10-22 08:37:26 UTC
Not sure it's a major one, but definitely annoying.
Comment 9 Tomás Cohen Arazi (tcohen) 2015-10-22 13:50:06 UTC
Patch pushed to master.

Thanks Magnus!
Comment 10 Chris Cormack 2015-10-27 20:07:00 UTC
Pushed to 3.20.x will be in 3.20.5
Comment 11 Liz Rea 2015-11-02 21:14:57 UTC
Pushed to 3.18.x, is in 3.18.12.