[Koha-patches] [PATCH] [SIGNED-OFF] Bug 5824: Creating a circ rule for a specific library causes anomalies

Nicole C. Engard nengard at bywatersolutions.com
Fri Mar 4 00:13:26 CET 2011


From: Ian Walls <ian.walls at bywatersolutions.com>

The variable name for the current branch being edited was the same as the variable used in
cat-search.inc, which passed along the circ-rule library to circulation.pl, and then overriding
the set library from there.

This patch renames the template variable 'current_branch', so that it does not populate the 'branch'
param in cat-search.inc

Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
---
 admin/smart-rules.pl                               |    2 +-
 .../prog/en/modules/admin/smart-rules.tmpl         |   19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl
index fdd9b91..d015ec2 100755
--- a/admin/smart-rules.pl
+++ b/admin/smart-rules.pl
@@ -481,7 +481,7 @@ $template->param(categoryloop => \@category_loop,
                         rules => \@sorted_row_loop,
                         branchloop => \@branchloop,
                         humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''),
-                        branch => $branch,
+                        current_branch => $branch,
                         definedbranch => scalar(@sorted_row_loop)>0 
                         );
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl
index eaa0d43..92a44ce 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl
@@ -56,7 +56,8 @@ $(document).ready(function() {
             <!-- /TMPL_LOOP -->
             </select>
         </form>
-<!-- TMPL_IF Name="definedbranch" --><form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="<!-- TMPL_VAR NAME="branch" -->" />
+<!-- TMPL_IF Name="definedbranch" --><form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label 
+for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="<!-- TMPL_VAR NAME="current_branch" -->" />
             <select name="tobranch" id="tobranch"><!-- TMPL_LOOP NAME="branchloop" --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_LOOP --></select> <input type="submit" value="Clone" /></form><!-- /TMPL_IF --></fieldset>
 
         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
@@ -109,7 +110,7 @@ $(document).ready(function() {
 							<td><!-- TMPL_VAR NAME="reservesallowed" --></td>
 							<td><!-- TMPL_VAR NAME="rentaldiscount" --></td>
 							<td>
-								<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=<!-- TMPL_VAR NAME="itemtype" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode" -->&amp;branch=<!-- TMPL_VAR NAME="branch" -->">Delete</a>
+								<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=<!-- TMPL_VAR NAME="itemtype" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode" -->&amp;branch=<!-- TMPL_VAR NAME="current_branch" -->">Delete</a>
 							</td>
                 	</tr>
             	<!-- /TMPL_LOOP -->
@@ -139,7 +140,7 @@ $(document).ready(function() {
                     <td><input name="renewalsallowed" size="2" /></td>
                     <td><input name="reservesallowed" size="2" /></td>
 		    <td><input name="rentaldiscount" size="2" /></td>
-                    <td><input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->"/><input type="submit" value="Add" class="submit" /></td>
+                    <td><input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="current_branch" -->"/><input type="submit" value="Add" class="submit" /></td>
                 </tr>
             </table>
         </form>
@@ -149,7 +150,7 @@ $(document).ready(function() {
         <p>You can set a default maximum number of checkouts and hold policy that will be used if none is defined below for a particular item type or category.</p>
         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
             <input type="hidden" name="op" value="set-branch-defaults" />
-            <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->"/>
+            <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="current_branch" -->"/>
             <table>
                 <tr>
                     <th>&nbsp;</th>
@@ -188,7 +189,7 @@ $(document).ready(function() {
                     </td>
                     <td><input type="submit" value="Save" class="submit" /></td>
                     <td>
-                        <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=<!-- TMPL_VAR NAME="branch" -->">Unset</a>
+                        <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=<!-- TMPL_VAR NAME="current_branch" -->">Unset</a>
                     </td>
                 </tr>
             </table>
@@ -205,7 +206,7 @@ $(document).ready(function() {
         </p>
         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
             <input type="hidden" name="op" value="add-branch-cat" />
-            <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->"/>
+            <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="current_branch" -->"/>
             <table>
                 <tr>
                     <th>Patron Category</th>
@@ -231,7 +232,7 @@ $(document).ready(function() {
                             <!-- /TMPL_IF -->
                         </td>
                         <td>
-                            <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=<!-- TMPL_VAR NAME="categorycode" -->&amp;branch=<!-- TMPL_VAR NAME="branch" -->">Delete</a>
+                            <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=<!-- TMPL_VAR NAME="categorycode" -->&amp;branch=<!-- TMPL_VAR NAME="current_branch" -->">Delete</a>
                         </td>
                     </tr>
                 <!-- /TMPL_LOOP -->
@@ -274,7 +275,7 @@ $(document).ready(function() {
 
         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
             <input type="hidden" name="op" value="add-branch-item" />
-            <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->"/>
+            <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="current_branch" -->"/>
             <table>
                 <tr>
                     <th>Item Type</th>
@@ -302,7 +303,7 @@ $(document).ready(function() {
                             <!-- /TMPL_IF -->
                         </td>
                         <td>
-                            <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&amp;itemtype=<!-- TMPL_VAR NAME="itemtype" -->&amp;branch=<!-- TMPL_VAR NAME="branch" -->">Delete</a>
+                            <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&amp;itemtype=<!-- TMPL_VAR NAME="itemtype" -->&amp;branch=<!-- TMPL_VAR NAME="current_branch" -->">Delete</a>
                         </td>
                     </tr>
                 <!-- /TMPL_LOOP -->
-- 
1.7.2.3



More information about the Koha-patches mailing list