[Koha-bugs] [Bug 32472] [21.11] The method Koha::Item->count is not covered by tests

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Dec 15 08:56:55 CET 2022


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

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arthur.suzuki at biblibre.com
           Severity|enhancement                 |major
            Summary|The method                  |[21.11] The method
                   |Koha::Item->count is not    |Koha::Item->count is not
                   |covered by tests            |covered by tests
            Version|master                      |21.11

--- Comment #2 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Quite interesting to see how many occurrences are really affected.
If you pass items with say $items = Koha::Items->search, you will be fine since
you passed items as a scalar to the template. So a lot of [plurals].count are
just fine.
But what about order.items.count? Generally this comes from passing order as a
scalar but the next part "items" is evaluated in list context in TT. So those
might be wrong..

A git grep like git grep -E "\w+\.\w+\.count " will give such candidates. (Note
that you could also call other methods than count..]
This gives me just a bunch for opac templates in 21.11. The ones I checked seem
to be fine: item.ratings.count comes from $issue->{ratings} so scalar context.

But quite a bit more for intranet, but most are in a specific context: club
enrollments, return claims, credit type library limits, course reserves, stock
rotation quota.
Just mentioning a few:
includes/cat-toolbar.inc:                [% ELSIF ( biblio.subscriptions.count
) %]
includes/clubs-table.inc:                    [% c.club_enrollments.count | html
%]
modules/acqui/showorder.tt:                        [% order.claims.count | html
%]
modules/cataloguing/moveitem.tt:            [% IF from_biblio.items.count == 0
&& CAN_user_editcatalogue_edit_catalogue %]modules/members/discharge.tt:    [%
IF patron.holds.count %]
etc

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


More information about the Koha-bugs mailing list