Bug 5549 : Allow hourly loans to be indicated in the loan rules
[koha.git] / 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>[% rule.lengthunit %]</td>
113                                                         <td>[% IF ( rule.hardduedate ) %]
114                                                                [% IF ( rule.hardduedatebefore ) %]before [% rule.hardduedate %]</td>
115                                                                [% ELSE %][% IF ( rule.hardduedateexact ) %]on [% rule.hardduedate %]</td>
116                                                                                  [% ELSE %][% IF ( rule.hardduedateafter ) %]after [% rule.hardduedate %]</td>[% END %]
117                                                                                  [% END %]
118                                                                [% END %]
119                                                             [% ELSE %]None defined[% END %]   
120                                                         <td>[% rule.fine %]</td>
121                                                         <td>[% rule.chargeperiod %]</td>
122                                                         <td>[% rule.firstremind %]</td>
123                                                         <td>[% rule.finedays %]</td>
124                                                         <td>[% rule.renewalsallowed %]</td>
125                                                         <td>[% rule.reservesallowed %]</td>
126                                                         <td>[% rule.rentaldiscount %]</td>
127                                                         <td>
128                                                                 <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>
129                                                         </td>
130                         </tr>
131                 [% END %]
132                 <tr>
133                     <td>
134                         <select name="categorycode">
135                             <option value="*">All</option>
136                         [% FOREACH categoryloo IN categoryloop %]
137                             <option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option>
138                         [% END %]
139                         </select>
140                     </td>
141                     <td>
142                         <select name="itemtype" style="width:13em;">
143                             <option value="*">All</option>
144                         [% FOREACH itemtypeloo IN itemtypeloop %]
145                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
146                         [% END %]
147                         </select>
148                     </td>
149                     <td><input name="maxissueqty" size="3" /></td>
150                     <td><input name="issuelength" size="3" /> </td>
151                     <td><input name="lengthunit"  size="6" /> </td>
152                     <td><select name="hardduedatecompare">
153                            <option value="-1">Before</option>
154                            <option value="0">Exactly on</option>
155                            <option value="1">After</option>
156                         </select>
157                         <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate %]" />
158                         [% INCLUDE 'date-format.inc' %]
159                         <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar"  border="0" id="CalendarDueDate" style="cursor: pointer;"/>
160                         <script language="JavaScript" type="text/javascript">
161                              function refocus(calendar) {
162                                  document.getElementById('hardduedate').focus();
163                                  calendar.hide();
164                              };
165                              Calendar.setup(
166                              {
167                              inputField : "hardduedate",
168                              ifFormat : "%m/%d/%Y",
169                              button : "CalendarDueDate",
170                              onClose: refocus
171                              }
172                              );
173                  </script>
174                     </td>
175                     <td><input name="fine" size="4" /></td>
176                     <td><input name="chargeperiod" size="2" /></td>
177                     <td><input name="firstremind" size="2" /> </td>
178                     <td><input name="finedays" size="3" /> </td>
179                     <td><input name="renewalsallowed" size="2" /></td>
180                     <td><input name="reservesallowed" size="2" /></td>
181                     <td><input name="rentaldiscount" size="2" /></td>
182                     <td><input type="hidden" name="branch" value="[% current_branch %]"/><input type="submit" value="Add" class="submit" /></td>
183                 </tr>
184             </table>
185         </form>
186     </div>
187     <div id="defaults-for-this-library" class="container">
188     <h3>Default checkout and hold policy for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
189         <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>
190         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
191             <input type="hidden" name="op" value="set-branch-defaults" />
192             <input type="hidden" name="branch" value="[% current_branch %]"/>
193             <table>
194                 <tr>
195                     <th>&nbsp;</th>
196                     <th>Total Current Checkouts Allowed</th>
197                     <th>Hold Policy</th>
198                     <th>&nbsp;</th>
199                     <th>&nbsp;</th>
200                 </tr>
201                 <tr>
202                     <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
203                     <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
204                     <td>
205                         <select name="holdallowed">
206                             [% IF ( default_holdallowed_any ) %]
207                             <option value="2" selected="selected">
208                             [% ELSE %]
209                             <option value="2">
210                             [% END %]
211                                 From Any Library
212                             </option>
213                             [% IF ( default_holdallowed_same ) %]
214                             <option value="1" selected="selected">
215                             [% ELSE %]
216                             <option value="1">
217                             [% END %]
218                                 From Home Library
219                             </option>
220                             [% IF ( default_holdallowed_none ) %]
221                             <option value="0" selected="selected">
222                             [% ELSE %]
223                             <option value="0">
224                             [% END %]
225                                 No Holds Allowed
226                             </option>
227                         </select>
228                     </td>
229                     <td><input type="submit" value="Save" class="submit" /></td>
230                     <td>
231                         <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch %]">Unset</a>
232                     </td>
233                 </tr>
234             </table>
235         </form>
236     </div>
237     [% IF ( show_branch_cat_rule_form ) %]
238     <div id="holds-policy-by-patron-category" class="container">
239     <h3>Checkout limit by patron category for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
240         <p>For this library, you can specify the maximum number of loans that
241             a patron of a given category can make, regardless of the item type.
242         </p>
243         <p>If the total amount loanable for a given patron category is left blank,
244            no limit applies, except possibly for a limit you define for a specific item type.
245         </p>
246         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
247             <input type="hidden" name="op" value="add-branch-cat" />
248             <input type="hidden" name="branch" value="[% current_branch %]"/>
249             <table>
250                 <tr>
251                     <th>Patron Category</th>
252                     <th>Total Current Checkouts Allowed</th>
253                     <th>&nbsp;</th>
254                 </tr>
255                 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
256                     [% UNLESS ( loop.odd ) %]
257                     <tr class="highlight">
258                     [% ELSE %]
259                     <tr>
260                     [% END %]
261                         <td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
262                                 <em>Default</em>
263                             [% ELSE %]
264                                 [% branch_cat_rule_loo.humancategorycode %]
265                             [% END %]
266                         </td>
267                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
268                                 Unlimited
269                             [% ELSE %]
270                                 [% branch_cat_rule_loo.maxissueqty %]
271                             [% END %]
272                         </td>
273                         <td>
274                             <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>
275                         </td>
276                     </tr>
277                 [% END %]
278                 <tr>
279                     <td>
280                         <select name="categorycode">
281                         [% FOREACH categoryloo IN categoryloop %]
282                             <option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option>
283                         [% END %]
284                         </select>
285                     </td>
286                     <td><input name="maxissueqty" size="3" /></td>
287                     <td><input type="submit" value="Add" class="submit" /></td>
288                 </tr>
289             </table>
290         </form>
291     </div>
292     [% END %]
293     <div id="holds-policy-by-item-type" class="container">
294     <h3>Holds policy by item type for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
295         <p>
296             For this library, you can edit rules for given itemtypes, regardless
297             of the patron's category.
298         </p>
299         <p>
300             Currently, this means hold policies.
301             The various policies have the following effects:
302         </p>
303         <ul>
304             <li><strong>From Any Library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
305             <li><strong>From Home Library:</strong> Only patrons from the item's home library may put this book on hold.</li>
306             <li><strong>No Holds Allowed:</strong> No patron may put this book on hold.</li>
307         </ul>
308         <p>
309             Note that if the system preference
310             <code>AllowHoldPolicyOverride</code> is enabled, these policies can
311             be overridden by your circulation staff. Also, these policies are
312             based on the patron's home library, <em>not</em> the library where the hold is being placed..
313         </p>
314
315         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
316             <input type="hidden" name="op" value="add-branch-item" />
317             <input type="hidden" name="branch" value="[% current_branch %]"/>
318             <table>
319                 <tr>
320                     <th>Item Type</th>
321                     <th>Hold Policy</th>
322                     <th>&nbsp;</th>
323                 </tr>
324                 [% FOREACH branch_item_rule_loo IN branch_item_rule_loop %]
325                     [% UNLESS ( loop.odd ) %]
326                     <tr class="highlight">
327                     [% ELSE %]
328                     <tr>
329                     [% END %]
330                         <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
331                                 <em>Default</em>
332                             [% ELSE %]
333                                 [% branch_item_rule_loo.humanitemtype %]
334                             [% END %]
335                         </td>
336                         <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
337                                 From Any Library
338                             [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
339                                 From Home Library
340                             [% ELSE %]
341                                 No Holds Allowed
342                             [% END %]
343                         </td>
344                         <td>
345                             <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>
346                         </td>
347                     </tr>
348                 [% END %]
349                 <tr>
350                     <td>
351                         <select name="itemtype">
352                         [% FOREACH itemtypeloo IN itemtypeloop %]
353                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
354                         [% END %]
355                         </select>
356                     </td>
357                     <td>
358                         <select name="holdallowed">
359                             <option value="2">From Any Library</option>
360                             <option value="1">From Home Library</option>
361                             <option value="0">No Holds Allowed</option>
362                         </select>
363                     </td>
364                     <td><input type="submit" value="Add" class="submit" /></td>
365                 </tr>
366             </table>
367         </form>
368     </div>
369 </div>
370
371 </div>
372 <div class="yui-b">
373 [% INCLUDE 'admin-menu.inc' %]
374 </div>
375 </div>
376 [% INCLUDE 'intranet-bottom.inc' %]