From a6caabfd2b0e2d5ad7c0b55a6273d62ea30807cb Mon Sep 17 00:00:00 2001 From: Laura Escamilla Date: Tue, 2 May 2023 18:35:23 +0000 Subject: [PATCH] Bug 33419: Make home library and current library mandatory by default Items without a home and current library can cause errors in Koha. On the bibliographic page, items appear without the "edit" drop-down or the selection check box. On a bulk delete page, items without a home library create a red error that says "Cannot delete". Making the home and current library values mandatory helps avoid these issues. Test plan (using koha-testing-docker (KTD)): 1. Reset KTD so that the web installer is used to setup Koha.[1] 2. Setup Koha using the web installer -> When setting up the default settings, don't add any of the optional data. 3. Once setup and logged in, check the two frameworks (default and ACQ) and note that $952$a and $952$b are not mandatory. 4. Apply the patch. 5. Repeat steps 1-2. 6. Once setup and logged in, check the two frameworks (default and ACQ) and note that $952$a and $952$b are now mandatory. [1] How to access the web installer to setup Koha in KTD: 1. Access the database server: mysql -uroot -ppassword -hkoha-db-1 2. Drop the koha_kohadev database: drop database koha_kohadev; 3. Create the database: create database koha_kohadev; 4. Add privileges (for a real installation this would be limited): grant all on koha_kohadev.* to koha_kohadev; 5. Restart everything (there may be some errors listed): flush_memcached and then restart_all 6. Access the web installer: go to 127.0.0.1:8081 7. Use the database user name and password: get from /etc/koha/sites/kohadev/koha-conf.xml (default: koha_kohadev, password) 8. Continue through the installation process. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../marc21/mandatory/marc21_framework_DEFAULT.yml | 4 ++-- .../unimarc/mandatory/unimarc_framework_DEFAULT.yml | 2 +- t/db_dependent/selenium/basic_workflow.t | 13 +++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml index 84e1d6b0c6..c1ebf63639 100644 --- a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml +++ b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml @@ -549,7 +549,7 @@ tables: liblibrarian: "Home library" libopac: "Home library" repeatable: 0 - mandatory: 0 + mandatory: 1 kohafield: items.homebranch tab: 10 authorised_value: branches @@ -567,7 +567,7 @@ tables: liblibrarian: "Current library" libopac: "Current library" repeatable: 0 - mandatory: 0 + mandatory: 1 kohafield: items.holdingbranch tab: 10 authorised_value: branches diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml index 462c2eecfc..20a1eb4c68 100644 --- a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml +++ b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.yml @@ -849,7 +849,7 @@ tables: liblibrarian: "Home library" libopac: "Home library" repeatable: 0 - mandatory: 0 + mandatory: 1 kohafield: items.homebranch tab: 10 authorised_value: branches diff --git a/t/db_dependent/selenium/basic_workflow.t b/t/db_dependent/selenium/basic_workflow.t index fc6ab44d4f..a4a05f7775 100755 --- a/t/db_dependent/selenium/basic_workflow.t +++ b/t/db_dependent/selenium/basic_workflow.t @@ -132,6 +132,10 @@ SKIP: { my $itemtype = $sample_data->{itemtype}; + my $homelibrary = $sample_data->{homelibrary}; + + my $currentlibrary = $sample_data->{currentlibrary}; + my @biblionumbers; for my $i ( 1 .. $number_of_biblios_to_insert ) { my $biblio = MARC::Record->new(); @@ -141,12 +145,16 @@ SKIP: { MARC::Field->new('200', ' ', ' ', a => 'test biblio '.$i), MARC::Field->new('200', ' ', ' ', f => 'test author '.$i), MARC::Field->new('200', ' ', ' ', b => $itemtype->{itemtype}), + MARC::Field->new('200', ' ', ' ', c => $homelibrary->{homelibrary}), + MARC::Field->new('200', ' ', ' ', d => $currentlibrary->{currentlibrary}), ); } else { $biblio->append_fields( MARC::Field->new('245', ' ', ' ', a => 'test biblio '.$i), MARC::Field->new('100', ' ', ' ', a => 'test author '.$i), MARC::Field->new('942', ' ', ' ', c => $itemtype->{itemtype}), + MARC::Field->new('942', ' ', ' ', b => $homelibrary->{homelibrary}), + MARC::Field->new('942', ' ', ' ', d => $currentlibrary->{currentlibrary}), ); } my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); @@ -211,6 +219,11 @@ SKIP: { ) { next; # auto-filled } + elsif ( + $id =~ m|^tag_952_subfield_a| # homelibrary + ) { + elsif ( =~ m|^tag_952_subfield_b| # currentlibrary + ) { elsif ( $id =~ m|^tag_952_subfield_d| # dateaccessioned ) { -- 2.39.5