Bug 32903 - callnumber.pl plugin - leading 0s are not added when using a prefix
Summary: callnumber.pl plugin - leading 0s are not added when using a prefix
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-07 18:11 UTC by David Nind
Modified: 2023-02-07 18:12 UTC (History)
1 user (show)

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


Attachments

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