Bug 32903

Summary: callnumber.pl plugin - leading 0s are not added when using a prefix
Product: Koha Reporter: David Nind <david>
Component: CatalogingAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: m.de.rooy
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32815
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description David Nind 2023-02-07 18:11:50 UTC
The description in the script for the cataloguing/value_builder/callnumber.pl says that if a prefix is used, then leading zeros are added when needed.

Example: If this call number exists for an item "PREFIX 0009678570", then adding PREFIX to another item should generate "PREFIX 0009678571". However, it generates it as "PREFIX 9678571".

To replicate (using KTD):
1. In a MARC21 instance, add the callnumber.pl plugin to 952$o for the BKS framework.
2. Edit an item for a record and add "PREFIX 0009678570" as the call number and save.
3. Edit another item for another record.
4. For the call number, enter "PREFIX" and then click on the three dots.
5. Note that it generates the call number as "PREFIX 9678571" instead of "PREFIX 0009678571" with the leading 0s.


[1] Full description from the script:

Is used for callnumber computation.

If the user send an empty string, we return a simple incremented callnumber.
If a prefix is submited, we look for the highest callnumber with this prefix, and return it incremented.
In this case, a callnumber has this form : "PREFIX 0009678570".
- PREFIX is an upercase word
- a space separator
- 10 digits, with leading 0s if needed