Bug 27268

Summary: Move C4::Biblio::GetMarcNotes to Koha namespace
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: Architecture, internals, and plumbingAssignee: Aleisha Amohia <aleisha>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: eb, fridolin.somers, jonathan.druart, m.de.rooy, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29441
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 29652, 28734, 29871    
Attachments: Bug 27268: Move GetMarcNotes to Koha namespace
Bug 27268: Move GetMarcNotes to Koha namespace
Bug 27268: Move GetMarcNotes to Koha namespace
Bug 27268: (QA follow-up) Add Koha::Biblios to basket scripts

Description Aleisha Amohia 2020-12-18 01:20:23 UTC

    
Comment 1 Aleisha Amohia 2020-12-18 02:09:27 UTC
Created attachment 114504 [details] [review]
Bug 27268: Move GetMarcNotes to Koha namespace

This patch moves C4::Biblio::GetMarcNotes to
Koha::Biblio->get_marc_notes. This is so get_marc_notes can be
used in templates and notices.

To test:
1. Find a record that has a note (3xx for UNIMARC, 5xx for MARC21).
Confirm the notes still show as normal under the Descriptions tab.
2. Add the record to the cart.
3. View your cart and click 'more details'. Confirm notes show as
normal.
4. Log in to the OPAC. Find the record and add it to the cart
5. View the cart and click 'more details'. Confirm notes show as
normal.
6. View the record detail page and confirm the notes show as normal
under the Title Notes tab.
7. Confirm tests pass:
- t/Biblio.t
- t/db_dependent/Koha/Biblio.t

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Comment 2 David Nind 2021-02-24 07:32:28 UTC
Created attachment 117240 [details] [review]
Bug 27268: Move GetMarcNotes to Koha namespace

This patch moves C4::Biblio::GetMarcNotes to
Koha::Biblio->get_marc_notes. This is so get_marc_notes can be
used in templates and notices.

To test:
1. Find a record that has a note (3xx for UNIMARC, 5xx for MARC21).
Confirm the notes still show as normal under the Descriptions tab.
2. Add the record to the cart.
3. View your cart and click 'more details'. Confirm notes show as
normal.
4. Log in to the OPAC. Find the record and add it to the cart
5. View the cart and click 'more details'. Confirm notes show as
normal.
6. View the record detail page and confirm the notes show as normal
under the Title Notes tab.
7. Confirm tests pass:
- t/Biblio.t
- t/db_dependent/Koha/Biblio.t

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Marcel de Rooy 2021-03-05 07:52:20 UTC
With but also without this patch I have a test failure on Koha/Biblio.t:

# Subtest: AddBiblio
    1..4
    not ok 1 - expected warnings when adding too long LCCN
    #   Failed test 'expected warnings when adding too long LCCN'
    #   at t/db_dependent/Biblio.t line 61.
    # didn't find a warning
    # expected to find warning: (?^u:Data too long for column 'lccn')
    # expected to find warning: (?^u:Data too long for column 'lccn')
    not ok 2 - AddBiblio returns undef for biblionumber if something went wrong
    #   Failed test 'AddBiblio returns undef for biblionumber if something went wrong'
    #   at t/db_dependent/Biblio.t line 63.
    #          got: '1529'
    #     expected: undef
    not ok 3 - AddBiblio returns undef for biblioitemnumber if something went wrong
    #   Failed test 'AddBiblio returns undef for biblioitemnumber if something went wrong'
    #   at t/db_dependent/Biblio.t line 65.
    #          got: '1472'
    #     expected: undef
    not ok 4 - No biblio should have been added if something went wrong
    #   Failed test 'No biblio should have been added if something went wrong'
    #   at t/db_dependent/Biblio.t line 68.
    #          got: '1016'
    #     expected: '1015'
    # Looks like you failed 4 tests of 4.
not ok 2 - AddBiblio
#   Failed test 'AddBiblio'
#   at t/db_dependent/Biblio.t line 70.
Comment 4 Marcel de Rooy 2021-03-05 08:08:29 UTC
Created attachment 117785 [details] [review]
Bug 27268: Move GetMarcNotes to Koha namespace

This patch moves C4::Biblio::GetMarcNotes to
Koha::Biblio->get_marc_notes. This is so get_marc_notes can be
used in templates and notices.

To test:
1. Find a record that has a note (3xx for UNIMARC, 5xx for MARC21).
Confirm the notes still show as normal under the Descriptions tab.
2. Add the record to the cart.
3. View your cart and click 'more details'. Confirm notes show as
normal.
4. Log in to the OPAC. Find the record and add it to the cart
5. View the cart and click 'more details'. Confirm notes show as
normal.
6. View the record detail page and confirm the notes show as normal
under the Title Notes tab.
7. Confirm tests pass:
- t/Biblio.t
- t/db_dependent/Koha/Biblio.t

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2021-03-05 08:08:32 UTC
Created attachment 117786 [details] [review]
Bug 27268: (QA follow-up) Add Koha::Biblios to basket scripts

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Jonathan Druart 2021-03-09 16:19:50 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-03-19 14:15:43 UTC
Enhancement not pushed to 20.11.x
Comment 8 Jonathan Druart 2021-06-25 07:32:38 UTC
This patch introduces a bad side-effect.

From the mailing list https://lists.katipo.co.nz/pipermail/koha/2021-June/056413.html

If you have a note in 590$z that is linked with an authorised value, then the code will be displayed instead of the description.

What's happening?
Before this patch we did (the big lines):

my $record = GetMarcBiblio({ biblionumber => $biblionumber });
XSLTParse4Display($record);
my $notes = GetMarcNotes($record);

=> XSLTParse4Display *is modifying* the record (see the $field->replace_with call in transformMARCXML4XSLT) and so GetMarcNotes returned the descriptions of the notes

After this patch:
my $notes = $biblio->get_marc_notes;

=> We are no longer using the descriptions!

Aleisha, Can you please fix this?
Comment 9 Elaine Bradtke 2021-06-30 18:09:58 UTC
Here's what I posted on the list regarding our 590 fields. 

There is a subfield x Non Public Note which contains information for the staff regarding the content of the work, and a subfield z Public note that contains a generic statement governed by an authorized value.

What we see in the normal view in both the staff interface and the OPAC is the Non Public note and the code for the authorized value for the public note.
In the OPAC, it displays correctly in labeled MARC. In plain MARC it only displays the authorized value code.  See https://catalogue.efdss.org/cgi-bin/koha/opac-detail.pl?biblionumber=65305 for an example.
Comment 10 Aleisha Amohia 2021-07-12 01:04:52 UTC
Thanks both I will try and get to this later this week, has a new bug been made for the required follow-up yet or should I just attach a follow-up here?
Comment 11 Aleisha Amohia 2021-07-21 21:14:16 UTC
I have added a patch to fix this at Bug 28734