Bug 38619

Summary: UNIMARC prices should also be extracted from 071d
Product: Koha Reporter: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Component: AcquisitionsAssignee: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: david, mathsabypro
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
This enhancement imports the value in 071$d to the price field when adding an item to a basket using the "From a new file" option. Before this, it only imported the value from 010$d and 345$d.
Version(s) released in:
Circulation function:
Attachments: Bug 38619: UNIMARC prices should also be extracted from 071d
Bug 38619: UNIMARC prices should also be extracted from 071d
Bug 38619: UNIMARC prices should also be extracted from 071d

Description Baptiste Wojtkowski (bwoj) 2024-12-04 11:17:46 UTC
When adding a document that does not use 010d as price document, but 071d, the price is not imported from koha since it only checks 010d and 345d.

To reproduce:
1 - Create a Koha item, make sure there is neither 010d or 345d
2 - Add a 071d and fill a price
3 - Export the item as marcxml
4 - If you do not have one: in acquisition, create a vendor, a basket associated to this vendor, and a line associated to this vendor
5 - Add a line to any open basket, select: import "from a new file" and select the exported marcxml
6 - The price in 071 is not exported
Comment 1 Baptiste Wojtkowski (bwoj) 2024-12-04 11:25:05 UTC
Created attachment 175169 [details] [review]
Bug 38619: UNIMARC prices should also be extracted from 071d

When adding a document that does not use 010d as price document, but 071d, the price is not imported from koha since it only checks 010d and 345d.

To reproduce:
1 - Create a Koha item, make sure there is neither 010d or 345d
2 - Add a 071d and fill a price
3 - Export the item as marcxml
4 - If you do not have one: in acquisition, create a vendor, a basket associated to this vendor, and a line associated to this vendor
5 - Add a line to any open basket, select: import "from a new file" and
  select the exported marcxml -> The price in 071 is not imported
6 - Apply patch
7 - Repeat 5 -> the price is properly imported
Comment 2 Mathieu Saby 2024-12-04 12:50:15 UTC
Does the function extract also price from 073$d and 072$d? It can be there too
Comment 3 Mathieu Saby 2025-03-15 16:23:56 UTC
For information, this 071 fied contains an editorial reference number that is not governed by an international standard. These numbers are generally used for sound recordings, printed music publications, videograms and electronic resources.

The UNIMARC standard indicates that a $d is possible, with the same type of information as would be found in a 010$d for an ISBN.

So it is legitimate do collect the price from this field.

Question for Baptiste : what happens if a price is also present in 010 field, and if the 2 prices are not the same ?
Comment 4 Baptiste Wojtkowski (bwoj) 2025-03-20 15:43:41 UTC
All the field are parsed in the order of the array, so it will search the 345$d, if it doesn't find, it will search the 010$d. With this patch, after searching the 010$d, it will search the 071$d
Comment 5 David Nind 2025-05-14 18:40:50 UTC
The patch no longer applies:

git bz apply 38619

Bug 38619 - UNIMARC prices should also be extracted from 071d

175169 - Bug 38619: UNIMARC prices should also be extracted from 071d

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 38619: UNIMARC prices should also be extracted from 071d
Using index info to reconstruct a base tree...
M	C4/Biblio.pm
Falling back to patching base and 3-way merge...
Auto-merging C4/Biblio.pm
CONFLICT (content): Merge conflict in C4/Biblio.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 38619: UNIMARC prices should also be extracted from 071d
Comment 6 Baptiste Wojtkowski (bwoj) 2025-05-20 09:55:45 UTC
Created attachment 182651 [details] [review]
Bug 38619: UNIMARC prices should also be extracted from 071d

When adding a document that does not use 010d as price document, but 071d, the price is not imported from koha since it only checks 010d and 345d.

To reproduce:
1 - Create a Koha item, make sure there is neither 010d or 345d
2 - Add a 071d and fill a price
3 - Export the item as marcxml
4 - If you do not have one: in acquisition, create a vendor, a basket associated to this vendor, and a line associated to this vendor
5 - Add a line to any open basket, select: import "from a new file" and
  select the exported marcxml -> The price in 071 is not imported
6 - Apply patch
7 - Repeat 5 -> the price is properly imported
Comment 7 David Nind 2025-05-21 22:36:53 UTC
Created attachment 182712 [details] [review]
Bug 38619: UNIMARC prices should also be extracted from 071d

When adding a document that does not use 010d as price document, but 071d, the price is not imported from koha since it only checks 010d and 345d.

To reproduce:
1 - Create a Koha item, make sure there is neither 010d or 345d
2 - Add a 071d and fill a price
3 - Export the item as marcxml
4 - If you do not have one: in acquisition, create a vendor, a basket associated to this vendor, and a line associated to this vendor
5 - Add a line to any open basket, select: import "from a new file" and
  select the exported marcxml -> The price in 071 is not imported
6 - Apply patch
7 - Repeat 5 -> the price is properly imported

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2025-05-21 22:46:47 UTC
I've signed off.

When testing, I noted that:

1. The 071$d value (such as 50.00) needs the decimal places.

2. If there are no decimal places, for example just 50, then the value is not imported.

This was the same behavour as 010$d and 345$d.