Bug 18361: [QA Follow-up] Resolve warning on undef values supplied
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 16 Jun 2017 05:57:14 +0000 (07:57 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 3 Aug 2017 07:41:41 +0000 (09:41 +0200)
commit9f0b5cd73cbaefdb4f46cae6f5e7f7f07607a51f
tree3b38227ced2250602cd1474014b41a331f1b8cef
parentc4eb6e260b5bdd9c9ab48caa370de10bf68b40ea
Bug 18361: [QA Follow-up] Resolve warning on undef values supplied

The following warning was raised in Letters.t:
DBIx::Class::ResultSource::_minimal_valueset_satisfying_constraint():
NULL/undef values supplied for requested unique constraint 'primary' (NULL
values in column(s): 'id'). This is almost certainly not what you wanted,
though you can set DBIC_NULLABLE_KEY_NOWARN to disable this warning.

This warning is triggered by this line in C4/Letters.pm:
    Koha::SMS::Providers->find( $member->{'sms_provider_id'} );
As you already guessed, the sms_provider_id returns undef.

Resolved in sub find by testing if there are parameters and if so, they
should not be all undefined. (In most cases there will be only one
parameter; but this report is about composite keys.)

Added a trivial test case in Objects.t too.

Test plan:
Run t/db_dependent/Koha/Object.t
Run t/db_dependent/Koha/Objects.t
Run t/db_dependent/Letters.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit e1afa469f8313144c70ae91d7efa356beb8168b8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Objects.pm
t/db_dependent/Koha/Objects.t