Bug 34218 - XSLT parse on record directly breaks OPAC display
Summary: XSLT parse on record directly breaks OPAC display
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Thibaud Guillot (thibaud_g)
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-06 11:43 UTC by Thibaud Guillot (thibaud_g)
Modified: 2023-12-28 20:47 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.02,22.11.08
Circulation function:


Attachments
Bug 34218: Send a record copy to avoid loss of information and display problems (1.36 KB, patch)
2023-07-06 11:59 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 34218: Send a record copy to avoid loss of information and display problems (1.40 KB, patch)
2023-07-06 16:11 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 34218: Send a record copy to avoid loss of information and display problems (1.50 KB, patch)
2023-07-07 06:15 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Thibaud Guillot (thibaud_g) 2023-07-06 11:43:17 UTC
Hello All,

So I found it on the occasion of a specific problem and I don't know if there are other cases where this could happen again.

When activating the "AlternateHoldingsField" system preference, if you specify a field that is visible on the OPAC detail page and that is linked to allowed values or branches.

In fact, in the opac-detail.pl file, we call "get_marc_notes"(Koha::Biblio) and this one, to obtain the data, calls Koha::RecordProcessor->new, passing it the "ExpandCodedFields" filter, which in turn calls "GetAuthorisedValueDesc", which should retrieve the description from the code.

This call is also present when XSLT parameters are sent to the template by passing the same record. As a result, the second time the filter is called, empty or undef values are obtained.
Comment 1 Thibaud Guillot (thibaud_g) 2023-07-06 11:59:12 UTC
Created attachment 153091 [details] [review]
Bug 34218: Send a record copy to avoid loss of information and display problems

As I wrote in the bug description, I encountered this problem in a particular case,
so I'll explain it in the test plan, but it's certainly likely to be encountered in different ways.

Test plan:

1) Link authorised values with  a field on a MARC framework, like a 942a related to branches
2) Set it on a record with no items
3) Activate syspref "AlternateHoldingsField" and set it to field 942a
4) Go to OPAC View and you will see "Holdings: " without any values
5) Apply this patch
6) Do step 4) again and now it's fixed
Comment 2 Sam Lau 2023-07-06 16:11:53 UTC
Created attachment 153103 [details] [review]
Bug 34218: Send a record copy to avoid loss of information and display problems

As I wrote in the bug description, I encountered this problem in a particular case,
so I'll explain it in the test plan, but it's certainly likely to be encountered in different ways.

Test plan:

1) Link authorised values with  a field on a MARC framework, like a 942a related to branches
2) Set it on a record with no items
3) Activate syspref "AlternateHoldingsField" and set it to field 942a
4) Go to OPAC View and you will see "Holdings: " without any values
5) Apply this patch
6) Do step 4) again and now it's fixed

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 3 Marcel de Rooy 2023-07-07 06:15:46 UTC
Created attachment 153114 [details] [review]
Bug 34218: Send a record copy to avoid loss of information and display problems

As I wrote in the bug description, I encountered this problem in a particular case,
so I'll explain it in the test plan, but it's certainly likely to be encountered in different ways.

Test plan:

1) Link authorised values with  a field on a MARC framework, like a 942a related to branches
2) Set it on a record with no items
3) Activate syspref "AlternateHoldingsField" and set it to field 942a
4) Go to OPAC View and you will see "Holdings: " without any values
5) Apply this patch
6) Do step 4) again and now it's fixed

Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2023-07-07 06:17:36 UTC
Good catch Thibaud. It seems to be the only place where the record was passed in like this. In other calls I see that it uses biblio->metadata->record.
Updating severity a bit.
Comment 5 Tomás Cohen Arazi (tcohen) 2023-07-10 18:43:24 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Martin Renvoize (ashimema) 2023-07-18 09:33:44 UTC
Thanks for all the hard work!

Pushed to 23.05.x for the next release
Comment 7 Matt Blenkinsop 2023-07-18 14:07:23 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x