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