Bug 32820 - Fix cataloguing/value_builder/stocknumberAV.pl
Summary: Fix cataloguing/value_builder/stocknumberAV.pl
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 30975
  Show dependency treegraph
 
Reported: 2023-02-03 11:43 UTC by Julian Maurice
Modified: 2023-12-28 20:42 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04,22.05.11, 21.11.19


Attachments
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl (1.56 KB, patch)
2023-02-03 11:43 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl (1.60 KB, patch)
2023-02-17 10:09 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl (1.64 KB, patch)
2023-02-18 21:43 UTC, David Nind
Details | Diff | Splinter Review
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl (1.70 KB, patch)
2023-02-24 16:11 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2023-02-03 11:43:06 UTC
This is part of the refactoring happening in bug 30975
Comment 1 Julian Maurice 2023-02-03 11:43:48 UTC
Created attachment 146078 [details] [review]
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before
Comment 2 David Nind 2023-02-09 21:31:55 UTC
This works, but similar to bug 32814 when I click on the three dots it jumps to the top of the screen.

It does this when using an authorized value term and just a numerical value.

It didn't do this before the patch was applied (and after a flush_memcached and restart_all).

How I tested
~~~~~~~~~~~~

1. Add the stocknumberAV.pl plugin to 952$i
2. Add a new authorized valued category called INVENTORY
3. Add some new authorized value, for example: TEST, TEST1
4. Adding an inventory number with a prefix from the INVENTORY authorized values:
   4.1 Enter "TEST" to an item for a record
   4.2 Click the three dots
       ==> A number should be added, for example: TEST 0000000001
   4.3 Repeat for another item using the same authorized value
       ==> This should increment, for example: TEST 0000000002
5. Adding a numerical inventory number:
   5.1 Add a numerical number without a prefix to an item for a record, for example: 98765
   5.2 Click the three dots
   ==> There should be no change (as expected)


Description of plugin
~~~~~~~~~~~~~~~~~~~~~

This plugin is based on authorised values from INVENTORY.
It is used for stocknumber computation.

If no prefix is submitted, or the prefix does contain only
numbers, it returns the inserted code (= keep the field unchanged).

If a prefix is submitted, we look for the highest stocknumber
with this prefix and return it incremented.

In this case, a stocknumber has this form (e.g. "PREFIX 0009678570"):
PREFIX containing letters, a space separator and 10 digits with leading
0s if needed.
Comment 3 Julian Maurice 2023-02-17 10:09:47 UTC
Created attachment 146757 [details] [review]
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before
Comment 4 Julian Maurice 2023-02-17 10:27:17 UTC
(In reply to David Nind from comment #2)
> This works, but similar to bug 32814 when I click on the three dots it jumps
> to the top of the screen.
Thank you for the feedback. This issue concerns a lot of these "framework plugins" patches.
The current framework plugin manager do things differently depending on the name of the first parameter: it adds "return false" at the end, which prevents the jump to the top of the page, but only when the first parameter is not "e", "ev" or "event". This won't be an issue after bug 30975 is pushed but for now we need to add event.preventDefault() at the beginning of all "click" event handlers.
All bugs have been updated
Comment 5 David Nind 2023-02-18 21:31:26 UTC
(In reply to Julian Maurice from comment #4)
> All bugs have been updated

Thanks Julian! 

More sign-offs on the way...
Comment 6 David Nind 2023-02-18 21:43:22 UTC
Created attachment 146929 [details] [review]
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Nick Clemens 2023-02-24 16:11:26 UTC
Created attachment 147351 [details] [review]
Bug 32820: Fix cataloguing/value_builder/stocknumberAV.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Tomás Cohen Arazi 2023-02-24 19:56:37 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 9 Matt Blenkinsop 2023-02-28 16:40:35 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 10 Lucas Gass 2023-03-08 13:30:00 UTC
Backported to 22.05.x for upcoming 22.05.11.
Comment 11 Arthur Suzuki 2023-03-29 12:32:41 UTC
applied to 21.11 for 21.11.19
Comment 12 wainuiwitikapark 2023-04-27 05:26:28 UTC
Not backported to 21.05.x