[Koha-bugs] [Bug 25440] Remove undef and CGI warnings and fix template variables list in circulation rules

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jun 25 16:41:30 CEST 2020


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

Martin Renvoize <martin.renvoize at ptfs-europe.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #104639|0                           |1
        is obsolete|                            |

--- Comment #22 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
Created attachment 106302
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=106302&action=edit
Bug 25440: Fix for "uninitialized value in hash" warning in smart-rules.pl

This warning emitted:

Use of uninitialized value in hash element
at /admin/smart-rules.pl line 569.

that happened because we have NULLs in SQL results for 'categorycode'
and 'itemtype' which later used as 'any' kind of category/item in the
template, so for the template it passed this way:

    $rules->{ $r->{categorycode} }->{ $r->{itemtype} }->...

but undef will stringify as "" to become a hash key ("Hashes are
unordered collections of scalar values indexed by their associated
string key" https://perldoc.perl.org/perldata.html),

that's why "undef warning". To prevent warning here is the simple fix:

    $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->...

Signed-off-by: Martin Renvoize <martin.renvoize at ptfs-europe.com>

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


More information about the Koha-bugs mailing list