[Bug 41246] New: Deleting patron categories can leave orphaned rules in the overduerules table
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Bug ID: 41246 Summary: Deleting patron categories can leave orphaned rules in the overduerules table Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com To recreate: 1. Add or have a patron category. 2. Go to Tools > Overdue notice/status triggers 3. Set some rules for that category. 4. Delete the patron category 5. Now do "select distinct categorycode from overduerules;" 6. The rule remains with a non-existent categorycode -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #1 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Just notices this is also true of branches. If I make a rule for a specific branch and then deleted the branch, the overduerule remains. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Deleting patron categories |Deleting patron categories |can leave orphaned rules in |or libraries can leave |the overduerules table |orphaned rules in the | |overduerules table -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #2 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 189564 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189564&action=edit Bug 41246: Add foreign key constraints to overduerules table and cascade on delete To test: 0. APPLY PATCH, updatedatabase, restart_all 1. Add or have a patron category. 2. Go to Tools > Overdue notice/status triggers 3. Set some rules for that category. 4. Delete the patron category 5. Now do "select distinct categorycode from overduerules;" 6. All rules should be gone. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |lucas@bywatersolutions.com |ity.org | Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189564|0 |1 is obsolete| | --- Comment #3 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 189565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189565&action=edit Bug 41246: Add foreign key constraints to overduerules table and cascade on delete To test: 0. APPLY PATCH, updatedatabase, restart_all 1. Add or have a patron category. 2. Go to Tools > Overdue notice/status triggers 3. Set some rules for that category. 4. Delete the patron category 5. Now do "select distinct categorycode from overduerules;" 6. All rules should be gone. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #4 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 189566 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189566&action=edit Bug 41246: DBIC changes [DO NOT PUSH] -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #5 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- It's worth noting explicitly that these orphaned rules cause the overdues cron to fail and not generate notices for anyone. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Roman Dolny <roman.dolny@jezuici.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |roman.dolny@jezuici.pl --- Comment #6 from Roman Dolny <roman.dolny@jezuici.pl> --- Can not confirm p. 3, error when saving changes: Error trace CGI::Compile::ROOT::kohadevbox_koha_tools_overduerules_2epl::overduerules_2epl(): DBI Exception: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`overduerules`, CONSTRAINT `overduerules_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE) at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #7 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- (In reply to Roman Dolny from comment #6)
Can not confirm p. 3, error when saving changes:
Error trace CGI::Compile::ROOT::kohadevbox_koha_tools_overduerules_2epl:: overduerules_2epl(): DBI Exception: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`overduerules`, CONSTRAINT `overduerules_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE) at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
Roman, I cannot recreate this. Are you updating the database after applying the patchset? Are you taking the schema patch when you test? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #8 from Roman Dolny <roman.dolny@jezuici.pl> --- Lucas, I did test once again, step by step, and got error. Error appears when setting rule with no specific library selected in "Select a library" dropdown ("Default" is selected). To recreate: 1. Go to Tools > Overdue notice/status triggers 2. Select "Default" in "Select a library" dropdown. 3. Set rule for any category. It works. 4. APPLY PATCH, updatedatabase, restart_all. 5. Try 1-3. It doesn't work, error is generated. Isn't it from empty library/branch parameter (when "Default")? After adding foreign key constraints to overduerules table "branchcode" could be only unique key from branches? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Christopher Brannon <cbrannon@cdalibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |cbrannon@cdalibrary.org Severity|normal |critical --- Comment #9 from Christopher Brannon <cbrannon@cdalibrary.org> --- Bumping this to critical. This is something I have been beating my head against a wall with trying to get something to work. The UI does not reveal these orphaned rules. It breaks functionality and is hidden from those of us adjusting things. Thank you Lucas for finding this and working on it. ++++++1 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189565|0 |1 is obsolete| | Attachment #189566|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #10 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 200030 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200030&action=edit Bug 41246: Add foreign key constraints to overduerules table and cascade on delete To test: 0. APPLY PATCH, updatedatabase, restart_all 1. Add or have a patron category. 2. Go to Tools > Overdue notice/status triggers 3. Set some rules for that category. 4. Delete the patron category 5. Now do "select distinct categorycode from overduerules;" 6. All rules should be gone. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #11 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 200031 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200031&action=edit Bug 41246: DBIC changes [DO NOT PUSH] Patch from commit 262c5ed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 --- Comment #12 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- New patches attached, resetting to 'Needs sign off' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |david@davidnind.com --- Comment #13 from David Nind <david@davidnind.com> --- (In reply to Lucas Gass (lukeg) from comment #12)
New patches attached, resetting to 'Needs sign off'
Getting this error when attempting to add an overdue notice/status trigger: CGI::Compile::ROOT::kohadevbox_koha_tools_overduerules_2epl::overduerules_2epl(): DBI Exception: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`overduerules`, CONSTRAINT `overduerules_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE) at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 I ran dbic (not sure if I needed to or not), restarted everything, and so on. Adding a trigger worked before the patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |normal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41246 AspenCat Team <aspencatteam@clicweb.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aspencatteam@clicweb.org -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org