[Koha-bugs] [Bug 10466] New: Lists: Use "size" as names/hash keys leads to an unexpected results when using Template::Toolkit (name of a virtual method there)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jun 14 04:40:13 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10466

            Bug ID: 10466
           Summary: Lists: Use "size" as names/hash keys leads to an
                    unexpected results when using Template::Toolkit (name
                    of a virtual method there)
    Classification: Unclassified
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P5 - low
         Component: Templates
          Assignee: oleonard at myacpl.org
          Reporter: dcook at prosentient.com.au

This is an old bug that has been spotted again. This time, it's been noticed in
the Lists/Virtual Shelves...

Basically, itemsloo.size produces different results depending on the type of
data that is in the itemsloo hash (within the itemsloop array):

1) If "size" has a value, that value will be printed out.

2) If "size" is null/undef, a seemingly random number will print out. 

3) If there is no "size" key in the hash, a seemingly random number will print
out.

(N.B. In fact, this "random" number is the number of keys in the itemsloo hash.
"Size" is a virtual method in the template toolkit.
http://www.template-toolkit.org/docs/manual/VMethods.html.)

--

Currently, elsewhere in Koha (bug 6374 which covers search.pl, addbooks.pl,
opac-search.pl), we're checking to see if a "size" key exists, and if not,
we're inserting a "size" key with a value of "". 

In this case, as long as the SQL query includes the size column, there will
always be a "size" key (so scenario 3 is irrelevant). We need to check if
"size" is "defined", and if it's not (scenario 2 from above), then we change it
to a blank (e.g. "") value, so that it just prints out nothing. 

The fact that "size" does print a value is probably a bug in TT, so I don't
think this is the best long-term solution. It would probably make more sense to
rename the variable that we're passing to TT, because if TT gets "fixed" so
that "size" always operates as a method rather than fetching the value of a
hash, we are going to have to do this all over again.

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


More information about the Koha-bugs mailing list