Bug 31482

Summary: Label creator does not call barcodedecode
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: ToolsAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, joonas.kylmala, lucas, m.de.rooy, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.07, 21.11.14
Circulation function:
Bug Depends on: 26351    
Bug Blocks:    
Attachments: Bug 31482i: Label creator does not call item_barcode_transform plugin hook
Bug 31482: Label creator does not call item_barcode_transform plugin hook
Bug 31482: Label creator does not call item_barcode_transform plugin hook
Bug 31482: Label creator does not call barcodedecode
Bug 31482: Label creator does not call barcodedecode
Bug 31482: Label creator does not call barcodedecode

Description Kyle M Hall (khall) 2022-08-29 13:26:23 UTC
The label creator can accept a list of either itemnumbers or item barcodes. In the case that the list of composed of barcodes, those barcodes should be passed though the item_barcode_transform plugin hook before the lookup is performed.
Comment 1 Kyle M Hall (khall) 2022-08-29 13:31:01 UTC
Created attachment 139945 [details] [review]
Bug 31482i: Label creator does not call item_barcode_transform plugin hook

The label creator can accept a list of either itemnumbers or item barcodes.
In the case that the list of composed of barcodes, those barcodes should be
passed though the item_barcode_transform plugin hook before the lookup is performed.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) On the "New label batch" page of the Label creator,,
   type in some valid barcodes, but prefix them with X and postfix them with Y, e.g. X123456Y
5) Submit the form
6) Note the items are added to the label batch!
Comment 2 Kyle M Hall (khall) 2022-08-29 13:32:48 UTC
Created attachment 139946 [details] [review]
Bug 31482: Label creator does not call item_barcode_transform plugin hook

The label creator can accept a list of either itemnumbers or item barcodes.
In the case that the list of composed of barcodes, those barcodes should be
passed though the item_barcode_transform plugin hook before the lookup is performed.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) On the "New label batch" page of the Label creator,,
   type in some valid barcodes, but prefix them with X and postfix them with Y, e.g. X123456Y
5) Submit the form
6) Note the items are added to the label batch!
Comment 3 Joonas Kylmälä 2022-08-30 18:17:32 UTC
Shouldn't this actually be a call to C4::Circulation::barcodedecode ?
Comment 4 Kyle M Hall (khall) 2022-08-31 09:36:58 UTC
(In reply to Joonas Kylmälä from comment #3)
> Shouldn't this actually be a call to C4::Circulation::barcodedecode ?

Good thinking! I'll post an updated patch asap.
Comment 5 Kyle M Hall (khall) 2022-08-31 09:39:13 UTC
Created attachment 139997 [details] [review]
Bug 31482: Label creator does not call item_barcode_transform plugin hook

The label creator can accept a list of either itemnumbers or item barcodes.
In the case that the list of composed of barcodes, those barcodes should be
passed though the item_barcode_transform plugin hook before the lookup is performed.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) On the "New label batch" page of the Label creator,,
   type in some valid barcodes, but prefix them with X and postfix them with Y, e.g. X123456Y
5) Submit the form
6) Note the items are added to the label batch!
Comment 6 Joonas Kylmälä 2022-08-31 15:53:24 UTC
Need to move the barcodedecode call straight into Koha::Items->find(), it's not taking a reference but rather returning the decoded barcode.
Comment 7 Joonas Kylmälä 2022-08-31 15:54:33 UTC
Please update the patch description too
Comment 8 Kyle M Hall (khall) 2022-09-01 10:51:44 UTC
Created attachment 140036 [details] [review]
Bug 31482: Label creator does not call barcodedecode

The label creator can accept a list of either itemnumbers or item barcodes.
In the case that the list of composed of barcodes, those barcodes should be
passed though barcodedecode before the lookup is performed.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) On the "New label batch" page of the Label creator,,
   type in some valid barcodes, but prefix them with X and postfix them with Y, e.g. X123456Y
5) Submit the form
6) Note the items are added to the label batch!
Comment 9 Joonas Kylmälä 2022-09-01 14:50:22 UTC
Created attachment 140051 [details] [review]
Bug 31482: Label creator does not call barcodedecode

The label creator can accept a list of either itemnumbers or item barcodes.
In the case that the list of composed of barcodes, those barcodes should be
passed though barcodedecode before the lookup is performed.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) On the "New label batch" page of the Label creator,,
   type in some valid barcodes, but prefix them with X and postfix them with Y, e.g. X123456Y
5) Submit the form
6) Note the items are added to the label batch!

JK: Remove unnecessary if $number check, barcodedecode already does this

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Comment 10 Joonas Kylmälä 2022-09-01 14:51:45 UTC
Fixed up the patch a little bit, removed "if $number" from the end as that was causing a bug with 0 barcodes and barcodedecode does it already. Signing off.
Comment 11 Marcel de Rooy 2022-09-30 09:35:19 UTC
Created attachment 141114 [details] [review]
Bug 31482: Label creator does not call barcodedecode

The label creator can accept a list of either itemnumbers or item barcodes.
In the case that the list of composed of barcodes, those barcodes should be
passed though barcodedecode before the lookup is performed.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) On the "New label batch" page of the Label creator,,
   type in some valid barcodes, but prefix them with X and postfix them with Y, e.g. X123456Y
5) Submit the form
6) Note the items are added to the label batch!

JK: Remove unnecessary if $number check, barcodedecode already does this

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Tomás Cohen Arazi (tcohen) 2022-10-03 11:50:23 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 13 Lucas Gass (lukeg) 2022-11-10 23:47:27 UTC
Backported to 22.05.x for upcoming 22.05.07 release
Comment 14 Arthur Suzuki 2022-11-15 17:13:06 UTC
applied to 21.11 for 21.11.14
Comment 15 Victor Grousset/tuxayo 2022-11-27 00:16:32 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.