[Bug 13007] New: suggestions.budget_id should be a foreign key
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Bug ID: 13007 Summary: suggestions.budget_id should be a foreign key Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: jonathan.druart@biblibre.com QA Contact: testopia@bugs.koha-community.org -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=12601 Blocks| |5334 Depends on| |13005 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|gmcharlt@gmail.com |jonathan.druart@biblibre.co | |m Summary|suggestions.budget_id |suggestions.budgetid should |should be a foreign key |be a foreign key -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 --- Comment #1 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 31924 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=31924&action=edit Bug 13007: Add a foreign key for suggestions.budgetid The DB field suggestions.budgetid should be linked to aqbudgets.budget_id. If the fund is removed, this column should be set to NULL. Test plan: 0/ Verify it is not possible to create an suggestion not linked to a fund via the Koha interface. 1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and set "0" in the budgetid field. 2/ Execute the updatedabase script. 3/ Verify that your suggestion is unlinked to the nonexistent fund. 4/ Verify the constraint has correctly been added (show create table suggestions). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 --- Comment #2 from Jonathan Druart <jonathan.druart@biblibre.com> --- *** Bug 13005 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Bug 13007 depends on bug 13005, which changed state. Bug 13005 Summary: suggestions.budgetid should be NULL if not filled http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13005 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |RESOLVED Resolution|--- |DUPLICATE -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|13005 |12627 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #31924|0 |1 is obsolete| | --- Comment #3 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 31945 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=31945&action=edit Bug 13007: Add a foreign key for suggestions.budgetid The DB field suggestions.budgetid should be linked to aqbudgets.budget_id. If the fund is removed, this column should be set to NULL. Test plan: 0/ Verify it is not possible to create an suggestion not linked to a fund via the Koha interface. 1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and set "0" in the budgetid field. 2/ Execute the updatedabase script. 3/ Verify that your suggestion is unlinked to the nonexistent fund. 4/ Verify the constraint has correctly been added (show create table suggestions). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |13014 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Paola Rossi <paola.rossi@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |paola.rossi@cineca.it --- Comment #4 from Paola Rossi <paola.rossi@cineca.it> --- I've tried to apply the patches against master 3.17.00.029 At first I've applied the 6 patches of 12627. --------------------------------------- The patch "Bug 13007: Add a foreign key for suggestions.budgetid" needs a trivial rebase. Moreover, this wrong line of the patch 13007: + print "Upgrade to $DBversion done (Bug 13007 - Add new foreign key suggestions.budgetid\n"); should be changed in the following right one: + print "Upgrade to $DBversion done (Bug 13007 - Add new foreign key suggestions.budgetid)\n"; --------------------------------------- About the first step: 0/ Verify it is not possible to create a suggestion not linked to a fund via the Koha interface. in intranet, "any" is an option in the dropdown list on "Acquisition information" for selecting a fund to link to the suggestion. So IMO it's still easy to create suggestions not linked to a fund. So I pass the patch to "Failed QA" STATUS. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #31945|0 |1 is obsolete| | --- Comment #5 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 33241 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33241&action=edit Bug 13007: Add a foreign key for suggestions.budgetid The DB field suggestions.budgetid should be linked to aqbudgets.budget_id. If the fund is removed, this column should be set to NULL. Test plan: 1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and set "0" in the budgetid field (or a nonexistent budget id). 2/ Execute the updatedabase script. 3/ Verify that your suggestion is unlinked to the nonexistent fund. 4/ Verify the constraint has correctly been added (show create table suggestions). 5/ Check that this change does not affect the behavior on adding a suggestion (linked to a fund or not). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33241|0 |1 is obsolete| | --- Comment #6 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 33242 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33242&action=edit Bug 13007: Add a foreign key for suggestions.budgetid The DB field suggestions.budgetid should be linked to aqbudgets.budget_id. If the fund is removed, this column should be set to NULL. Test plan: 1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and set "0" in the budgetid field (or a nonexistent budget id). 2/ Execute the updatedabase script. 3/ Verify that your suggestion is unlinked to the nonexistent fund. 4/ Verify the constraint has correctly been added (show create table suggestions). 5/ Check that this change does not affect the behavior on adding a suggestion (linked to a fund or not). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #7 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Paola Rossi from comment #4)
About the first step: 0/ Verify it is not possible to create a suggestion not linked to a fund via the Koha interface.
in intranet, "any" is an option in the dropdown list on "Acquisition information" for selecting a fund to link to the suggestion. So IMO it's still easy to create suggestions not linked to a fund.
So I pass the patch to "Failed QA" STATUS.
I don't remember why I wrote that... If you don't choose a fund, the value in DB will be NULL. Which is acceptable and normal. I updated the test plan. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Paola Rossi <paola.rossi@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #8 from Paola Rossi <paola.rossi@cineca.it> --- I've applied the patch against master 3.17.00.055 The patch needed some trivial rebasing. The number of tests is not increased (error). When I tried to add a new suggestion linked to "Any" fund, koha said: Software error: DBIx::Class::ResultSet::create(): Cannot add or update a child row: a foreign key constraint fails (`koha`.`suggestions`, CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE) at /var/root-koha/.../C4/Suggestions.pm line 449 On the contrary, adding a new suggestion linked to a real fund is OK. So I pass the patch to "Failed QA" status. The "show create table suggestions" command gave: CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE ) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33242|0 |1 is obsolete| | --- Comment #9 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 33643 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33643&action=edit Bug 13007: Add a foreign key for suggestions.budgetid The DB field suggestions.budgetid should be linked to aqbudgets.budget_id. If the fund is removed, this column should be set to NULL. Test plan: 1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and set "0" in the budgetid field (or a nonexistent budget id). 2/ Execute the updatedabase script. 3/ Verify that your suggestion is unlinked to the nonexistent fund. 4/ Verify the constraint has correctly been added (show create table suggestions). 5/ Check that this change does not affect the behavior on adding a suggestion (linked to a fund or not). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 --- Comment #10 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 33644 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33644&action=edit Bug 13007: Special case budgetid == '' In this special case (the suggestion is linked to "all funds"), the budgetid value should be NULL in DB. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Paola Rossi <paola.rossi@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Paola Rossi <paola.rossi@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33643|0 |1 is obsolete| | --- Comment #11 from Paola Rossi <paola.rossi@cineca.it> --- Created attachment 33651 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33651&action=edit Bug 13007: Add a foreign key for suggestions.budgetid I've applied the patches against master 3.17.00.057 Everything is OK. So I pass the patch to "Signed Off" status. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Paola Rossi <paola.rossi@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33644|0 |1 is obsolete| | --- Comment #12 from Paola Rossi <paola.rossi@cineca.it> --- Created attachment 33653 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33653&action=edit Bug 13007: Special case budgetid == '' -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33651|0 |1 is obsolete| | Attachment #33653|0 |1 is obsolete| | --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 33807 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33807&action=edit [PASSED QA] Bug 13007: Add a foreign key for suggestions.budgetid The DB field suggestions.budgetid should be linked to aqbudgets.budget_id. If the fund is removed, this column should be set to NULL. Test plan: 1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and set "0" in the budgetid field (or a nonexistent budget id). 2/ Execute the updatedabase script. 3/ Verify that your suggestion is unlinked to the nonexistent fund. 4/ Verify the constraint has correctly been added (show create table suggestions). 5/ Check that this change does not affect the behavior on adding a suggestion (linked to a fund or not). Signed-off-by: Paola Rossi <paola.rossi@cineca.it> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 --- Comment #14 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 33808 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33808&action=edit [PASSED QA] Bug 13007: Special case budgetid == '' In this special case (the suggestion is linked to "all funds"), the budgetid value should be NULL in DB. Signed-off-by: Paola Rossi <paola.rossi@cineca.it> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works as described, passes old and new tests. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Jonathan, tried testing 13014, but this dependency no longer applies, can you please rebase? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33807|0 |1 is obsolete| | --- Comment #16 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 35601 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=35601&action=edit Bug 13007: Add a foreign key for suggestions.budgetid The DB field suggestions.budgetid should be linked to aqbudgets.budget_id. If the fund is removed, this column should be set to NULL. Test plan: 1/ Using your SQL CLI (or equivalent), create or update 1+ suggestions and set "0" in the budgetid field (or a nonexistent budget id). 2/ Execute the updatedabase script. 3/ Verify that your suggestion is unlinked to the nonexistent fund. 4/ Verify the constraint has correctly been added (show create table suggestions). 5/ Check that this change does not affect the behavior on adding a suggestion (linked to a fund or not). Signed-off-by: Paola Rossi <paola.rossi@cineca.it> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #33808|0 |1 is obsolete| | --- Comment #17 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 35602 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=35602&action=edit Bug 13007: Special case budgetid == '' In this special case (the suggestion is linked to "all funds"), the budgetid value should be NULL in DB. Signed-off-by: Paola Rossi <paola.rossi@cineca.it> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works as described, passes old and new tests. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 --- Comment #18 from Jonathan Druart <jonathan.druart@biblibre.com> --- Last patches fixed conflict with bug 13378. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |tomascohen@gmail.com --- Comment #19 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patches pushed to master. Thanks Jonathan! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |13675 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13007 Bug 13007 depends on bug 12627, which changed state. Bug 12627 Summary: SQLHelper replacement - C4::Suggestions http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12627 What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org