[Koha-bugs] [Bug 24966] Fix calls to maybe_add where method call does not return a value
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Apr 10 11:47:41 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24966
--- Comment #11 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Since you refer to a wrong message with CY, I should have started looking for
that in the first place ;)
Check CY in Constants
FID_HOLD_PATRON_ID => 'CY',
Now git grep FID_HOLD_PATRON_ID
Sip/Constants.pm: FID_HOLD_PATRON_ID
Sip/Constants.pm: FID_HOLD_PATRON_ID => 'CY',
Sip/MsgType.pm:$resp .= maybe_add( FID_HOLD_PATRON_ID,
$item->hold_patron_bcode, $server );
Ah, this call should be the one. If hold_patron_bcode returns an implicit undef
in list context (read: empty list), than we found the culprit.
Look for it:
sub hold_patron_bcode {
my $self = shift;
my $borrowernumber = (@_ ? shift: $self->hold_patron_id()) or return;
my $holder = Koha::Patrons->find( $borrowernumber );
if ($holder and $holder->cardnumber ) {
return $holder->cardnumber;
}
return;
}
And yes! The last return in list context makes $server shift to the second
position.
So how should we address that? It is used only once. We could fix the call with
scalar or explicitly return empty string.
I choose for the latter here. Preventing a second bad call in future.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list