Merge remote-tracking branch 'kc/master' into merged_5549
[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                                                             [% 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, hold and return policy for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
196         <p>You can set a default maximum number of checkouts, hold policy and return 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>Return policy</th>
206                     <th>&nbsp;</th>
207                     <th>&nbsp;</th>
208                 </tr>
209                 <tr>
210                     <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
211                     <td><input type="text" name="maxissueqty" size="3" value="[% default_maxissueqty %]"/></td>
212                     <td>
213                         <select name="holdallowed">
214                             [% IF ( default_holdallowed_any ) %]
215                             <option value="2" selected="selected">
216                             [% ELSE %]
217                             <option value="2">
218                             [% END %]
219                                 From any library
220                             </option>
221                             [% IF ( default_holdallowed_same ) %]
222                             <option value="1" selected="selected">
223                             [% ELSE %]
224                             <option value="1">
225                             [% END %]
226                                 From home library
227                             </option>
228                             [% IF ( default_holdallowed_none ) %]
229                             <option value="0" selected="selected">
230                             [% ELSE %]
231                             <option value="0">
232                             [% END %]
233                                 No holds allowed
234                             </option>
235                         </select>
236                     </td>
237                     <td>
238                         <select name="returnbranch">
239                             [% IF ( default_returnbranch == 'homebranch' ) %]
240                             <option value="homebranch" selected="selected">
241                             [% ELSE %]
242                             <option value="homebranch">
243                             [% END %]
244                                 Item returns home
245                             </option>
246                             [% IF ( default_returnbranch == 'holdingbranch' ) %]
247                             <option value="holdingbranch" selected="selected">
248                             [% ELSE %]
249                             <option value="holdingbranch">
250                             [% END %]
251                                 Item returns to issuing branch
252                             </option>
253                             [% IF ( default_returnbranch == 'noreturn' ) %]
254                             <option value="noreturn" selected="selected">
255                             [% ELSE %]
256                             <option value="noreturn">
257                             [% END %]
258                                 Item floats
259                             </option>
260                         </select>
261                     </td>
262                     <td><input type="submit" value="Save" class="submit" /></td>
263                     <td>
264                         <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch %]">Unset</a>
265                     </td>
266                 </tr>
267             </table>
268         </form>
269     </div>
270     [% IF ( show_branch_cat_rule_form ) %]
271     <div id="holds-policy-by-patron-category" class="container">
272     <h3>Checkout limit by patron category for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
273         <p>For this library, you can specify the maximum number of loans that
274             a patron of a given category can make, regardless of the item type.
275         </p>
276         <p>If the total amount loanable for a given patron category is left blank,
277            no limit applies, except possibly for a limit you define for a specific item type.
278         </p>
279         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
280             <input type="hidden" name="op" value="add-branch-cat" />
281             <input type="hidden" name="branch" value="[% current_branch %]"/>
282             <table>
283                 <tr>
284                     <th>Patron category</th>
285                     <th>Total current checkouts allowed</th>
286                     <th>&nbsp;</th>
287                 </tr>
288                 [% FOREACH branch_cat_rule_loo IN branch_cat_rule_loop %]
289                     [% UNLESS ( loop.odd ) %]
290                     <tr class="highlight">
291                     [% ELSE %]
292                     <tr>
293                     [% END %]
294                         <td>[% IF ( branch_cat_rule_loo.default_humancategorycode ) %]
295                                 <em>Default</em>
296                             [% ELSE %]
297                                 [% branch_cat_rule_loo.humancategorycode %]
298                             [% END %]
299                         </td>
300                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
301                                 Unlimited
302                             [% ELSE %]
303                                 [% branch_cat_rule_loo.maxissueqty %]
304                             [% END %]
305                         </td>
306                         <td>
307                             <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>
308                         </td>
309                     </tr>
310                 [% END %]
311                 <tr>
312                     <td>
313                         <select name="categorycode">
314                         [% FOREACH categoryloo IN categoryloop %]
315                             <option value="[% categoryloo.categorycode %]">[% categoryloo.description %]</option>
316                         [% END %]
317                         </select>
318                     </td>
319                     <td><input name="maxissueqty" size="3" /></td>
320                     <td><input type="submit" value="Add" class="submit" /></td>
321                 </tr>
322             </table>
323         </form>
324     </div>
325     [% END %]
326     <div id="holds-policy-by-item-type" class="container">
327     <h3>Holds policy by item type for [% IF ( humanbranch ) %][% humanbranch %][% ELSE %]all libraries[% END %]</h3>
328         <p>
329             For this library, you can edit rules for given itemtypes, regardless
330             of the patron's category.
331         </p>
332         <p>
333             Currently, this means hold policies.
334             The various policies have the following effects:
335         </p>
336         <ul>
337             <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
338             <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
339             <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
340         </ul>
341         <p>
342             Note that if the system preference
343             <code>AllowHoldPolicyOverride</code> is enabled, these policies can
344             be overridden by your circulation staff. Also, these policies are
345             based on the patron's home library, <em>not</em> the library where the hold is being placed..
346         </p>
347
348         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
349             <input type="hidden" name="op" value="add-branch-item" />
350             <input type="hidden" name="branch" value="[% current_branch %]"/>
351             <table>
352                 <tr>
353                     <th>Item type</th>
354                     <th>Hold policy</th>
355                     <th>Return policy</th>
356                     <th>&nbsp;</th>
357                 </tr>
358                 [% FOREACH branch_item_rule_loo IN branch_item_rule_loop %]
359                     [% UNLESS ( loop.odd ) %]
360                     <tr class="highlight">
361                     [% ELSE %]
362                     <tr>
363                     [% END %]
364                         <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
365                                 <em>Default</em>
366                             [% ELSE %]
367                                 [% branch_item_rule_loo.humanitemtype %]
368                             [% END %]
369                         </td>
370                         <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
371                                 From any library
372                             [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
373                                 From home library
374                             [% ELSE %]
375                                 No holds allowed
376                             [% END %]
377                         </td>
378                         <td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
379                                 Item returns home
380                             [% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %]
381                                 Item returns to issuing branch
382                             [% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %]
383                                 Item floats
384                             [% ELSE %]
385                                 Error - unknown option
386                             [% END %]
387                         </td>
388                         <td>
389                             <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>
390                         </td>
391                     </tr>
392                 [% END %]
393                 <tr>
394                     <td>
395                         <select name="itemtype">
396                         [% FOREACH itemtypeloo IN itemtypeloop %]
397                             <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
398                         [% END %]
399                         </select>
400                     </td>
401                     <td>
402                         <select name="holdallowed">
403                             <option value="2">From any library</option>
404                             <option value="1">From home library</option>
405                             <option value="0">No holds allowed</option>
406                         </select>
407                     </td>
408                     <td>
409                         <select name="returnbranch">
410                             <option value="homebranch">Item returns home</option>
411                             <option value="holdingbranch">Item returns to issuing branch</option>
412                             <option value="noreturn">Item floats</option>
413                         </select>
414                     </td>
415                     <td><input type="submit" value="Add" class="submit" /></td>
416                 </tr>
417             </table>
418         </form>
419     </div>
420 </div>
421
422 </div>
423 <div class="yui-b">
424 [% INCLUDE 'admin-menu.inc' %]
425 </div>
426 </div>
427 [% INCLUDE 'intranet-bottom.inc' %]