Bug 9129 - Add the ability to set the maximum fine for an item to its replacement...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / smart-rules.tt
index 2f7ec7e..e7cc158 100644 (file)
@@ -16,6 +16,9 @@ function clear_edit(){
             $(this).val("");
             $(this).removeAttr("disabled");
         }
+        if ( type == "checkbox" ) {
+            $(this).attr('checked', false);
+        }
     });
     $(edit_row).find("select").removeAttr("disabled");
     $(edit_row).find("select option:first").attr("selected", "selected");
@@ -23,6 +26,9 @@ function clear_edit(){
 }
 
 $(document).ready(function() {
+        $('#cap_fine_to_replacement_price').on('change', function(){
+            $('#overduefinescap').prop('disabled', $(this).is(':checked') );
+        });
         $('#selectlibrary').find("input:submit").hide();
         $('#branch').change(function() {
                 $('#selectlibrary').submit();
@@ -38,7 +44,23 @@ $(document).ready(function() {
                 itm = $(this).text();
                 itm = itm.replace(/^\s*|\s*$/g,'');
                 var current_column = $("#edit_row td:eq("+i+")");
-                if ( i != 5 ) {
+                if ( i == 6 ) {
+                    // specific processing for the Hard due date column
+                    var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
+                    var input_value = '';
+                    if (typeof select_value === 'undefined'){
+                        select_value = '-1';
+                    }else {
+                        input_value = itm.split(' ')[1];
+                    }
+                    $(current_column).find("input[type='text']").val(input_value);
+                    $(current_column).find("select").val(select_value);
+                } else if ( i == 12 ) {
+                    // specific processing for cap_fine_to_replacement_price
+                    var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
+                    $('#cap_fine_to_replacement_price').attr('checked', cap_fine_to_replacement_price.is(':checked') );
+                    $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
+                } else {
                     $(current_column).find("input[type='text']").val(itm);
                     // select the corresponding option
                     $(current_column).find("select option").each(function(){
@@ -58,25 +80,14 @@ $(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 ) {
-                        // If the value is not an integer for "Current checkouts allowed"
+                    } else if ( i == 2 || i == 3 ) {
+                        // 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
                         if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
                             $(current_column).find("input[type='text']").val("");
                         }
                     }
-                } else {
-                    // specific processing for the Hard due date column
-                    var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
-                    var input_value = '';
-                    if (typeof select_value === 'undefined'){
-                        select_value = '-1';
-                    }else {
-                        input_value = itm.split(' ')[1];
-                    }
-                    $(current_column).find("input[type='text']").val(input_value);
-                    $(current_column).find("select").val(select_value);
                 }
             });
             $("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled');
@@ -142,13 +153,16 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                 <th>Patron category</th>
                 <th>Item type</th>
                 <th>Current checkouts allowed</th>
+                <th>Current on-site checkouts allowed</th>
                 <th>Loan period</th>
                 <th>Unit</th>
                 <th>Hard due date</th>
                 <th>Fine amount</th>
                 <th>Fine charging interval</th>
-                <th>Fine grace period (day)</th>
+                <th>When to charge</th>
+                <th>Fine grace period</th>
                 <th>Overdue fines cap (amount)</th>
+                <th>Cap fine at replacement price</th>
                 <th>Suspension in days (day)</th>
                 <th>Max. suspension duration (day)</th>
                 <th>Renewals allowed (count)</th>
@@ -174,7 +188,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                                                        <td>[% IF ( rule.default_humanitemtype ) %]
                                                                        <em>All</em>
                                                                [% ELSE %]
-                                                                       [% rule.humanitemtype %]
+                                                                       [% rule.translated_description %]
                                                                [% END %]
                                                        </td>
                                                        <td>[% IF ( rule.unlimited_maxissueqty ) %]
@@ -183,6 +197,12 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                                                                        [% rule.maxissueqty %]
                                                                [% END %]
                                                        </td>
+                            <td>[% IF rule.unlimited_maxonsiteissueqty %]
+                                    Unlimited
+                                [% ELSE %]
+                                    [% rule.maxonsiteissueqty %]
+                                [% END %]
+                            </td>
                                                        <td>[% rule.issuelength %]</td>
                                                        <td>
                                                            [% rule.lengthunit %]
@@ -205,8 +225,16 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                             </td>
                                                        <td>[% rule.fine %]</td>
                                                        <td>[% rule.chargeperiod %]</td>
+                <td>[% IF rule.chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
                                                        <td>[% rule.firstremind %]</td>
                             <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
+                            <td>
+                                [% IF rule.cap_fine_to_replacement_price %]
+                                    <input type="checkbox" checked="checked" disabled="disabled" />
+                                [% ELSE %]
+                                    <input type="checkbox" disabled="disabled" />
+                                [% END %]
+                            </td>
                                                        <td>[% rule.finedays %]</td>
                             <td>[% rule.maxsuspensiondays %]</td>
                                                        <td>[% rule.renewalsallowed %]</td>
@@ -221,7 +249,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                             </td>
                                                        <td>[% rule.reservesallowed %]</td>
                                                         <td>[% IF rule.onshelfholds %]Yes[% ELSE %]No[% END %]</td>
-                                                        <td>[% IF rule.opacitemholds == 'F'%]Enforce[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td>
+                                                        <td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td>
                                                        <td>[% rule.rentaldiscount %]</td>
                             <td><a href="#" class="editrule">Edit</a></td>
                                                        <td>
@@ -242,11 +270,12 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                         <select name="itemtype" id="matrixitemtype" style="width:13em;">
                             <option value="*">All</option>
                         [% FOREACH itemtypeloo IN itemtypeloop %]
-                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
+                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
                         [% END %]
                         </select>
                     </td>
                     <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
+                    <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
                     <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
                     <td>
                       <select name="lengthunit" id="lengthunit">
@@ -265,8 +294,15 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                     </td>
                     <td><input type="text" name="fine" id="fine" size="4" /></td>
                     <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
+                    <td>
+                        <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
+                           <option value="0">End of interval</option>
+                           <option value="1">Start of interval</option>
+                        </select>
+                    </td>
                     <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
                     <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
+                    <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
                     <td><input type="text" name="finedays" id="fined" size="3" /> </td>
                     <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
                     <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
@@ -289,7 +325,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                         <select id="opacitemholds" name="opacitemholds">
                             <option value="N">Don't allow</option>
                             <option value="Y">Allow</option>
-                            <option value="F">Enforce</option>
+                            <option value="F">Force</option>
                         </select>
                     </td>
                     <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
@@ -299,6 +335,34 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                         <input type="button" name="cancel" value="Clear" onclick="clear_edit();return false;" />
                     </td>
                 </tr>
+                <tfoot>
+                    <tr>
+                      <th>Patron category</th>
+                      <th>Item type</th>
+                      <th>Current checkouts allowed</th>
+                      <th>Current on-site checkouts allowed</th>
+                      <th>Loan period</th>
+                      <th>Unit</th>
+                      <th>Hard due date</th>
+                      <th>Fine amount</th>
+                      <th>Fine charging interval</th>
+                      <th>Charge when?</th>
+                      <th>Fine grace period</th>
+                      <th>Overdue fines cap (amount)</th>
+                      <th>Cap fine at replacement price</th>
+                      <th>Suspension in days (day)</th>
+                      <th>Max. suspension duration (day)</th>
+                      <th>Renewals allowed (count)</th>
+                      <th>Renewal period</th>
+                      <th>No renewal before</th>
+                      <th>Automatic renewal</th>
+                      <th>Holds allowed (count)</th>
+                      <th>On shelf holds allowed</th>
+                      <th>Item level holds</th>
+                      <th>Rental discount (%)</th>
+                      <th colspan="2">&nbsp;</th>
+                    </tr>
+                  </tfoot>
                 </tbody>
             </table>
         </form>
@@ -313,6 +377,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                 <tr>
                     <th>&nbsp;</th>
                     <th>Total current checkouts allowed</th>
+                    <th>Total current on-site checkouts allowed</th>
                     <th>Hold policy</th>
                     <th>Return policy</th>
                     <th>&nbsp;</th>
@@ -321,6 +386,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                 <tr>
                     <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
                     <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
+                    <td><input type="text" name="maxonsiteissueqty" size="3" value="[% default_maxonsiteissueqty %]"/></td>
                     <td>
                         <select name="holdallowed">
                             [% IF ( default_holdallowed_any ) %]
@@ -395,6 +461,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                 <tr>
                     <th>Patron category</th>
                     <th>Total current checkouts allowed</th>
+                    <th>Total current on-site checkouts allowed</th>
                     <th>&nbsp;</th>
                 </tr>
                 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
@@ -415,6 +482,13 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                                 [% branch_cat_rule_loo.maxissueqty %]
                             [% END %]
                         </td>
+                        <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
+                                Unlimited
+                            [% ELSE %]
+                                [% branch_cat_rule_loo.maxonsiteissueqty %]
+                            [% END %]
+                        </td>
+
                         <td>
                             <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% branch_cat_rule_loo.categorycode %]&amp;branch=[% current_branch %]">Delete</a>
                         </td>
@@ -429,6 +503,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                         </select>
                     </td>
                     <td><input name="maxissueqty" size="3" /></td>
+                    <td><input name="maxonsiteissueqty" size="3" /></td>
                     <td><input type="submit" value="Add" class="submit" /></td>
                 </tr>
             </table>
@@ -450,11 +525,8 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
             <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 library, <em>not</em> the library where the hold is being placed..
+        <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
+            <strong>Important: </strong>The policies are based on the patron's home library, not the library where the hold is being placed.
         </p>
 
         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
@@ -476,7 +548,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                         <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
                                 <em>Default</em>
                             [% ELSE %]
-                                [% branch_item_rule_loo.humanitemtype %]
+                                [% branch_item_rule_loo.translated_description %]
                             [% END %]
                         </td>
                         <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
@@ -506,7 +578,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde
                     <td>
                         <select name="itemtype">
                         [% FOREACH itemtypeloo IN itemtypeloop %]
-                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
+                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
                         [% END %]
                         </select>
                     </td>