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.