Bug 33581 - Error in web installer concerning sample holidays and patrons requiring sample libraries
Summary: Error in web installer concerning sample holidays and patrons requiring sampl...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (web-based installer) (show other bugs)
Version: unspecified
Hardware: Other Linux
: P5 - low minor
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 34337
  Show dependency treegraph
 
Reported: 2023-04-21 11:33 UTC by Anke Bruns
Modified: 2023-12-28 20:47 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small 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 33581: Disable sample holiday if libraries are not selected (1.61 KB, patch)
2023-06-07 09:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33581: Disable sample holiday if libraries are not selected (1.67 KB, patch)
2023-06-08 10:22 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33581: Add sample patrons to patch and some hints (2.15 KB, patch)
2023-06-08 10:22 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33581: Disable sample holiday if libraries are not selected (1.67 KB, patch)
2023-06-08 12:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33581: Add sample patrons to patch and some hints (2.72 KB, patch)
2023-06-08 12:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33581: Disable sample holiday if libraries are not selected (1.73 KB, patch)
2023-07-11 10:15 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 33581: Add sample patrons to patch and some hints (2.78 KB, patch)
2023-07-11 10:15 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Anke Bruns 2023-04-21 11:33:00 UTC
If sample holidays are chosen in the onboarding tool, there is an error message:

sample_libraries_holidays.yml
DBD::mysql::db do failed: Cannot add or update a child row: a foreign key constraint fails (`koha_pks`.`repeatable_holidays`, CONSTRAINT `repeatable_holidays_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE) at /usr/share/koha/lib/C4/Installer.pm line 575.

This is probably due to the fact that at that stage no branches have yet been created for the instance. It would probably with sample branches chosen but it should work also without the sample branches.
Comment 1 Katrin Fischer 2023-04-21 18:39:54 UTC
It cannot work without the sample branches as every holiday needs to be connected to a library. They cannot be added without a library present in the database.

The sample data is loaded before the onboarding process starts. 

I think the best we could probably do is maybe to lock/grey out the checkbox when the sample libraries are not selected.
Comment 2 Anke Bruns 2023-04-24 07:45:04 UTC
Thanks for the explanation.

The problem with sample branches is that there are quite a lot of them that are really cumbersome to remove later on.

I would suggest either one of the following:

- Reduce the number of sample branches to maybe one to three at most and explain in the web installer that they have to be checked for the sample holidays to function

- change the order of the process so that people can add their own branch(es) before importing the sample holidays

- just explain in the web installer that without the sample branches the sample holidays can't be imported, and give a hint how many sample branches there are so one knows what to expect.
Comment 3 Jonathan Druart 2023-06-07 09:32:57 UTC
Created attachment 152083 [details] [review]
Bug 33581: Disable sample holiday if libraries are not selected

If libraries are not selected we should not try to insert holidays, or
the installer will fail with a missing FK.

This patch simply disable and uncheck the checkbox when libraries are
not going to be inserted.
Comment 4 Katrin Fischer 2023-06-08 10:22:10 UTC
Created attachment 152142 [details] [review]
Bug 33581: Disable sample holiday if libraries are not selected

If libraries are not selected we should not try to insert holidays, or
the installer will fail with a missing FK.

This patch simply disable and uncheck the checkbox when libraries are
not going to be inserted.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Katrin Fischer 2023-06-08 10:22:13 UTC
Created attachment 152143 [details] [review]
Bug 33581: Add sample patrons to patch and some hints

* Adds sample patrons to the new dependency checking JS
* Adds a red "requires sample libraries" note to sample patrons
  and sample holidays, to make things more clear to users.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2023-06-08 10:24:01 UTC
Looks like this: https://snipboard.io/MRlWT6.jpg
Comment 7 Katrin Fischer 2023-06-08 12:50:23 UTC
Created attachment 152188 [details] [review]
Bug 33581: Disable sample holiday if libraries are not selected

If libraries are not selected we should not try to insert holidays, or
the installer will fail with a missing FK.

This patch simply disable and uncheck the checkbox when libraries are
not going to be inserted.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2023-06-08 12:50:25 UTC
Created attachment 152189 [details] [review]
Bug 33581: Add sample patrons to patch and some hints

* Adds sample patrons to the new dependency checking JS
* Adds a hind "requires sample libraries" to sample patrons
  and sample holidays.

To test:
* Build CSS (yarn build)
* Veriy the checkbox for sample patrons works like the
  sample holidays one
* Verify the hint shows up as intended

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Martin Renvoize (ashimema) 2023-07-11 10:15:33 UTC
Created attachment 153307 [details] [review]
Bug 33581: Disable sample holiday if libraries are not selected

If libraries are not selected we should not try to insert holidays, or
the installer will fail with a missing FK.

This patch simply disable and uncheck the checkbox when libraries are
not going to be inserted.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize (ashimema) 2023-07-11 10:15:36 UTC
Created attachment 153308 [details] [review]
Bug 33581: Add sample patrons to patch and some hints

* Adds sample patrons to the new dependency checking JS
* Adds a hind "requires sample libraries" to sample patrons
  and sample holidays.

To test:
* Build CSS (yarn build)
* Veriy the checkbox for sample patrons works like the
  sample holidays one
* Verify the hint shows up as intended

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Tomás Cohen Arazi (tcohen) 2023-07-12 17:31:52 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 12 Martin Renvoize (ashimema) 2023-07-18 10:08:22 UTC
Thanks for all the hard work!

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

Pushed to oldstable for 22.11.x
Comment 14 Marcel de Rooy 2023-07-21 09:29:49 UTC
I marked this report as the suspect for no longer creating sample patrons.
Bug 34337