Bug 27852

Summary: Link YES_NO authorized value category to 942$n in Default framework
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: MARC Bibliographic data supportAssignee: Caroline Cyr La Rose <caroline.cyr-la-rose>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: andrewfh, david, fridolin.somers, jonathan.druart, lucy.vaux-harvey
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This patch adds a Yes/No drop-down menu in the default bibliographic framework for field 942$n (MARC21). This field controls whether or not the record is hidden in the OPAC.
Version(s) released in:
21.05.00,20.11.06
Bug Depends on: 24594    
Bug Blocks: 28352    
Attachments: Bug 27852: Link YES_NO authorized value category to 942dev in Default framework
Bug 27852: Link YES_NO authorized value category to 942dev in Default framework
Bug 27852: Link YES_NO authorized value category to 942dev in Default framework

Description Caroline Cyr La Rose 2021-03-03 16:02:37 UTC
When OpacSuppression is set to Hide, a value of 1 in 942$n will hide the record from the OPAC, whereas a value of 0 or empty will show the record in the OPAC.

I think it would be logical to link the authorized value category "YES_NO" to the 942$n field in the Default framework.

I usually add the link manually for all new installations (and sometimes I forget), but I feel like it's a normal use. Maybe we could add it to master?

And also add 0 as default value, just to make sure the Yes is not selected by default.
Comment 1 Caroline Cyr La Rose 2021-03-03 19:13:50 UTC
Created attachment 117623 [details] [review]
Bug 27852: Link YES_NO authorized value category to 942dev in Default framework

This patch add the YES_NO authorised value category to
942dev in the Default framework and sets the default value
to 0 (No).

To test:
1) Load the yaml file
(I used the load_yaml.pl script after deleting the values from my database)
2) Go to cataloging and open an empty cataloging form
using the Default framework
3) Go to 942$n: the value should read No and there should
be a drop down choice between Yes and No
Comment 2 Caroline Cyr La Rose 2021-03-03 19:17:52 UTC
After rereading the test plan, I realize it's not very clear...

For step 1, I first deleted everything from the default (and ACQ) framework in marc_subfield_structure and marc_tag_structure

delete from marc_subfield_structure where frameworkcode = "";

delete from marc_subfield_structure where frameworkcode = "ACQ";

delete from marc_tag_structure where frameworkcode = "";

delete from marc_tag_structure where frameworkcode = "ACQ";

Then, I used the load_yaml script to reload the marc21_framework_DEFAULT.yml file

./misc/load_yaml.pl -f ../installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml --load
Comment 3 David Nind 2021-04-02 05:13:07 UTC
Hi Caroline.

I had a go at testing this, and thanks for the clarification for step 1!

I get this message after deleting the entries in the database and reloading the yaml file:

root@kohadevbox:koha(bz27852)$ ./misc/load_yaml.pl -f ./installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml --load
C4::Installer::load_sql returned the following errors while attempting to load ./installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml:
DBD::mysql::db do failed: Duplicate entry 'ACQ' for key 'PRIMARY' at /kohadevbox/koha/C4/Installer.pm line 572.

It does seem to work though as the$942n now has a Yes/ or No option, with No as the default.

Not sure what affect the error message will have...

David
Comment 4 Caroline Cyr La Rose 2021-04-02 16:02:24 UTC
Hi David!

Thanks for testing this!

I think I forgot to add that you have to also delete the frameworks... sorry about that

Here's the updated test plan, hopefully this time it works!

1) Apply patch

2) In the database

delete from marc_subfield_structure where frameworkcode = "";

delete from marc_subfield_structure where frameworkcode = "ACQ";

delete from marc_tag_structure where frameworkcode = "";

delete from marc_tag_structure where frameworkcode = "ACQ";

delete from biblio_framework where frameworkcode in ("", "ACQ");

2) Load the yaml file

./misc/load_yaml.pl -f installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml --load

3) In Koha, go to cataloging and open an empty cataloging form
using the Default framework

4) Go to 942$n: the value should read No and there should
be a drop down choice between Yes and No
Comment 5 David Nind 2021-04-02 18:18:40 UTC
Thanks Caroline for the updated test plan, everything is working now - sign off on the way!
Comment 6 David Nind 2021-04-02 18:19:37 UTC
Created attachment 119141 [details] [review]
Bug 27852: Link YES_NO authorized value category to 942dev in Default framework

This patch add the YES_NO authorised value category to
942dev in the Default framework and sets the default value
to 0 (No).

To test:
1) Load the yaml file
1) Load the yaml file
(I used the load_yaml.pl script after deleting the values from my database)
2) Go to cataloging and open an empty cataloging form
using the Default framework
2) Go to 942dev: the value should read No and there should
be a drop down choice between Yes and No

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Katrin Fischer 2021-04-18 10:07:51 UTC
Created attachment 119829 [details] [review]
Bug 27852: Link YES_NO authorized value category to 942dev in Default framework

This patch add the YES_NO authorised value category to
942dev in the Default framework and sets the default value
to 0 (No).

To test:
1) Load the yaml file
1) Load the yaml file
(I used the load_yaml.pl script after deleting the values from my database)
2) Go to cataloging and open an empty cataloging form
using the Default framework
2) Go to 942dev: the value should read No and there should
be a drop down choice between Yes and No

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2021-04-18 10:09:44 UTC
It's nice to see how our new .yml approach makes it easier to do these kinds of improvements. 

Note: I know that in order to have a complete change we'd need to update the sql installer files as well. But I feel that this would be forgiveable in this case as this has the character of an enhancement and can be easily fixed for other languages.
Comment 9 Jonathan Druart 2021-04-21 13:30:13 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 10 Fridolin Somers 2021-04-29 13:07:45 UTC
Small enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.06
Comment 11 Andrew Fuerste-Henry 2021-05-24 16:21:38 UTC
Enhancement, not backported to 20.05