From bca5dfa0392c88bc2af4186b6e38d8cadcdce2b8 Mon Sep 17 00:00:00 2001
From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Date: Thu, 4 Jul 2024 14:23:31 +0300
Subject: [PATCH] Bug 37255: Fix handling of "All" values on waiting hold
 cancellation policy

If one creates a default waiting hold cancellation policy with
patron categories set as "All" and itemtype set as "All", Koha
breaks on 500 error. This happens because in we try to match
template policy with "All" values either in category or itemtype
with *, not undef. This patch fixes this.

To test:
1. Create a new default waiting hold cancellation policy and
set both patron category and itemtype as "All".
2. Save policy.
=> Error page for error 500 is displayed.
3. Apply this patch.
4. Reload page.
=> Page is displayed and policy listing displays new policy
as it should.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
index 960854b831c..d786284c3e9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
@@ -909,14 +909,14 @@
                                     [% IF ( waiting_hold_cancellation.defined && waiting_hold_cancellation != '' ) %]
                                         <tr>
                                             <td>
-                                                [% IF c == '*' %]
+                                                [% IF c == undef %]
                                                     <em>All</em>
                                                 [% ELSE %]
                                                     [% Categories.GetName(c) | html %]
                                                 [% END %]
                                             </td>
                                             <td>
-                                                [% IF i == '*' %]
+                                                [% IF i == undef %]
                                                     <em>All</em>
                                                 [% ELSE %]
                                                     [% ItemTypes.GetDescription(i,1) | html %]
-- 
2.39.2