Bug 36277: Avoid useless warnings

As mentioned on bug 36329, this endpoint is only used with one of this
parameters:

* item_type
* collection_code

The other will be NULL both on the DB and the (deserialized) request
body. For the data from the DB, the author added `|| q{}` but missed to
do so on the incoming parameters when generates the hash key.

This generates the following warnings when using from the UI:

[2024/03/15 11:42:51] [WARN] Use of uninitialized value in sprintf at /kohadevbox/koha/Koha/REST/V1/TransferLimits.pm line 146.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 03b0f31b9e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit fa2e164f24)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2024-03-15 09:05:55 -03:00 committed by Lucas Gass
parent 667e675550
commit 6cccf8f210

View file

@ -143,7 +143,7 @@ sub batch_add {
my $dbic_params = Koha::Item::Transfer::Limits->new->attributes_from_api($params);
my %existing_limits =
map { sprintf( "%s:%s:%s:%s", $_->fromBranch, $_->toBranch, $_->itemtype, $_->ccode ) => 1 }
map { sprintf( "%s:%s:%s:%s", $_->fromBranch, $_->toBranch, $_->itemtype // q{}, $_->ccode // q{} ) => 1 }
Koha::Item::Transfer::Limits->search($dbic_params)->as_list;
my @results;