Bug 33419 - Make home library and holding library in items mandatory by default
Summary: Make home library and holding library in items mandatory by default
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Laura Escamilla
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-05 13:23 UTC by Laura Escamilla
Modified: 2023-06-13 15:52 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This will make the home library and holding library on the item form manatory for new installations. It's recommended to also manually make these changes for existing installations as Koha won't function properly if any of these fields are missing.
Version(s) released in:
23.05.00,22.11.06


Attachments
Bug 33419: Set home library mandatory by default (UNIMARC) (1013 bytes, patch)
2023-04-05 13:41 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Set home library mandatory by default (1005 bytes, patch)
2023-04-05 14:16 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Update basic_workflow.t (2.03 KB, patch)
2023-04-05 14:48 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Update basic_workflow.t (2.05 KB, patch)
2023-04-05 15:06 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Set home library and current library as mandatory by default (1.01 KB, patch)
2023-05-01 16:43 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Set home library and current library as mandatory by default (1.28 KB, patch)
2023-05-02 18:44 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Set home library and current library as mandatory by default (1.28 KB, patch)
2023-05-02 18:48 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Make home library and current library mandatory by default (4.06 KB, patch)
2023-05-02 18:58 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33419: Make home library and current library mandatory by default (5.55 KB, patch)
2023-05-02 22:23 UTC, David Nind
Details | Diff | Splinter Review
Bug 33419: Make home library and current library mandatory by default (5.61 KB, patch)
2023-05-02 22:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33419: (QA follow-up) Remove changes to basic_workflow.t (2.41 KB, patch)
2023-05-02 22:50 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Laura Escamilla 2023-04-05 13:23:03 UTC
Items without a home branch can cause errors in Koha. On the bib page, items appear without the "edit" drop-down or the selection check box. On a bulk delete page, items without a home branch create a red error that says "Cannot delete".

Making the home branch value mandatory can help avoid these issues.
Comment 1 Laura Escamilla 2023-04-05 13:41:23 UTC
Created attachment 149211 [details] [review]
Bug 33419: Set home library mandatory by default (UNIMARC)
Comment 2 Laura Escamilla 2023-04-05 14:16:04 UTC
Created attachment 149213 [details] [review]
Bug 33419: Set home library mandatory by default
Comment 3 Laura Escamilla 2023-04-05 14:48:00 UTC
Created attachment 149214 [details] [review]
Bug 33419: Update basic_workflow.t
Comment 4 Laura Escamilla 2023-04-05 15:06:32 UTC
Created attachment 149218 [details] [review]
Bug 33419: Update basic_workflow.t
Comment 5 Laura Escamilla 2023-04-12 12:35:22 UTC
Test plan to be used with KTD (Koha Testing Docker):

1. Reset KTD so that the web installer is used to setup Koha
2.  Setup 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 is 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 is now mandatory.

How to setup the web installer
~~~~~~~~~~~~~~~~~~~~~~~

1. Access the database server[1]: 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 (may not be required, but just to be safe): flush_memcached + 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
Comment 6 Katrin Fischer 2023-04-12 20:14:52 UTC
Hi Laura,

I fully agree with this change. Some small things:

1) Please take a look at your dev environment configuration, you probably missed setting the variables in .env. The patches were written by:
From: John Doe <you@example.com>

2) Should we not do the same for holding library?

... I can't finish here right now because I have some trouble with Selenium tonight.
Comment 7 Laura Escamilla 2023-04-13 12:52:00 UTC
Thank you for taking the time to look at this! You're right, I do need to make some changes to my Dev environment config. I'll work on that and rebase the patches. 

We should do the same for the holding library. Do you suggest that we include this in the same bug or open a new bug for this?

(In reply to Katrin Fischer from comment #6)
> Hi Laura,
> 
> I fully agree with this change. Some small things:
> 
> 1) Please take a look at your dev environment configuration, you probably
> missed setting the variables in .env. The patches were written by:
> From: John Doe <you@example.com>
> 
> 2) Should we not do the same for holding library?
> 
> ... I can't finish here right now because I have some trouble with Selenium
> tonight.
Comment 8 Katrin Fischer 2023-04-13 12:58:26 UTC
I think combining both here would make sense. We can also write up some nice release notes to highlight the change in one place then.
Comment 9 Katrin Fischer 2023-04-23 12:58:35 UTC
Hi Laura, I'd love to see this in 23.05 - please let me know if you need any help or won't have time to continue. We can figure something out.
Comment 10 Laura Escamilla 2023-05-01 11:50:19 UTC
(In reply to Katrin Fischer from comment #9)
> Hi Laura, I'd love to see this in 23.05 - please let me know if you need any
> help or won't have time to continue. We can figure something out.

Hi Katrin! I was out recently for parental leave, I will get back to working on this asap!
Comment 11 Laura Escamilla 2023-05-01 16:43:51 UTC Comment hidden (obsolete)
Comment 12 Katrin Fischer 2023-05-01 22:16:14 UTC
Hi Laura, 

glad to have you back and congratulations :)

Leaving another note for later:
I was wondering if we should also update existing ones with a database update. So I checked what we did for itype (see bug 25449). We didn't do a database update there, so answering my own question: I think w don't need one here either.
Comment 13 Laura Escamilla 2023-05-02 18:44:32 UTC
Created attachment 150530 [details] [review]
Bug 33419: Set home library and current library as mandatory by default

Test plan to be used with KTD (Koha Testing Docker):

1. Reset KTD so that the web installer is used to setup Koha
2.  Setup 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.

How to setup the web installer
~~~~~~~~~~~~~~~~~~~~

1. Access the database server[1]: 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 (may not be required, but just to be safe): flush_memcached + 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
Comment 14 Laura Escamilla 2023-05-02 18:48:24 UTC
Created attachment 150531 [details] [review]
Bug 33419: Set home library and current library as mandatory by default
Comment 15 Laura Escamilla 2023-05-02 18:58:38 UTC
Created attachment 150532 [details] [review]
Bug 33419: Make home library and current library mandatory by default
Comment 16 Laura Escamilla 2023-05-02 18:59:49 UTC
Test plan to be used with KTD (Koha Testing Docker):

1. Reset KTD so that the web installer is used to setup Koha
2.  Setup 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.

How to setup the web installer
~~~~~~~~~~~~~~~~~~~~~~~

1. Access the database server[1]: 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 (may not be required, but just to be safe): flush_memcached + 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
Comment 17 Katrin Fischer 2023-05-02 22:09:33 UTC
Hi Laura, 2 small problems:


1) UNIMARC is missing the change for holdingbranch.

+++ 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

2) Patch was not authored by you :)

From 56de1c94a44702135407c30d318c896b50fd1fcb Mon Sep 17 00:00:00 2001
From: John Doe <you@example.com>
Date: Tue, 2 May 2023 18:35:23 +0000
Subject: [PATCH] Bug 33419: Make home library and current library mandatory by
 default

Have a look at git commit --amend --reset-author (when you have fixed the config) or git commit --amend --author if you just want to rewrite the line.
Comment 18 David Nind 2023-05-02 22:23:29 UTC
Created attachment 150553 [details] [review]
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 <david@davidnind.com>
Comment 19 David Nind 2023-05-02 22:26:06 UTC
Hi Laura.

I have signed off, and also had a go at amending the commit message to include a description and the test plan (including adding your name as the author). (See https://wiki.koha-community.org/wiki/Commit_messages)

Feel free to amend it!

David
Comment 20 Katrin Fischer 2023-05-02 22:36:18 UTC
I had another look - the note about UNIMARC is invalid - holdingbranch  already is mandatory without this patch.

But now I get:

 FAIL	t/db_dependent/selenium/basic_workflow.t
   FAIL	  valid
		syntax error
		Missing right curly or square bracket
		t/db_dependent/selenium/basic_workflow.t had compilation errors.
Comment 21 Katrin Fischer 2023-05-02 22:50:29 UTC
Created attachment 150555 [details] [review]
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 <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 22 Katrin Fischer 2023-05-02 22:50:31 UTC
Created attachment 150556 [details] [review]
Bug 33419: (QA follow-up) Remove changes to basic_workflow.t

These are not needed: 942 and 200 have no subfields for
homebranch and holdingbranch.

The tests pass without these changes.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 23 Tomás Cohen Arazi 2023-05-05 13:15:33 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 24 Martin Renvoize 2023-05-12 14:42:48 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release
Comment 25 Lucas Gass 2023-06-13 15:52:25 UTC
I don't think I want to backport this behavior change at this point in the 22.05.x lifecycle. No backport unless requested.