Summary: | Set biblio.datecreated to NOW if not defined | ||
---|---|---|---|
Product: | Koha | Reporter: | Julian Maurice <julian.maurice> |
Component: | Test Suite | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | CLOSED FIXED | QA Contact: | Julian Maurice <julian.maurice> |
Severity: | normal | ||
Priority: | P5 - low | ||
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20144 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 17258 | ||
Attachments: |
Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined
Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined |
Description
Julian Maurice
2018-02-12 13:33:24 UTC
Created attachment 71466 [details] [review] Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined Fix at constructor level, this issue appears in lot of places. Fix for: Field 'datecreated' doesn't have a default value Signed-off-by: Josef Moravec <josef.moravec@gmail.com> There are other places where the default values are enforced in 'store' subroutine (Koha::Patron::Category for example). Why does this patch enforce a default value in 'new' subroutine ? (In reply to Julian Maurice from comment #2) > There are other places where the default values are enforced in 'store' > subroutine (Koha::Patron::Category for example). Why does this patch enforce > a default value in 'new' subroutine ? There is no default value defined at DB level (and cannot) so ->new will explode: DBIx::Class::Storage::DBI::_dbh_execute(): Field 'datecreated' doesn't have a default value at /home/vagrant/kohaclone/Koha/Object.pm line 124 /home/vagrant/kohaclone/Koha/Object.pm line 124 is in "store" subroutine, so it is "store" that explodes, not "new", which is why I ask: why not override "store" to set default values (like it is done in others "Koha::Object"s) ? $ perl -MKoha::Biblio -E 'Koha::Biblio->new' # No errors $ perl -MKoha::Biblio -E 'Koha::Biblio->new->store' DBD::mysql::st execute failed: Field 'datecreated' doesn't have a default value [for Statement "INSERT INTO `biblio` () VALUES ()"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836. DBIx::Class::Storage::DBI::_dbh_execute(): Field 'datecreated' doesn't have a default value at /home/koha/koha/Koha/Object.pm line 124 Created attachment 71778 [details] [review] Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined Fix at ->store level, this issue appears in lot of places. Fix for: Field 'datecreated' doesn't have a default value Yes sorry Julian, I have just re-read the commit I wrote locally yesterday to test and it did not make any senses. Created attachment 71814 [details] [review] Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined Fix at ->store level, this issue appears in lot of places. Fix for: Field 'datecreated' doesn't have a default value Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Created attachment 71818 [details] [review] Bug 20176: [sql_modes] Set biblio.datecreated to NOW if not defined Fix at ->store level, this issue appears in lot of places. Fix for: Field 'datecreated' doesn't have a default value Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Pushed to master for 18.05, thanks to everybody involved! |