Nick Clemens <> changed:

           What    |Removed                     |Added
  Attachment #54465|0                           |1
        is obsolete|                            |
  Attachment #54466|0                           |1
        is obsolete|                            |
  Attachment #54467|0                           |1
        is obsolete|                            |
  Attachment #54468|0                           |1
        is obsolete|                            |
  Attachment #54469|0                           |1
        is obsolete|                            |

--- Comment #14 from Nick Clemens <> ---
Created attachment 56464
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
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 <>

Signed-off-by: Nick Clemens <>

You are receiving this mail because:
You are watching all bug changes.
Koha-bugs mailing list
website :
git :
bugs :

Reply via email to