Bug 38360 - Price extraction from MungeMarcPrice should be improved
Summary: Price extraction from MungeMarcPrice should be improved
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Baptiste Wojtkowski (bwoj)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-05 15:37 UTC by Baptiste Wojtkowski (bwoj)
Modified: 2025-03-28 01:12 UTC (History)
1 user (show)

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


Attachments
Bug 38360: Cosmetics (2.38 KB, patch)
2024-11-05 16:31 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 38360: Add unit tests (1.37 KB, patch)
2024-11-05 16:31 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review
Bug 38360: Price extraction from MungeMarcPrice should be improved (2.02 KB, patch)
2024-11-05 16:31 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste Wojtkowski (bwoj) 2024-11-05 15:37:58 UTC
MungeMarcPrice's "rescue mode", tries and catch the whole possible number patterns in one regexp, which leads to very curious authorized values, and can leave some price unmatched for curious reasons.


Unmatched price that should be:
49.3 ; 555,555.3 (only 1 digit after separator)
50 (no digit)

Matched prices that should not:
,,,,,,,35 ; ,.,..,.45 ; 99,999.999,99
Comment 1 Baptiste Wojtkowski (bwoj) 2024-11-05 16:31:46 UTC
Created attachment 173990 [details] [review]
Bug 38360: Cosmetics
Comment 2 Baptiste Wojtkowski (bwoj) 2024-11-05 16:31:48 UTC
Created attachment 173991 [details] [review]
Bug 38360: Add unit tests

Add unit tests to prove case not taken in account py MungeMarcPrice
Comment 3 Baptiste Wojtkowski (bwoj) 2024-11-05 16:31:51 UTC
Created attachment 173992 [details] [review]
Bug 38360: Price extraction from MungeMarcPrice should be improved

MungeMarcPrice's "rescue mode", tries and catch the whole possible number patterns in one regexp, which leads to very curious authorized values, and can leave some price unmatched for curious reasons.

Unmatched price that should be:
49.3 ; 555,555.3 (only 1 digit after separator)
50 (no digit)

Matched prices that should not:
,,,,,,,35 ; ,.,..,.45 ; 99,999.999,99

TEST PLAN (for UNIMARC):
1 - Apply first commit, run tests (prove t/db_dependent/MungeMarcPrice.t) -> they should fail
1 - Export a MARC NOTICE in marxml with a 010d filled with 49.3
2 - On acquisition, register a new vendor
3 - Add a Basket to this vendor
4 - Add an order -> from a file -> select the exported marc notice
5 - Check the checkbox associated with this item -> there is no price
  field filled
6 - APPLY PATCH
7 - Repeat 4 & 5 -> the price is now displayed
8 - Run tests -> all tests pass