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