Summary: | Can't create new patron category on the intranet | ||
---|---|---|---|
Product: | Koha | Reporter: | Cyrille Duverne <cyrille.duverne> |
Component: | Patrons | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | blocker | ||
Priority: | P5 - low | CC: | benjamin.rokseth, gmcharlt, jonathan.druart, kyle.m.hall, kyle, veron |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | 6906 | ||
Bug Blocks: | 17080 | ||
Attachments: |
Bug 17069: Koha::Patron::Category->store must default checkprevcheckout to 'inherit'
Bug 17069: Koha::Patron::Category->store must default checkprevcheckout to 'inherit' [PASSED QA] Bug 17069: Koha::Patron::Category->store must default checkprevcheckout to 'inherit' |
Description
Cyrille Duverne
2016-08-06 17:59:22 UTC
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. 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. Created attachment 54147 [details] [review] 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. Indeed Jonathan, it's the same with other DB insertions. Created attachment 54156 [details] [review] 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> Created attachment 54245 [details] [review] [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> Pushed to master for 16.11, thanks Jonathan! |