Bug 15042 - Barcode <branchcode>yymm0001 does not work when receiving serials
Summary: Barcode <branchcode>yymm0001 does not work when receiving serials
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Magnus Enger
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-21 08:26 UTC by Magnus Enger
Modified: 2016-06-21 21:38 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Item form with id=f (38.60 KB, image/png)
2015-10-21 09:20 UTC, Magnus Enger
Details
Item form without id=f (44.96 KB, image/png)
2015-10-21 09:20 UTC, Magnus Enger
Details
Bug 15042 - Barcode hbyymmincr does not work when receiving serials (1.16 KB, patch)
2015-10-21 11:17 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 15042 - Barcode hbyymmincr does not work when receiving serials (1.32 KB, patch)
2015-10-22 08:06 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 15042 - Barcode hbyymmincr does not work when receiving serials (1.39 KB, patch)
2015-10-22 08:36 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 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.