From 3921be7f606b05e441ee0a66beedb0c3873fe007 Mon Sep 17 00:00:00 2001
From: Lari Taskula <lari.taskula@hypernova.fi>
Date: Wed, 29 Jul 2020 19:49:51 +0000
Subject: [PATCH] Bug 26814: (SMART-RULES GUI) Indent and add onsite_checkout
 to all_rules hash

SMART-RULES GUI tag means that this patch will apply before Bug 15522.

No other changes in this patch.

To test:
1. git diff --word-diff=color --ignore-all-space HEAD~1 -- koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
2. Observe only $osc has been added

Sponsored-by: The National Library of Finland
---
 .../prog/en/modules/admin/smart-rules.tt      | 394 +++++++++---------
 1 file changed, 197 insertions(+), 197 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 0052140bfd..b4dc45b48c 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
@@ -132,205 +132,205 @@
                 [% FOREACH osc IN [ undef, 0, 1 ] %]
                     [% FOREACH c IN categorycodes %]
                         [% SET c = '' UNLESS c.defined %]
-                        [% FOREACH i IN itemtypes %]
-                        [% SET i = '' UNLESS i.defined %]
-                        [% SET osc = '' UNLESS osc.defined %]
-                        [% SET note = all_rules.$c.$i.note %]
-                        [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
-                        [% SET issuelength = all_rules.$c.$i.issuelength %]
-                        [% SET daysmode = all_rules.$c.$i.daysmode %]
-                        [% SET lengthunit = all_rules.$c.$i.lengthunit %]
-                        [% SET hardduedate = all_rules.$c.$i.hardduedate %]
-                        [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
-                        [% SET fine = all_rules.$c.$i.fine %]
-                        [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
-                        [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
-                        [% SET firstremind = all_rules.$c.$i.firstremind %]
-                        [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
-                        [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
-                        [% SET finedays = all_rules.$c.$i.finedays %]
-                        [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
-                        [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
-                        [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
-                        [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
-                        [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
-                        [% SET auto_renew = all_rules.$c.$i.auto_renew %]
-                        [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
-                        [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
-                        [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
-                        [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
-                        [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
-                        [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
-                        [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
-                        [% SET article_requests = all_rules.$c.$i.article_requests %]
-                        [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
+                            [% FOREACH i IN itemtypes %]
+                            [% SET i = '' UNLESS i.defined %]
+                            [% SET osc = '' UNLESS osc.defined %]
+                            [% SET note = all_rules.$osc.$c.$i.note %]
+                            [% SET maxissueqty = all_rules.$osc.$c.$i.maxissueqty %]
+                            [% SET issuelength = all_rules.$osc.$c.$i.issuelength %]
+                            [% SET daysmode = all_rules.$osc.$c.$i.daysmode %]
+                            [% SET lengthunit = all_rules.$osc.$c.$i.lengthunit %]
+                            [% SET hardduedate = all_rules.$osc.$c.$i.hardduedate %]
+                            [% SET hardduedatecompare = all_rules.$osc.$c.$i.hardduedatecompare %]
+                            [% SET fine = all_rules.$osc.$c.$i.fine %]
+                            [% SET chargeperiod = all_rules.$osc.$c.$i.chargeperiod %]
+                            [% SET chargeperiod_charge_at = all_rules.$osc.$c.$i.chargeperiod_charge_at %]
+                            [% SET firstremind = all_rules.$osc.$c.$i.firstremind %]
+                            [% SET overduefinescap = all_rules.$osc.$c.$i.overduefinescap %]
+                            [% SET cap_fine_to_replacement_price = all_rules.$osc.$c.$i.cap_fine_to_replacement_price %]
+                            [% SET finedays = all_rules.$osc.$c.$i.finedays %]
+                            [% SET maxsuspensiondays = all_rules.$osc.$c.$i.maxsuspensiondays %]
+                            [% SET suspension_chargeperiod = all_rules.$osc.$c.$i.suspension_chargeperiod %]
+                            [% SET renewalsallowed = all_rules.$osc.$c.$i.renewalsallowed %]
+                            [% SET renewalperiod = all_rules.$osc.$c.$i.renewalperiod %]
+                            [% SET norenewalbefore = all_rules.$osc.$c.$i.norenewalbefore %]
+                            [% SET auto_renew = all_rules.$osc.$c.$i.auto_renew %]
+                            [% SET no_auto_renewal_after = all_rules.$osc.$c.$i.no_auto_renewal_after %]
+                            [% SET no_auto_renewal_after_hard_limit = all_rules.$osc.$c.$i.no_auto_renewal_after_hard_limit %]
+                            [% SET reservesallowed = all_rules.$osc.$c.$i.reservesallowed %]
+                            [% SET holds_per_day = all_rules.$osc.$c.$i.holds_per_day %]
+                            [% SET holds_per_record = all_rules.$osc.$c.$i.holds_per_record %]
+                            [% SET onshelfholds = all_rules.$osc.$c.$i.onshelfholds %]
+                            [% SET opacitemholds = all_rules.$osc.$c.$i.opacitemholds %]
+                            [% SET article_requests = all_rules.$osc.$c.$i.article_requests %]
+                            [% SET rentaldiscount = all_rules.$osc.$c.$i.rentaldiscount %]
 
-                        [% SET show_rule = note || maxissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount %]
-                        [% IF show_rule %]
-                            [% SET row_count = row_count + 1 %]
-                            <tr row_countd="row_[% row_count | html %]">
-                                    <td>[% IF ( c == undef ) %]1[% ELSE %]0[% END %]</td>
-                                    <td>
-                                        [% IF osc == undef %]
-                                            <em>All</em>
-                                        [% ELSE %]
-                                            [% IF osc == 0 %]
-                                                <em>No</em>
-                                            [% ELSIF osc == 1 %]
-                                                <em>On-site</em>
+                            [% SET show_rule = note || maxissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount %]
+                            [% IF show_rule %]
+                                [% SET row_count = row_count + 1 %]
+                                <tr row_countd="row_[% row_count | html %]">
+                                        <td>[% IF ( c == undef ) %]1[% ELSE %]0[% END %]</td>
+                                        <td>
+                                            [% IF osc == undef %]
+                                                <em>All</em>
+                                            [% ELSE %]
+                                                [% IF osc == 0 %]
+                                                    <em>No</em>
+                                                [% ELSIF osc == 1 %]
+                                                    <em>On-site</em>
+                                                [% END %]
                                             [% END %]
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                        [% IF c == undef %]
-                                            <em>All</em>
-                                        [% ELSE %]
-                                            [% Categories.GetName(c) | html %]
-                                        [% END %]
-                                    </td>
-                                    <td>[% IF ( i == undef ) %]1[% ELSE %]0[% END %]</td>
-                                    <td>
-                                        [% IF i == undef %]
-                                            <em>All</em>
-                                        [% ELSE %]
-                                            [% ItemTypes.GetDescription(i,1) | html %]
-                                        [% END %]
-                                    </td>
-                                    <td class="actions">
-                                      <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
-                                      <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;onsite_checkout=[% ct || '*' | html %]&amp;itemtype=[% i || '*' | html %]&amp;categorycode=[% c || '*' | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
-                                    </td>
-                                    <td>
-                                        [% IF note.defined && note != '' %]
-                                            <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
-                                        [% ELSE %]<span>&nbsp;</span>[% END %]
-                                    </td>
-                                    <td>
-                                        [% IF maxissueqty.defined && maxissueqty != '' %]
-                                            [% maxissueqty | html %]
-                                        [% ELSE %]
-                                            <span>Unlimited</span>
-                                        [% END %]
-                                    </td>
-                                    <td>[% issuelength | html %]</td>
-                                    <td>
-                                        [% SWITCH daysmode %]
-                                        [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Calendar</span>
-                                        [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Datedue</span>
-                                        [% CASE 'Days' %]<span title="Ignore the calendar">Days</span>
-                                        [% CASE 'Dayweek' %]<span title="Use the calendar to push the due date to the next open matching weekday for weekly loan periods, or the next open day otherwise">Dayweek</span>
-                                        [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                        [% IF ( lengthunit == 'days' ) %]
-                                            Days
-                                        [% ELSIF ( lengthunit == 'hours') %]
-                                            Hours
-                                        [% ELSE %]
-                                            Undefined
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                      [% IF ( hardduedate ) %]
-                                        [% IF ( hardduedatecompare == '-1' ) %]
-                                          before [% hardduedate | $KohaDates %]
-                                          <input type="hidden" name="hardduedatecomparebackup" value="-1" />
-                                        [% ELSIF ( hardduedatecompare == '0' ) %]
-                                          on [% hardduedate | $KohaDates %]
-                                          <input type="hidden" name="hardduedatecomparebackup" value="0" />
-                                        [% ELSIF ( hardduedatecompare == '1' ) %]
-                                          after [% hardduedate | $KohaDates %]
-                                          <input type="hidden" name="hardduedatecomparebackup" value="1" />
-                                        [% END %]
-                                      [% ELSE %]
-                                        <span>None defined</span>
-                                      [% END %]
-                                    </td>
-                                    <td>[% fine | html %]</td>
-                                    <td>[% chargeperiod | html %]</td>
-                                    <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
-                                    <td>[% firstremind | html %]</td>
-                                    <td>[% overduefinescap FILTER format("%.2f") %]</td>
-                                    <td>
-                                        [% IF cap_fine_to_replacement_price %]
-                                            <input type="checkbox" checked="checked" disabled="disabled" />
-                                        [% ELSE %]
-                                            <input type="checkbox" disabled="disabled" />
-                                        [% END %]
-                                    </td>
-                                    <td>[% finedays | html %]</td>
-                                    <td>[% maxsuspensiondays | html %]</td>
-                                    <td>[% suspension_chargeperiod | html %]</td>
-                                    <td>[% renewalsallowed | html %]</td>
-                                    <td>[% renewalperiod | html %]</td>
-                                    <td>[% norenewalbefore | html %]</td>
-                                    <td>
-                                        [% IF auto_renew %]
-                                            <span>Yes</span>
-                                        [% ELSE %]
-                                            <span>No</span>
-                                        [% END %]
-                                    </td>
-                                    <td>[% no_auto_renewal_after | html %]</td>
-                                    <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
-                                    <td>
-                                        [% IF reservesallowed.defined && reservesallowed != '' %]
-                                            [% reservesallowed | html %]
-                                        [% ELSE %]
-                                            <span>Unlimited</span>
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                        [% IF holds_per_day.defined && holds_per_day != '' %]
-                                            [% holds_per_day | html %]
-                                        [% ELSE %]
-                                            <span>Unlimited</span>
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                        [% IF holds_per_record.defined && holds_per_record != '' %]
-                                            [% holds_per_record | html %]
-                                        [% ELSE %]
-                                            <span>Unlimited</span>
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                        [% IF onshelfholds == 1 %]
-                                            <span>Yes</span>
-                                        [% ELSIF onshelfholds == 2 %]
-                                            <span>If all unavailable</span>
-                                        [% ELSE %]
-                                            <span>If any unavailable</span>
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                        [% IF opacitemholds == 'F'%]
-                                            <span>Force</span>
-                                        [% ELSIF opacitemholds == 'Y'%]
-                                            <span>Allow</span>
-                                        [% ELSE %]
-                                            <span>Don't allow</span>
-                                        [% END %]
-                                    </td>
-                                    <td>
-                                        [% IF article_requests == 'no' %]
-                                            <span>No</span>
-                                        [% ELSIF article_requests == 'yes' %]
-                                            <span>Yes</span>
-                                        [% ELSIF article_requests == 'bib_only' %]
-                                            <span>Record only</span>
-                                        [% ELSIF article_requests == 'item_only' %]
-                                            <span>Item only</span>
-                                        [% END %]
-                                    </td>
-                                    <td>[% rentaldiscount | html %]</td>
-                                    <td class="actions">
-                                      <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
-                                      <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% i || '*' | uri %]&amp;categorycode=[% c || '*' | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
-                                    </td>
-                            </tr>
-                        [% END %]
+                                        </td>
+                                        <td>
+                                            [% IF c == undef %]
+                                                <em>All</em>
+                                            [% ELSE %]
+                                                [% Categories.GetName(c) | html %]
+                                            [% END %]
+                                        </td>
+                                        <td>[% IF ( i == undef ) %]1[% ELSE %]0[% END %]</td>
+                                        <td>
+                                            [% IF i == undef %]
+                                                <em>All</em>
+                                            [% ELSE %]
+                                                [% ItemTypes.GetDescription(i,1) | html %]
+                                            [% END %]
+                                        </td>
+                                        <td class="actions">
+                                          <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
+                                          <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;onsite_checkout=[% ct || '*' | html %]&amp;itemtype=[% i || '*' | html %]&amp;categorycode=[% c || '*' | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
+                                        </td>
+                                        <td>
+                                            [% IF note.defined && note != '' %]
+                                                <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
+                                            [% ELSE %]<span>&nbsp;</span>[% END %]
+                                        </td>
+                                        <td>
+                                            [% IF maxissueqty.defined && maxissueqty != '' %]
+                                                [% maxissueqty | html %]
+                                            [% ELSE %]
+                                                <span>Unlimited</span>
+                                            [% END %]
+                                        </td>
+                                        <td>[% issuelength | html %]</td>
+                                        <td>
+                                            [% SWITCH daysmode %]
+                                            [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Calendar</span>
+                                            [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Datedue</span>
+                                            [% CASE 'Days' %]<span title="Ignore the calendar">Days</span>
+                                            [% CASE 'Dayweek' %]<span title="Use the calendar to push the due date to the next open matching weekday for weekly loan periods, or the next open day otherwise">Dayweek</span>
+                                            [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
+                                            [% END %]
+                                        </td>
+                                        <td>
+                                            [% IF ( lengthunit == 'days' ) %]
+                                                Days
+                                            [% ELSIF ( lengthunit == 'hours') %]
+                                                Hours
+                                            [% ELSE %]
+                                                Undefined
+                                            [% END %]
+                                        </td>
+                                        <td>
+                                          [% IF ( hardduedate ) %]
+                                            [% IF ( hardduedatecompare == '-1' ) %]
+                                              before [% hardduedate | $KohaDates %]
+                                              <input type="hidden" name="hardduedatecomparebackup" value="-1" />
+                                            [% ELSIF ( hardduedatecompare == '0' ) %]
+                                              on [% hardduedate | $KohaDates %]
+                                              <input type="hidden" name="hardduedatecomparebackup" value="0" />
+                                            [% ELSIF ( hardduedatecompare == '1' ) %]
+                                              after [% hardduedate | $KohaDates %]
+                                              <input type="hidden" name="hardduedatecomparebackup" value="1" />
+                                            [% END %]
+                                          [% ELSE %]
+                                            <span>None defined</span>
+                                          [% END %]
+                                        </td>
+                                        <td>[% fine | html %]</td>
+                                        <td>[% chargeperiod | html %]</td>
+                                        <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
+                                        <td>[% firstremind | html %]</td>
+                                        <td>[% overduefinescap FILTER format("%.2f") %]</td>
+                                        <td>
+                                            [% IF cap_fine_to_replacement_price %]
+                                                <input type="checkbox" checked="checked" disabled="disabled" />
+                                            [% ELSE %]
+                                                <input type="checkbox" disabled="disabled" />
+                                            [% END %]
+                                        </td>
+                                        <td>[% finedays | html %]</td>
+                                        <td>[% maxsuspensiondays | html %]</td>
+                                        <td>[% suspension_chargeperiod | html %]</td>
+                                        <td>[% renewalsallowed | html %]</td>
+                                        <td>[% renewalperiod | html %]</td>
+                                        <td>[% norenewalbefore | html %]</td>
+                                        <td>
+                                            [% IF auto_renew %]
+                                                <span>Yes</span>
+                                            [% ELSE %]
+                                                <span>No</span>
+                                            [% END %]
+                                        </td>
+                                        <td>[% no_auto_renewal_after | html %]</td>
+                                        <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
+                                        <td>
+                                            [% IF reservesallowed.defined && reservesallowed != '' %]
+                                                [% reservesallowed | html %]
+                                            [% ELSE %]
+                                                <span>Unlimited</span>
+                                            [% END %]
+                                        </td>
+                                        <td>
+                                            [% IF holds_per_day.defined && holds_per_day != '' %]
+                                                [% holds_per_day | html %]
+                                            [% ELSE %]
+                                                <span>Unlimited</span>
+                                            [% END %]
+                                        </td>
+                                        <td>
+                                            [% IF holds_per_record.defined && holds_per_record != '' %]
+                                                [% holds_per_record | html %]
+                                            [% ELSE %]
+                                                <span>Unlimited</span>
+                                            [% END %]
+                                        </td>
+                                        <td>
+                                            [% IF onshelfholds == 1 %]
+                                                <span>Yes</span>
+                                            [% ELSIF onshelfholds == 2 %]
+                                                <span>If all unavailable</span>
+                                            [% ELSE %]
+                                                <span>If any unavailable</span>
+                                            [% END %]
+                                        </td>
+                                        <td>
+                                            [% IF opacitemholds == 'F'%]
+                                                <span>Force</span>
+                                            [% ELSIF opacitemholds == 'Y'%]
+                                                <span>Allow</span>
+                                            [% ELSE %]
+                                                <span>Don't allow</span>
+                                            [% END %]
+                                        </td>
+                                        <td>
+                                            [% IF article_requests == 'no' %]
+                                                <span>No</span>
+                                            [% ELSIF article_requests == 'yes' %]
+                                                <span>Yes</span>
+                                            [% ELSIF article_requests == 'bib_only' %]
+                                                <span>Record only</span>
+                                            [% ELSIF article_requests == 'item_only' %]
+                                                <span>Item only</span>
+                                            [% END %]
+                                        </td>
+                                        <td>[% rentaldiscount | html %]</td>
+                                        <td class="actions">
+                                          <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
+                                          <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% i || '*' | uri %]&amp;categorycode=[% c || '*' | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
+                                        </td>
+                                </tr>
+                            [% END %]
                         [% END %]
                     [% END %]
                 [% END %]
-- 
2.17.1