[Koha-bugs] [Bug 28871] Koha::Objects->empty doesn't work correctly in list context

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Nov 2 15:44:00 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28871

--- Comment #17 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
(In reply to Tomás Cohen Arazi from comment #16)

> You should git grep '\->empty'

Just say it :)
Koha/Acquisition/Order.pm:        return Koha::Holds->new->empty;
=> It returns a I<Koha::Holds> resultset. So that should be no longer the case
in LIST context ?
Koha/Biblio.pm:    return Koha::Items->new->empty
*     return Koha::Items->new->empty      unless
C4::Context->preference('EasyAnalyticalRecords');
* return Koha::Items->search( { itemnumber => { -in => \@itemnumbers } } );
=> Far fetched, but we might have empty list or empty result set ?
Koha/Item.pm:        return Koha::Libraries->new()->empty if
$branchitemrule->{holdallowed} eq 'from_local_hold_group' &&
!$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode}
);
Koha/Item.pm:        return Koha::Libraries->new()->empty if
$branchitemrule->{holdallowed} eq 'from_home_library' &&
$self->home_branch->branchcode ne $patron->branchcode;
=> So pickup locations will return () or result set that could be empty ?

Looks a bit inconsistent. Or do I miss something ;)


> you just chain your queries and know it will work...

Chain is scalar context. So no difference between current state and your patch?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list