Bug 5549 Followup: fix suspension in days
[koha_gimpoz] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / smart-rules.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Circulation and Fine Rules</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4
5 <script type="text/javascript">
6 //<![CDATA[
7 $(document).ready(function() {
8         $('#selectlibrary').find("input:submit").hide();
9         $('#branch').change(function() {
10                 $('#selectlibrary').submit();
11         });
12 });
13 //]]>
14 </script>
15 <!-- Enable Calendar system -->
16 <link rel="stylesheet" type="text/css" href="[% themelang %]/lib/calendar/calendar-system.css" />
17 <script type="text/javascript" src="[% themelang %]/lib/calendar/calendar.js"></script>
18 <script type="text/javascript" src="[% themelang %]/lib/calendar/calendar-en.js"></script>
19 <script type="text/javascript" src="[% themelang %]/lib/calendar/calendar-setup.js"></script>
20 <!-- End Calendar system additions -->
21 </head>
22 <body>
23 [% INCLUDE 'header.inc' %]
24 [% INCLUDE 'cat-search.inc' %]
25
26 <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; Circulation and Fine Rules</div>
27
28 <div id="doc3" class="yui-t1">
29
30 <div id="bd">
31     <div id="yui-main">
32     <div class="yui-b">
33     <h1 class="parameters">
34         [% IF ( humanbranch ) %]
35             Defining circulation and fine rules for "[% humanbranch %]"
36         [% ELSE %]
37             Defining circulation and fine rules for all libraries
38         [% END %]
39     </h1>
40     <div class="help">
41         <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
42         <ul>
43             <li>same library, same patron type, same item type</li>
44             <li>same library, same patron type, all item types</li>
45             <li>same library, all patron types, same item type</li>
46             <li>same library, all patron types, all item types</li>
47             <li>all libraries, same patron type, same item type</li>
48             <li>all libraries, same patron type, all item types</li>
49             <li>all libraries, all patron types, same item type</li>
50             <li>all libraries, all patron types, all item types</li>
51         </ul>
52         <p>To modify a rule, create a new one with the same patron type and item type.</p>
53     </div>
54     <div>
55         <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
56         Select a library :
57             <select name="branch" id="branch" style="width:20em;">
58                 <option value="*">All libraries</option>
59             [% FOREACH branchloo IN branchloop %]
60                                 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
61             [% END %]
62             </select>
63         </form>
64 [% IF ( definedbranch ) %]<form action="/cgi-bin/koha/admin/clone-rules.pl" method="post"><label 
65 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidden" name="frombranch" value="[% current_branch %]" />
66             <select name="tobranch" id="tobranch">[% FOREACH branchloo IN branchloop %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]</select> <input type="submit" value="Clone" /></form>[% END %]</fieldset>
67
68         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
69             <input type="hidden" name="op" value="add" />
70             <table>
71             <tr>
72                 <th>Patron Category</th>
73                 <th>Item Type</th>
74                 <th>Current Checkouts Allowed</th>
75                 <th>Loan Period</th>
76                 <th>Unit</th>
77                 <th>Hard Due Date</th>
78                 <th>Fine Amount</th>
79                 <th>Fine Charging Interval</th>
80                 <th>Fine Grace period (day)</th>
81                 <th>Suspension in Days (day)</th>
82                 <th>Renewals Allowed (count)</th>
83                 <th>Holds Allowed (count)</th>
84                         <th>Rental Discount (%)</th>
85                                 <th>&nbsp;</th>
86             </tr>
87                                 [% FOREACH rule IN rules %]
88                                         [% UNLESS ( loop.odd ) %]
89                                         <tr class="highlight">
90                                         [% ELSE %]
91                                         <tr>
92                                         [% END %]
93                                                         <td>[% IF ( rule.default_humancategorycode ) %]
94                                                                         <em>All</em>
95                                                                 [% ELSE %]
96                                                                         [% rule.humancategorycode %]
97                                                                 [% END %]
98                                                         </td>
99                                                         <td>[% IF ( rule.default_humanitemtype ) %]
100                                                                         <em>All</em>
101                                                                 [% ELSE %]
102                                                                         [% rule.humanitemtype %]
103                                                                 [% END %]
104                                                         </td>
105                                                         <td>[% IF ( rule.unlimited_maxissueqty ) %]
106                                                                         Unlimited
107                                                                 [% ELSE %]
108                                                                         [% rule.maxissueqty %]
109                                                                 [% END %]
110                                                         </td>
111                                                         <td>[% rule.issuelength %]</td>
112                                                         <td>
113                                                             [% rule.lengthunit %]
114                                                         </td>
115                                                         <td>[% IF ( rule.hardduedate ) %]
116                                                                [% IF ( rule.hardduedatebefore ) %]before [% rule.hardduedate %]</td>
117                                                                [% ELSE %][% IF ( rule.hardduedateexact ) %]on [% rule.hardduedate %]</td>
118                                                                                  [% ELSE %][% IF ( rule.hardduedateafter ) %]after [% rule.hardduedate %]</td>[% END %]
119                                                                                  [% END %]
120                                                                [% END %]
121                                                             [% ELSE %]None defined[% END %]   
122                                                         <td>[% rule.fine %]</td>
123                                                         <td>[% rule.chargeperiod %]</td>
124                                                         <td>[% rule.firstremind %]</td>
125                                                         <td>[% rule.finedays %]</td>
126                                                         <td>[% rule.renewalsallowed %]</td>
127                                                         <td>[% rule.reservesallowed %]</td>
128                                                         <td>[% rule.rentaldiscount %]</td>
129                                                         <td>
130                                                                 <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]">Delete</a>
131                                                         </td>
132                         </tr>
133                 [% END %]
134                 <tr>
135                     <td>
136                         <select name="categorycode">
137                             <option value="*">All</option>
138                         [% FOREACH categoryloo IN categoryloop %]
139                             <option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option>
140                         [% END %]
141                         </select>
142                     </td>
143                     <td>
144                         <select name="itemtype" style="width:13em;">
145                             <option value="*">All</option>
146                         [% FOREACH itemtypeloo IN itemtypeloop %]
147                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
148                         [% END %]
149                         </select>
150                     </td>
151                     <td><input name="maxissueqty" size="3" /></td>
152                     <td><input name="issuelength" size="3" /> </td>
153                     <td>
154                       <select name="lengthunit">
155                         <option value="days" selected>Days</option>
156                         <option value="hours">Hours</option>
157                       </select>
158                     </td>
159                     <td><select name="hardduedatecompare">
160                            <option value="-1">Before</option>
161                            <option value="0">Exactly on</option>
162                            <option value="1">After</option>
163                         </select>
164                         <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" />
165                         [% INCLUDE 'date-format.inc' %]
166                         <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar"  border="0" id="CalendarDueDate" style="cursor: pointer;"/>
167                         <script language="JavaScript" type="text/javascript">
168                              function refocus(calendar) {
169                                  document.getElementById('hardduedate').focus();
170                                  calendar.hide();
171                              };
172                              Calendar.setup(
173                              {
174                              inputField : "hardduedate",
175                              ifFormat : "%m/%d/%Y",
176                              button : "CalendarDueDate",
177                              onClose: refocus
178                              }
179                              );
180                  </script>
181                     </td>
182                     <td><input name="fine" size="4" /></td>
183                     <td><input name="chargeperiod" size="2" /></td>
184                     <td><input name="firstremind" size="2" /> </td>
185                     <td><input name="finedays" size="3" /> </td>
186                     <td><input name="renewalsallowed" size="2" /></td>
187                     <td><input name="reservesallowed" size="2" /></td>
188                     <td><input name="rentaldiscount" size="2" /></td>
189                     <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
190                 </tr>
191             </table>
192         </form>
193     </div>
194     <div id="defaults-for-this-library" class="container">
195     <h3>Default checkout and hold policy for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
196         <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>
197         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
198             <input type="hidden" name="op" value="set-branch-defaults" />
199             <input type="hidden" name="branch" value="[% current_branch %]"/>
200             <table>
201                 <tr>
202                     <th>&nbsp;</th>
203                     <th>Total Current Checkouts Allowed</th>
204                     <th>Hold Policy</th>
205                     <th>&nbsp;</th>
206                     <th>&nbsp;</th>
207                 </tr>
208                 <tr>
209                     <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
210                     <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
211                     <td>
212                         <select name="holdallowed">
213                             [% IF ( default_holdallowed_any ) %]
214                             <option value="2" selected="selected">
215                             [% ELSE %]
216                             <option value="2">
217                             [% END %]
218                                 From Any Library
219                             </option>
220                             [% IF ( default_holdallowed_same ) %]
221                             <option value="1" selected="selected">
222                             [% ELSE %]
223                             <option value="1">
224                             [% END %]
225                                 From Home Library
226                             </option>
227                             [% IF ( default_holdallowed_none ) %]
228                             <option value="0" selected="selected">
229                             [% ELSE %]
230                             <option value="0">
231                             [% END %]
232                                 No Holds Allowed
233                             </option>
234                         </select>
235                     </td>
236                     <td><input type="submit" value="Save" class="submit" /></td>
237                     <td>
238                         <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch %]">Unset</a>
239                     </td>
240                 </tr>
241             </table>
242         </form>
243     </div>
244     [% IF ( show_branch_cat_rule_form ) %]
245     <div id="holds-policy-by-patron-category" class="container">
246     <h3>Checkout limit by patron category for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
247         <p>For this library, you can specify the maximum number of loans that
248             a patron of a given category can make, regardless of the item type.
249         </p>
250         <p>If the total amount loanable for a given patron category is left blank,
251            no limit applies, except possibly for a limit you define for a specific item type.
252         </p>
253         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
254             <input type="hidden" name="op" value="add-branch-cat" />
255             <input type="hidden" name="branch" value="[% current_branch %]"/>
256             <table>
257                 <tr>
258                     <th>Patron Category</th>
259                     <th>Total Current Checkouts Allowed</th>
260                     <th>&nbsp;</th>
261                 </tr>
262                 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
263                     [% UNLESS ( loop.odd ) %]
264                     <tr class="highlight">
265                     [% ELSE %]
266                     <tr>
267                     [% END %]
268                         <td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
269                                 <em>Default</em>
270                             [% ELSE %]
271                                 [% branch_cat_rule_loo.humancategorycode %]
272                             [% END %]
273                         </td>
274                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
275                                 Unlimited
276                             [% ELSE %]
277                                 [% branch_cat_rule_loo.maxissueqty %]
278                             [% END %]
279                         </td>
280                         <td>
281                             <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>
282                         </td>
283                     </tr>
284                 [% END %]
285                 <tr>
286                     <td>
287                         <select name="categorycode">
288                         [% FOREACH categoryloo IN categoryloop %]
289                             <option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option>
290                         [% END %]
291                         </select>
292                     </td>
293                     <td><input name="maxissueqty" size="3" /></td>
294                     <td><input type="submit" value="Add" class="submit" /></td>
295                 </tr>
296             </table>
297         </form>
298     </div>
299     [% END %]
300     <div id="holds-policy-by-item-type" class="container">
301     <h3>Holds policy by item type for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
302         <p>
303             For this library, you can edit rules for given itemtypes, regardless
304             of the patron's category.
305         </p>
306         <p>
307             Currently, this means hold policies.
308             The various policies have the following effects:
309         </p>
310         <ul>
311             <li><strong>From Any Library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
312             <li><strong>From Home Library:</strong> Only patrons from the item's home library may put this book on hold.</li>
313             <li><strong>No Holds Allowed:</strong> No patron may put this book on hold.</li>
314         </ul>
315         <p>
316             Note that if the system preference
317             <code>AllowHoldPolicyOverride</code> is enabled, these policies can
318             be overridden by your circulation staff. Also, these policies are
319             based on the patron's home library, <em>not</em> the library where the hold is being placed..
320         </p>
321
322         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
323             <input type="hidden" name="op" value="add-branch-item" />
324             <input type="hidden" name="branch" value="[% current_branch %]"/>
325             <table>
326                 <tr>
327                     <th>Item Type</th>
328                     <th>Hold Policy</th>
329                     <th>&nbsp;</th>
330                 </tr>
331                 [% FOREACH branch_item_rule_loo IN branch_item_rule_loop %]
332                     [% UNLESS ( loop.odd ) %]
333                     <tr class="highlight">
334                     [% ELSE %]
335                     <tr>
336                     [% END %]
337                         <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
338                                 <em>Default</em>
339                             [% ELSE %]
340                                 [% branch_item_rule_loo.humanitemtype %]
341                             [% END %]
342                         </td>
343                         <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
344                                 From Any Library
345                             [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
346                                 From Home Library
347                             [% ELSE %]
348                                 No Holds Allowed
349                             [% END %]
350                         </td>
351                         <td>
352                             <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&amp;itemtype=[% branch_item_rule_loo.itemtype %]&amp;branch=[% current_branch %]">Delete</a>
353                         </td>
354                     </tr>
355                 [% END %]
356                 <tr>
357                     <td>
358                         <select name="itemtype">
359                         [% FOREACH itemtypeloo IN itemtypeloop %]
360                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
361                         [% END %]
362                         </select>
363                     </td>
364                     <td>
365                         <select name="holdallowed">
366                             <option value="2">From Any Library</option>
367                             <option value="1">From Home Library</option>
368                             <option value="0">No Holds Allowed</option>
369                         </select>
370                     </td>
371                     <td><input type="submit" value="Add" class="submit" /></td>
372                 </tr>
373             </table>
374         </form>
375     </div>
376 </div>
377
378 </div>
379 <div class="yui-b">
380 [% INCLUDE 'admin-menu.inc' %]
381 </div>
382 </div>
383 [% INCLUDE 'intranet-bottom.inc' %]