[Koha-bugs] [Bug 7630] Warning on moremember.pl about param without key

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Jun 5 08:31:02 CEST 2012


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

--- Comment #2 from M. Tompsett <mtompset at hotmail.com> ---
Actually, the template file (moremember.tt) has an error check:
[% IF ( error ) %]

So, I wondered how does it handle undefined values or empty strings. I found my
answer:
http://my.safaribooksonline.com/book/programming/perl/0596004761/template-directives/perltt-chp-4-sect-5
"If the result of this statement is 0 or "" (the empty string), test is
considered to be false; everything else is true. Variables that have not been
assigned a value, either with DEFAULT or SET, are considered to be false (the
value of an undefined variable is an empty string)."

I was contemplating if my potential patch was overkill, or would break
templates. It would seem that it wouldn't, though perhaps a simpler solution is
better:
-- original
++ tweak
$template->param(
    detailview => 1,
    AllowRenewalLimitOverride =>
C4::Context->preference("AllowRenewalLimitOverride"),
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
    CANDELETEUSER    => $candeleteuser,
    roaddetails     => $roaddetails,
    borrowernumber  => $borrowernumber,
    othernames      => $data->{'othernames'},
    categoryname    => $data->{'description'},
    reregistration  => $reregistration,
    branch          => $branch,
    todaysdate      => C4::Dates->today(),
    totalprice      => sprintf("%.2f", $totalprice),
    totaldue        => sprintf("%.2f", $total),
    totaldue_raw    => $total,
    issueloop       => @issuedata,
    relissueloop    => @relissuedata,
        issuecount      => $issuecount,
    relissuecount   => $relissuecount,
    overdues_exist  => $overdues_exist,
    error           => $error,
-    $error          => 1,
    StaffMember     => ($category_type eq 'S'),
    is_child        => ($category_type eq 'C'),
#   reserveloop     => \@reservedata,
    dateformat      => C4::Context->preference("dateformat"),
    "dateformat_" . (C4::Context->preference("dateformat") || '') => 1,
    samebranch     => $samebranch,
    quickslip             => $quickslip,
);
++$template->param($error => 1) if $error;

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


More information about the Koha-bugs mailing list