Main Koha release repository https://koha-community.org
Find a file
Jonathan Druart 0d364dacf6 Bug 17080: Handle default values for NOT NULL columns from Koha::Object->new
Recently we face the same issue on different modules after we moved them to the
Koha namespace using Koha::Object of using DBIx::Class directly.

1/ Koha::Patron::Modification on bug 16960 comment 14 and 15
2/ Koha::Patron::Category from bug 17069
3/ C4::Members::AddMember (which does not use Koha::Object) on bug 16917

If a DB column is defined as NOT NULL and has a default value, the DBIx::Class
$rs->update_or_insert method won't use the default value if the column name
has been passed to the constructor.

We do that almost everywhere as we retrieve the data from the HTML forms without
checking/cleaning them.

There are several ways to fix that:
1/ Continue to fix them case by case (what we did for the recent issues)
2/ Try to fix them globally (existing ones and the next ones)

This patch propose a global solution to avoid future issues of this kind.

The idea is not to pass the undefined values which cannot be nullable to the
DBIx::Class constructor.

Tested all patches together. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-10-21 17:33:18 +00:00
acqui Bug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues 2016-10-21 15:35:34 +00:00
admin Bug 17318: Allow chosing fixed normalization routines 2016-10-21 16:16:34 +00:00
api/v1 Bug 17432: Remove minification 2016-10-11 06:57:38 +00:00
authorities
basket Bug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues 2016-10-21 15:35:34 +00:00
C4 Bug 15131: Add AllowItemsOnHoldCheckoutSCO to UsageStats 2016-10-21 17:27:07 +00:00
catalogue Bug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues 2016-10-21 15:35:34 +00:00
cataloguing Bug 16358: Do not redirect to the editor when deleting records 2016-10-17 23:02:26 +00:00
circ Bug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues 2016-10-21 15:35:34 +00:00
course_reserves
debian Bug 17084 debian/control updates (master) 2016-10-21 15:10:47 +00:00
docs
errors
etc Bug 17035 - Koha allows system-wide 'read' access to all Koha zebra databases, by default 2016-10-10 12:20:12 +00:00
install_misc
installer Bug 15131 - DBRev 16.06.00.035 2016-10-21 17:28:42 +00:00
Koha Bug 17080: Handle default values for NOT NULL columns from Koha::Object->new 2016-10-21 17:33:18 +00:00
koha-tmpl Bug 15131: Instroduce AllowItemsOnHoldCheckoutSCO syspref 2016-10-21 17:27:06 +00:00
labels Bug 17301: Follow-up - Standardize headings 2016-09-25 15:49:10 +00:00
members Bug 16907: Koha::Patrons - Move HandleDelBorrower to ->delete 2016-10-21 16:20:41 +00:00
misc Bug 17444: Enable exporting by time, not only date 2016-10-21 17:12:34 +00:00
offline_circ Bug 15902 [QA Followup] - Use Koha::Patrons instead of Koha::Borrowers 2016-09-27 13:53:23 +00:00
opac Bug 15131: Make SCO use the new syspref. 2016-10-21 17:27:07 +00:00
OpenILS
patron_lists
patroncards
plugins
reports Bug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues 2016-10-21 15:35:34 +00:00
reserve
reviews Bug 15839: Koha::Reviews - Remove C4::Review residue 2016-09-09 10:31:00 +00:00
rotating_collections
serials Bug 17248 - Koha::AuthorisedValues - Remove GetKohaAuthorisedValueLib 2016-10-11 13:11:55 +00:00
services
skel
sms
suggestion Bug 17252 - Koha::AuthorisedValues - Remove GetAuthorisedValueByCode 2016-10-21 15:35:21 +00:00
svc Bug 17252 - Koha::AuthorisedValues - Remove GetAuthorisedValueByCode 2016-10-21 15:35:21 +00:00
t Bug 17080: Handle default values for NOT NULL columns from Koha::Object->new 2016-10-21 17:33:18 +00:00
tags
test
tmp/modified_authorities
tools Bug 16907: Koha::Patrons - Move HandleDelBorrower to ->delete 2016-10-21 16:20:41 +00:00
virtualshelves Bug 17094: Make Koha::Virtualshelf methods return Koha::Objects-based objects 2016-10-11 13:14:46 +00:00
xt
.editorconfig
.htaccess
.mailmap
about.pl
changelanguage.pl
edithelp.pl
fix-perl-path.PL
help.pl
INSTALL
install-CPAN.pl
INSTALL.debian
INSTALL.fedora7
INSTALL.opensuse
INSTALL.ubuntu
Koha.pm Bug 15131 - DBRev 16.06.00.035 2016-10-21 17:28:42 +00:00
koha_perl_deps.pl
kohaversion.pl
LICENSE
mainpage.pl
Makefile.PL
MANIFEST.SKIP
README Bug 9440 - update Koha's LICENSE file from GPL2 to GPL3 2013-02-12 08:52:10 -05:00
README.md
README.robots
rewrite-config.PL

Koha is a free software integrated library system (ILS).

Koha is distributed under the GNU GPL version 3 or later.

Note: This is a synced mirror of the official Koha repo.

Note: Koha does not accept pull requests from git hosting sites.

Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-comminity.org.

For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch

The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook

http://koha-community.org/

Koha Logo