Ergonomy improvement in smart rule management
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / smart-rules.tmpl
index 4bc47cb..6cba8f3 100644 (file)
@@ -2,6 +2,9 @@
 <title>Koha &rsaquo; Administration &rsaquo; Issuing Rules</title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
+<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.uitablefilter.js"></script>
+<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.js"></script>
+<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/lib/jquery/plugins/ui.tabs.css" />
 <script type="text/javascript">
 //<![CDATA[
 $(document).ready(function() {
@@ -9,6 +12,45 @@ $(document).ready(function() {
         $('#branch').change(function() {
                 $('#selectlibrary').submit();
         });
+        $('#filter').keyup(function() {
+                $.uiTableFilter( $('#smartrules'), this.value );
+        });
+        $('#nofilter').click(function() {
+            $('.issues').show();
+            $('.fines').show();
+            $('.reserves').show();
+            $(this).parent().attr('class','ui-tabs-selected');
+            $('#issuesfilter').parent().attr('class',null);
+            $('#finesfilter').parent().attr('class',null);
+            $('#reservesfilter').parent().attr('class',null);
+        });
+        $('#issuesfilter').click(function() {
+            $('.issues').show();
+            $('.fines').hide();
+            $('.reserves').hide();
+            $(this).parent().attr('class','ui-tabs-selected');
+            $('#nofilter').parent().attr('class',null);
+            $('#finesfilter').parent().attr('class',null);
+            $('#reservesfilter').parent().attr('class',null);
+        });
+        $('#finesfilter').click(function() {
+            $('.issues').hide();
+            $('.fines').show();
+            $('.reserves').hide();
+            $(this).parent().attr('class','ui-tabs-selected');
+            $('#issuesfilter').parent().attr('class',null);
+            $('#nofilter').parent().attr('class',null);
+            $('#reservesfilter').parent().attr('class',null);
+        });
+        $('#reservesfilter').click(function() {
+            $('.issues').hide();
+            $('.fines').hide();
+            $('.reserves').show();
+            $(this).parent().attr('class','ui-tabs-selected');
+            $('#issuesfilter').parent().attr('class',null);
+            $('#finesfilter').parent().attr('class',null);
+            $('#nofilter').parent().attr('class',null);
+        });
 });
 //]]>
 </script>
@@ -18,7 +60,7 @@ $(document).ready(function() {
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;  Issuing Rules</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Issuing Rules</div>
 
 <div id="doc3" class="yui-t1">
 
@@ -35,85 +77,314 @@ $(document).ready(function() {
     <div class="help">
         <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
         <ul>
-            <li>same branch, same borrower type, same item type</li>
-            <li>same branch, same borrower type, default item type</li>
-            <li>same branch, default borrower type, same item type</li>
-            <li>default branch, same borrower type, same item type</li>
-            <li>anything else</li>
+            <li>same library, same patron type, same item type</li>
+            <li>same library, same patron type, default item type</li>
+            <li>same library, default patron type, same item type</li>
+            <li>same library, default patron type, default item type</li>
+            <li>default library, same patron type, same item type</li>
+            <li>default library, same patron type, default item type</li>
+            <li>default library, default patron type, same item type</li>
+            <li>default library, default patron type, default item type</li>
         </ul>
-        <p>To modify a rule, create a new one with the same borrower type and item type.</p>
+        <p>To modify a rule, create a new one with the same patron type and item type.</p>
     </div>
     <div id="bloc100">
         <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
-        Select a branch :
+        Select a library :
             <select name="branch" id="branch" style="width:20em;">
                 <option value="*">Default</option>
             <!-- TMPL_LOOP NAME="branchloop" -->
-                               <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_IF -->
             <!-- /TMPL_LOOP -->
             </select>
         </form>
-               <br />
-               <br />
-        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
+<!-- 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" -->" />
+            <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>
+
+        <div class="toptabs">
+            <ul class="ui-tabs-nav">
+                <li class="ui-tabs-selected"><a id="nofilter">All</a></li>
+                <li><a id="issuesfilter">Issues</a></li>
+                <li><a id="finesfilter">Fines</a></li>
+                <li><a id="reservesfilter">Reserves</a></li>
+                <div style="text-align:right;"><label for="filter">Filter: </label><input type="text" name="filter" id="filter" /></div>
+            </ul>
+            <div class="tabs-container">
+            <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
             <input type="hidden" name="op" value="add" />
-            <table>
-            <tr>
-                <th>Patron Category</th>
-                <th>Item Type</th>
-                <th>Amount</th>
-                <th>Grace Period</th>
-                <th>Charging Interval</th>
-                <th>Amoun Loanable</th>
-                <th>Loan time</th><th>&nbsp;</th>
-            </tr>
-            <!-- TMPL_LOOP NAME="rules" -->
+            <table id="smartrules" width="100%">
+                <thead>
+                    <tr>
+                        <th>Patron Category</th>
+                        <th>Item Type</th>
+                        <th class="issues">Current Checkouts Allowed</th>
+                        <th class="issues">Loan Period (day)</th>
+                        <th class="fines">Fine Amount</th>
+                        <th class="fines">Fine Charging Interval</th>
+                        <th class="fines">Fine Grace period (day)</th>
+                        <th class="fines">Suspension in Days (day)</th>
+                        <th class="issues">Renewals Allowed (count)</th>
+                        <th class="reserves">Holds Allowed (count)</th>
+                        <th class="issues">Rental Discount (%)</th>
+                        <th>&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                               <!-- TMPL_LOOP NAME="rules" -->
+                                       <!-- TMPL_UNLESS NAME="__odd__" -->
+                                       <tr class="highlight">
+                                       <!-- TMPL_ELSE -->
+                                       <tr>
+                                       <!-- /TMPL_UNLESS -->
+                                                       <td><!-- TMPL_IF NAME="default_humancategorycode" -->
+                                                                       <em>Default</em>
+                                                               <!-- TMPL_ELSE -->
+                                                                       <!-- TMPL_VAR NAME="humancategorycode" -->
+                                                               <!-- /TMPL_IF -->
+                                                       </td>
+                                                       <td><!-- TMPL_IF NAME="default_humanitemtype" -->
+                                                                       <em>Default</em>
+                                                               <!-- TMPL_ELSE -->
+                                                                       <!-- TMPL_VAR NAME="humanitemtype" -->
+                                                               <!-- /TMPL_IF -->
+                                                       </td>
+                                                           <td class="issues"><!-- TMPL_IF NAME="unlimited_maxissueqty" -->
+                                            Unlimited
+                                        <!-- TMPL_ELSE -->
+                                            <!-- TMPL_VAR NAME="maxissueqty" -->
+                                        <!-- /TMPL_IF -->
+                                    </td>
+                                    <td class="issues"><!-- TMPL_IF NAME="issuelength" --><!-- TMPL_VAR NAME="issuelength" --> <!-- /TMPL_IF --></td>
+                                    <td class="fines"><!-- TMPL_VAR NAME="fine" --></td>
+                                    <td class="fines"><!-- TMPL_IF NAME="chargeperiod" --><!-- TMPL_VAR NAME="chargeperiod" --> <!-- /TMPL_IF --></td>
+                                    <td class="fines"><!-- TMPL_IF NAME="firstremind" --><!-- TMPL_VAR NAME="firstremind" --> <!-- /TMPL_IF --></td>
+                                    <td class="fines"><!-- TMPL_IF NAME="finedays" --> <!-- TMPL_VAR NAME="finedays" --> <!-- /TMPL_IF --></td>
+                                    <td class="issues"><!-- TMPL_IF NAME="renewalsallowed" --><!-- TMPL_VAR NAME="renewalsallowed" --> <!-- /TMPL_IF --></td>
+                                    <td class="reserves"><!-- TMPL_IF NAME="reservesallowed" --><!-- TMPL_VAR NAME="reservesallowed" --> <!-- /TMPL_IF --></td>
+                                                       <td class="issues"><!-- 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>
+                                                       </td>
+                       </tr>
+               <!-- /TMPL_LOOP -->
+                </tbody>
+                <tfoot>
                 <tr>
-                    <td><!-- TMPL_IF NAME="default_humancategorycode" -->
-                            Any
-                        <!-- TMPL_ELSE -->
-                            <!-- TMPL_VAR NAME="humancategorycode" -->
-                        <!-- /TMPL_IF -->
+                    <td>
+                        <select name="categorycode">
+                            <option value="*">Default</option>
+                        <!-- TMPL_LOOP NAME="categoryloop" -->
+                            <option value="<!-- TMPL_VAR NAME="categorycode" -->"><!-- TMPL_VAR NAME="description" --></option>
+                        <!-- /TMPL_LOOP -->
+                        </select>
                     </td>
-                    <td><!-- TMPL_IF NAME="default_humanitemtype" -->
-                            Any
-                        <!-- TMPL_ELSE -->
-                            <!-- TMPL_VAR NAME="humanitemtype" -->
-                        <!-- /TMPL_IF -->
+                    <td>
+                        <select name="itemtype" style="width:13em;">
+                            <option value="*">Default</option>
+                        <!-- TMPL_LOOP NAME="itemtypeloop" -->
+                            <option value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="description" --></option>
+                        <!-- /TMPL_LOOP -->
+                        </select>
                     </td>
-                    <td>$<!-- TMPL_VAR NAME="fine" --></td>
-                    <td><!-- TMPL_IF NAME="firstremind" --><!-- TMPL_VAR NAME="firstremind" --> day(s)<!-- /TMPL_IF --></td>
-                    <td><!-- TMPL_IF NAME="chargeperiod" --><!-- TMPL_VAR NAME="chargeperiod" --> day(s)<!-- /TMPL_IF --></td>
-                    <td><!-- TMPL_VAR NAME="maxissueqty" --></td>
-                    <td><!-- TMPL_IF NAME="issuelength" --><!-- TMPL_VAR NAME="issuelength" --> day(s)<!-- /TMPL_IF --></td>
+                        <td class="issues"><input name="maxissueqty" size="3" /></td>
+                                <td class="issues"><input name="issuelength" size="3" /> </td>
+                                <td class="fines"><input name="fine" size="4" /></td>
+                                <td class="fines"><input name="chargeperiod" size="2" /></td>
+                                <td class="fines"><input name="firstremind" size="2" /> </td>
+                                <td class="fines"><input name="finedays" size="3" /> </td>
+                                <td class="issues"><input name="renewalsallowed" size="2" /></td>
+                                <td class="reserves"><input name="reservesallowed" size="2" /></td>
+                   <td><input class="issues" name="rentaldiscount" size="2" /></td>
+                    <td><input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->"/><input type="submit" value="Add" class="submit" /></td>
+                </tr>
+                </tfoot>
+            </table>
+        </form>
+            </div><!-- tabs-container -->
+        </div><!-- toptabs -->
+    </div>
+    <div class="help">
+        <h4>Defaults for this library</h4>
+        <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>
+    </div>
+    <div>
+        <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" -->"/>
+            <table>
+                <tr>
+                    <th>&nbsp;</th>
+                    <th>Total Current Checkouts Allowed</th>
+                    <th>Hold Policy</th>
+                    <th>&nbsp;</th>
+                    <th>&nbsp;</th>
+                </tr>
+                <tr>
+                    <td><em>Defaults<!-- TMPL_UNLESS NAME="default_rules" --> (not set)<!-- /TMPL_IF --></em></td>
+                    <td><input type="text" name="maxissueqty" size="3" value="<!-- TMPL_VAR NAME="default_maxissueqty" -->"/></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>
+                        <select name="holdallowed">
+                            <!-- TMPL_IF NAME="default_holdallowed_any" -->
+                            <option value="2" selected="selected">
+                            <!-- TMPL_ELSE -->
+                            <option value="2">
+                            <!-- /TMPL_IF -->
+                                From Any Library
+                            </option>
+                            <!-- TMPL_IF NAME="default_holdallowed_same" -->
+                            <option value="1" selected="selected">
+                            <!-- TMPL_ELSE -->
+                            <option value="1">
+                            <!-- /TMPL_IF -->
+                                From Home Library
+                            </option>
+                            <!-- TMPL_IF NAME="default_holdallowed_none" -->
+                            <option value="0" selected="selected">
+                            <!-- TMPL_ELSE -->
+                            <option value="0">
+                            <!-- /TMPL_IF -->
+                                No Holds Allowed
+                            </option>
+                        </select>
+                    </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>
                     </td>
                 </tr>
-            <!-- /TMPL_LOOP -->
+            </table>
+        </form>
+    </div>
+    <!-- TMPL_IF NAME="show_branch_cat_rule_form" -->
+    <div class="help">
+        <p>For this library, you can specify the maximum number of loans that
+            a patron of a given category can make, regardless of the item type.
+        </p>
+        <p>If the total amount loanable for a given patron category is left blank,
+           no limit applies, except possibly for a limit you define for a specific item type.
+        </p>
+    </div>
+    <div>
+        <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" -->"/>
+            <table>
+                <tr>
+                    <th>Patron Category</th>
+                    <th>Total Current Checkouts Allowed</th>
+                    <th>&nbsp;</th>
+                </tr>
+                <!-- TMPL_LOOP NAME="branch_cat_rule_loop" -->
+                    <!-- TMPL_UNLESS NAME="__odd__" -->
+                    <tr class="highlight">
+                    <!-- TMPL_ELSE -->
+                    <tr>
+                    <!-- /TMPL_UNLESS -->
+                        <td><!-- TMPL_IF NAME="default_humancategorycode" -->
+                                <em>Default</em>
+                            <!-- TMPL_ELSE -->
+                                <!-- TMPL_VAR NAME="humancategorycode" -->
+                            <!-- /TMPL_IF -->
+                        </td>
+                        <td><!-- TMPL_IF NAME="unlimited_maxissueqty" -->
+                                Unlimited
+                            <!-- TMPL_ELSE -->
+                                <!-- TMPL_VAR NAME="maxissueqty" -->
+                            <!-- /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>
+                        </td>
+                    </tr>
+                <!-- /TMPL_LOOP -->
                 <tr>
                     <td>
                         <select name="categorycode">
-                            <option value="*">Default</option>
                         <!-- TMPL_LOOP NAME="categoryloop" -->
                             <option value="<!-- TMPL_VAR NAME="categorycode" -->"><!-- TMPL_VAR NAME="description" --></option>
                         <!-- /TMPL_LOOP -->
                         </select>
                     </td>
+                    <td><input name="maxissueqty" size="3" /></td>
+                    <td><input type="submit" value="Add" class="submit" /></td>
+                </tr>
+            </table>
+        </form>
+    </div>
+    <!-- /TMPL_IF -->
+    <div class="help">
+        <p>
+            For this library, you can edit rules for given itemtypes, regardless
+            of the patron's category.
+        </p>
+        <p>
+            Currently, this means hold policies.
+            The various policies have the following effects:
+        </p>
+        <ul>
+            <li><strong>From Any Library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
+            <li><strong>From Home Library:</strong> Only patrons from the item's home library may put this book on hold.</li>
+            <li><strong>No Holds Allowed:</strong> No patron may put this book on hold.</li>
+        </ul>
+        <p>
+            Note that if the system preference
+            <code>AllowHoldPolicyOverride</code> is enabled, these policies can
+            be overridden by your circulation staff. Also, these policies are
+            based on the patron's home branch, <em>not</em> the branch that
+            the reserving staff member is from.
+        </p>
+    </div>
+    <div>
+        <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" -->"/>
+            <table>
+                <tr>
+                    <th>Item Type</th>
+                    <th>Hold Policy</th>
+                    <th>&nbsp;</th>
+                </tr>
+                <!-- TMPL_LOOP NAME="branch_item_rule_loop" -->
+                    <!-- TMPL_UNLESS NAME="__odd__" -->
+                    <tr class="highlight">
+                    <!-- TMPL_ELSE -->
+                    <tr>
+                    <!-- /TMPL_UNLESS -->
+                        <td><!-- TMPL_IF NAME="default_humanitemtype" -->
+                                <em>Default</em>
+                            <!-- TMPL_ELSE -->
+                                <!-- TMPL_VAR NAME="humanitemtype" -->
+                            <!-- /TMPL_IF -->
+                        </td>
+                        <td><!-- TMPL_IF NAME="holdallowed_any" -->
+                                From Any Library
+                            <!-- TMPL_ELSIF NAME="holdallowed_same" -->
+                                From Home Library
+                            <!-- TMPL_ELSE -->
+                                No Holds Allowed
+                            <!-- /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>
+                        </td>
+                    </tr>
+                <!-- /TMPL_LOOP -->
+                <tr>
                     <td>
-                        <select name="itemtype" style="width:13em;">
-                            <option value="*">Default</option>
+                        <select name="itemtype">
                         <!-- TMPL_LOOP NAME="itemtypeloop" -->
                             <option value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="description" --></option>
                         <!-- /TMPL_LOOP -->
                         </select>
                     </td>
-                    <td>$<input name="fine" size="4" /></td>
-                    <td><input name="firstremind" size="2" /> day(s)</td>
-                    <td><input name="chargeperiod" size="2" /> day(s)</td>
-                    <td><input name="maxissueqty" size="3" /></td>
-                    <td><input name="issuelength" size="3" /> day(s)</td>
-                    <td><input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->"/><input type="submit" value="Add" class="submit" /></td>
+                    <td>
+                        <select name="holdallowed">
+                            <option value="2">From Any Library</option>
+                            <option value="1">From Home Library</option>
+                            <option value="0">No Holds Allowed</option>
+                        </select>
+                    </td>
+                    <td><input type="submit" value="Add" class="submit" /></td>
                 </tr>
             </table>
         </form>