[Bug 17069] New: Can't creat news patron category on the intranet
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17069 Bug ID: 17069 Summary: Can't creat news patron category on the intranet Change sponsored?: --- Product: Koha Version: 16.05 Hardware: All OS: Linux Status: NEW Severity: blocker Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: cyrille.duverne@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Hello, I get an error as soon as I try to create a new patrons category. Which is blocking since it's my primary one. Page : "/cgi-bin/koha/admin/categories.pl" Error message : "An error occurred when updating this patron category. Perhaps it already exists." Error in MySQL : [Sat Aug 06 19:53:54.455457 2016] [cgi:error] [pid 9145] [client 127.0.0.1:41044] AH01215: [Sat Aug 6 19:53:54 2016] categories.pl: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'dateofbirthrequired' at row 1 [for Statement "UPDATE `categories` SET `dateofbirthrequired` = ?, `enrolmentfee` = ?, `enrolmentperiod` = ?, `overduenoticerequired` = ?, `reservefee` = ?, `upperagelimit` = ? WHERE ( `categorycode` = ? )" with ParamValues: 0="", 1="", 2="", 3="0", 4="", 5="", 6="LIBRA"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1834.: /usr/share/koha/intranet/cgi-bin/admin/categories.pl, Looks like some mandatory values aren't passed. See a working query on the DB : INSERT INTO categories VALUES('LIBRA','Librarians','150','9999/12/31',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0',"S","-1","default"); -- 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=17069 Cyrille Duverne <cyrille.duverne@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Can't creat news patron |Can't create new patron |category on the intranet |category on the intranet -- 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=17069 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@kul.oslo.k | |ommune.no --- Comment #1 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- We can confirm this issue. Noticed that syspref setting CheckPrevCheckout needed to be set to 'softyes' or 'softno'. Then the setting 'Check for previous checkouts' turned up when creating a new patron category, and saving now succeeded. /cgi-bin/koha/admin/categories.pl seems to need an upgrade. -- 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=17069 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |veron@veron.ch --- Comment #2 from Marc Véron <veron@veron.ch> --- Confirmed. That's what I get in plack-error.log when adding a new patron category: DBD::mysql::st execute failed: Column 'checkprevcheckout' cannot be null [for Statement "INSERT INTO `categories` ( `BlockExpiredPatronOpacActions`, `category_type`, `categorycode`, `checkprevcheckout`, `dateofbirthrequired`, `default_privacy`, `description`, `enrolmentfee`, `enrolmentperiod`, `enrolmentperioddate`, `hidelostitems`, `overduenoticerequired`, `reservefee`, `upperagelimit`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="-1", 1="A", 2="B17069A", 3=undef, 4="", 5="default", 6="Bug 17069 A", 7="0.00", 8="12", 9=undef, 10="0", 11="0", 12="0.00", 13=""] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832. DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`borrower_message_preferences`, CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDAT) [for Statement "INSERT INTO borrower_message_preferences (borrower_message_preference_id, borrowernumber, categorycode, message_attribute_id, days_in_advance, wants_digest) VALUES (NULL, ?, ?, ?, ?, ?) " with ParamValues: 0=undef, 1="B17069A", 2=1, 3=undef, 4=0] at /home/marc/koha/C4/Members/Messaging.pm line 164. DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`borrower_message_preferences`, CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDAT) [for Statement "INSERT INTO borrower_message_preferences (borrower_message_preference_id, borrowernumber, categorycode, message_attribute_id, days_in_advance, wants_digest) VALUES (NULL, ?, ?, ?, ?, ?) " with ParamValues: 0=undef, 1="B17069A", 2=2, 3="0", 4=0] at /home/marc/koha/C4/Members/Messaging.pm line 164. DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`borrower_message_preferences`, CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDAT) [for Statement "INSERT INTO borrower_message_preferences (borrower_message_preference_id, borrowernumber, categorycode, message_attribute_id, days_in_advance, wants_digest) VALUES (NULL, ?, ?, ?, ?, ?) " with ParamValues: 0=undef, 1="B17069A", 2=4, 3=undef, 4=0] at /home/marc/koha/C4/Members/Messaging.pm line 164. DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`borrower_message_preferences`, CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDAT) [for Statement "INSERT INTO borrower_message_preferences (borrower_message_preference_id, borrowernumber, categorycode, message_attribute_id, days_in_advance, wants_digest) VALUES (NULL, ?, ?, ?, ?, ?) " with ParamValues: 0=undef, 1="B17069A", 2=5, 3=undef, 4=0] at /home/marc/koha/C4/Members/Messaging.pm line 164. DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`borrower_message_preferences`, CONSTRAINT `borrower_message_preferences_ibfk_3` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDAT) [for Statement "INSERT INTO borrower_message_preferences (borrower_message_preference_id, borrowernumber, categorycode, message_attribute_id, days_in_advance, wants_digest) VALUES (NULL, ?, ?, ?, ?, ?) " with ParamValues: 0=undef, 1="B17069A", 2=6, 3=undef, 4=0] at /home/marc/koha/C4/Members/Messaging.pm line 164. -- 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=17069 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- 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=17069 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 54147 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54147&action=edit Bug 17069: Koha::Patron::Category->store must default checkprevcheckout to 'inherit' Creating a new patron category raises an error "An error occurred when updating this patron category. Perhaps it already exists." DBIx::Class does not default to the value defined at the DB devel if the key checkprevcheckout has been passed to the constructor. We may need to provide a global fix for this kind of issue: if a column is defined as "not null" but has a default value, the constructor (Koha::Object->new) should not pass it to the DBIx::Class constructor (even if assuming that null means default is a terrible mysqlism). Test plan: Create a new patron category. -- 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=17069 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |6906 Version|16.05 |unspecified Assignee|koha-bugs@lists.koha-commun |jonathan.druart@bugs.koha-c |ity.org |ommunity.org CC| |jonathan.druart@bugs.koha-c | |ommunity.org Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6906 [Bug 6906] show 'Borrower has previously issued $ITEM' alert on checkout -- 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=17069 --- Comment #4 from Cyrille Duverne <cyrille.duverne@gmail.com> --- Indeed Jonathan, it's the same with other DB insertions. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17069 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54147|0 |1 is obsolete| | --- Comment #5 from Marc Véron <veron@veron.ch> --- Created attachment 54156 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54156&action=edit Bug 17069: Koha::Patron::Category->store must default checkprevcheckout to 'inherit' Creating a new patron category raises an error "An error occurred when updating this patron category. Perhaps it already exists." DBIx::Class does not default to the value defined at the DB devel if the key checkprevcheckout has been passed to the constructor. We may need to provide a global fix for this kind of issue: if a column is defined as "not null" but has a default value, the constructor (Koha::Object->new) should not pass it to the DBIx::Class constructor (even if assuming that null means default is a terrible mysqlism). Test plan: Create a new patron category. Works as expected. Signed-off-by: Marc <veron@veron.ch> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17069 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17069 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17080 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17080 [Bug 17080] Koha::Object->new should handle default values for NOT NULL columns -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17069 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17069 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54156|0 |1 is obsolete| | --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 54245 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54245&action=edit [PASSED QA] Bug 17069: Koha::Patron::Category->store must default checkprevcheckout to 'inherit' Creating a new patron category raises an error "An error occurred when updating this patron category. Perhaps it already exists." DBIx::Class does not default to the value defined at the DB devel if the key checkprevcheckout has been passed to the constructor. We may need to provide a global fix for this kind of issue: if a column is defined as "not null" but has a default value, the constructor (Koha::Object->new) should not pass it to the DBIx::Class constructor (even if assuming that null means default is a terrible mysqlism). Test plan: Create a new patron category. Works as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17069 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |kyle@bywatersolutions.com --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 16.11, thanks Jonathan! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org