From e20bd6d0f0c6f7aeb333bb8fc816808f3422797a Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Fri, 27 Oct 2017 11:12:57 -0300
Subject: [PATCH] Bug 19539: Fix column index shift in cirulation rules

This patch fixes an index shift introduced by bug 18857 when it introduced
a new column.

To test:
- On the Circulation and fine rules page
- Empty the value of 'Current on-site checkouts allowed' and save
- Notice 'Unlimited' shows on the saved rule.
- Click edit
=> FAIL: the 'Unlimited' string displays instead of the empty string on the editing row.
- Apply this patch
- Re-open the circ rules page
- Click edit
=> SUCCESS: An empty string fills the 'Unlimited' fields
- Sign off :-D

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 bfec588..c1d5931 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
@@ -103,7 +103,7 @@ $(document).ready(function() {
                         // Remove potential previous input added
                         $(current_column).find("input").remove();
                         $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
-                    } else if ( i == 2 || i == 3 ) {
+                    } else if ( i == 3 || i == 4 ) {
                         // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed"
                         // The value is "Unlimited" (or an equivalent translated string)
                         // an it should be set to an empty string
-- 
2.10.2