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