Summary: | Update to 21.11 broken auto-generated barcode in <branchcode>0001 option | ||
---|---|---|---|
Product: | Koha | Reporter: | Henry <jmhenrique> |
Component: | Cataloging | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | blocker | ||
Priority: | P4 | CC: | andrew, egpetridis, jonathan.druart, kyle, m.de.rooy, nick, nugged |
Version: | unspecified | Keywords: | rel_21_11_candidate |
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
22.05.00,21.11.02
|
|
Circulation function: | |||
Bug Depends on: | 28445 | ||
Bug Blocks: | 37854 | ||
Attachments: |
Error in Chrome console
Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr |
Created attachment 128490 [details] [review] Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr The selector is not correct, we need to use .input_marceditor instead of name="field_value". Test plan: Set autoBarcode=<branchcode>yymm0001 Catalogue a new item, click into the barcode input Notice that without this patch you get a JS error in the console Uncaught TypeError: form.field_value is undefined Focustag_952_subfield_p_878344 Focustag_952_subfield_p_878344_handler jQuery 11 BindEventstag_952_subfield_p_878344 With this patch applied the barcode is correctly generated. QA Note: it would be way easier if all add item forms were using the new methods, it could be: let loc = document.getElementsByName('items.homebranch')[0].value; Yes, that's all! All works, thanks =D This patch needs to be integrated. Can you signoff on the patch? https://wiki.koha-community.org/wiki/Sign_off_on_patches Created attachment 128521 [details] [review] Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr The selector is not correct, we need to use .input_marceditor instead of name="field_value". Test plan: Set autoBarcode=<branchcode>yymm0001 Catalogue a new item, click into the barcode input Notice that without this patch you get a JS error in the console Uncaught TypeError: form.field_value is undefined Focustag_952_subfield_p_878344 Focustag_952_subfield_p_878344_handler jQuery 11 BindEventstag_952_subfield_p_878344 With this patch applied the barcode is correctly generated. QA Note: it would be way easier if all add item forms were using the new methods, it could be: let loc = document.getElementsByName('items.homebranch')[0].value; Yes, that's all! Signed-off-by: David Nind <david@davidnind.com> This works on additem.pl and neworderempty.pl but it fails on serials-edit.pl - I don't get the branchcode - though that page works before this patch Same behaviour here, autoBarcode set to <branchcode>yymm0001 but barcodes are not auto-generated after upgrading to 21.11. Created attachment 128727 [details] [review] Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr The selector is not correct, we must to not rely on the number. This patch fixes a regression caused by bug 28445, but also a long-standing bug. * Regression: The barcode plugin is broken is autoBarcode=<branchcode>yymm0001 There is a JS error in the console: Uncaught TypeError: form.field_value is undefined Focustag_952_subfield_p_878344 Focustag_952_subfield_p_878344_handler jQuery 11 BindEventstag_952_subfield_p_878344 * Long standing bug: If there are several item forms on the same page, the branchcode is not correctly retrieved. For instance on the "Serial edition" page there are 2 item forms, the homebranch that is used by the barcode plugin will be the one from the last form. Test plan: * regression Set autoBarcode=<branchcode>yymm0001 Catalogue a new item, click into the barcode input Notice that without this patch you get a JS error in the console * long standing bug Create a new subscription, select "Create an item record when receiving this serial". Receive a serial Open the 2 item forms ("Click to add item") Select 2 different home library and click the barcode inputs. The prefix (branchcode) should be correct with this patch applied. QA Note: it would be way easier if all add item forms were using the new methods, it could be: let loc = document.getElementsByName('items.homebranch')[0].value; Yes, that's all! (In reply to Nick Clemens from comment #5) > This works on additem.pl and neworderempty.pl but it fails on > serials-edit.pl - I don't get the branchcode - though that page works before > this patch Thanks Nick! This patch needs quick attention if we want to have it part of 21.11.01 Created attachment 128800 [details] [review] Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr The selector is not correct, we must to not rely on the number. This patch fixes a regression caused by bug 28445, but also a long-standing bug. * Regression: The barcode plugin is broken is autoBarcode=<branchcode>yymm0001 There is a JS error in the console: Uncaught TypeError: form.field_value is undefined Focustag_952_subfield_p_878344 Focustag_952_subfield_p_878344_handler jQuery 11 BindEventstag_952_subfield_p_878344 * Long standing bug: If there are several item forms on the same page, the branchcode is not correctly retrieved. For instance on the "Serial edition" page there are 2 item forms, the homebranch that is used by the barcode plugin will be the one from the last form. Test plan: * regression Set autoBarcode=<branchcode>yymm0001 Catalogue a new item, click into the barcode input Notice that without this patch you get a JS error in the console * long standing bug Create a new subscription, select "Create an item record when receiving this serial". Receive a serial Open the 2 item forms ("Click to add item") Select 2 different home library and click the barcode inputs. The prefix (branchcode) should be correct with this patch applied. QA Note: it would be way easier if all add item forms were using the new methods, it could be: let loc = document.getElementsByName('items.homebranch')[0].value; Yes, that's all! Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz> Created attachment 128860 [details] [review] Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr The selector is not correct, we must to not rely on the number. This patch fixes a regression caused by bug 28445, but also a long-standing bug. * Regression: The barcode plugin is broken is autoBarcode=<branchcode>yymm0001 There is a JS error in the console: Uncaught TypeError: form.field_value is undefined Focustag_952_subfield_p_878344 Focustag_952_subfield_p_878344_handler jQuery 11 BindEventstag_952_subfield_p_878344 * Long standing bug: If there are several item forms on the same page, the branchcode is not correctly retrieved. For instance on the "Serial edition" page there are 2 item forms, the homebranch that is used by the barcode plugin will be the one from the last form. Test plan: * regression Set autoBarcode=<branchcode>yymm0001 Catalogue a new item, click into the barcode input Notice that without this patch you get a JS error in the console * long standing bug Create a new subscription, select "Create an item record when receiving this serial". Receive a serial Open the 2 item forms ("Click to add item") Select 2 different home library and click the barcode inputs. The prefix (branchcode) should be correct with this patch applied. QA Note: it would be way easier if all add item forms were using the new methods, it could be: let loc = document.getElementsByName('items.homebranch')[0].value; Yes, that's all! Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Pushed to master for 22.05, thanks to everybody involved [U+1F984] In my installation (single active branch/library, not a lending library, less than 9999 new items per month, autoBarcode set to <branchcode>yymm0001) I've used the following SQL statement to fill missing barcodes. Should you decide to use it, please remember to first check it thourougly and change "ABC" with your own branch code. I know it will leave gaps in the barcode sequence, but I don't really mind it. UPDATE items SET barcode = CONCAT ( 'ABC' ,lpad(substring(extract(YEAR FROM datelastseen), 3, 2), 2, 0) ,lpad(extract(month FROM datelastseen), 2, 0) ,lpad(1 + itemnumber - ( SELECT T.INI FROM ( SELECT min(i.itemnumber) AS ini ,extract(YEAR FROM i.datelastseen) AS DTE_YY ,extract(month FROM i.datelastseen) AS DTE_MM FROM items i WHERE i.homebranch = 'ABC' GROUP BY extract(YEAR FROM i.datelastseen) ,extract(month FROM i.datelastseen) ) T WHERE T.dte_yy = extract(YEAR FROM datelastseen) AND T.DTE_MM = extract(MONTH FROM datelastseen) ), 4, 0) ) WHERE items.homebranch = 'ABC' AND barcode IS NULL; ...oops, thoroughly! Pushed to 21.11.x for 21.11.02 Missing dependency, not backported to 21.05.x |
Created attachment 128480 [details] Error in Chrome console Hi! In version 21.05 the automatic barcode generator for manual addition of items worked. When upgrading to 21.11, it stopped working. The chrome debug shows the following message attached To reproduce the error, clicking on the item "p - barcode" generates the error on the console, and does not show any expected results. The autoBarcode option is set to "<branchcode>yymm0001" . Other autoBarcode options work except "<branchcode>aamm0001" .