Bug 21946: (follow-up) Add optgroup label in circ rules
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / smart-rules.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% USE Categories %]
7 [% USE ItemTypes %]
8 [% USE CirculationRules %]
9 [% SET footerjs = 1 %]
10
11 [% SET branchcode = humanbranch || undef %]
12
13 [% SET categorycodes = [] %]
14 [% FOREACH pc IN patron_categories %]
15     [% categorycodes.push( pc.id ) %]
16 [% END %]
17 [% categorycodes.push(undef) %]
18
19 [% SET itemtypes = [] %]
20 [% FOREACH i IN itemtypeloop %]
21     [% itemtypes.push( i.itemtype ) %]
22 [% END %]
23 [% itemtypes.push(undef) %]
24
25 [% INCLUDE 'doc-head-open.inc' %]
26 <title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
27 [% INCLUDE 'doc-head-close.inc' %]
28 </head>
29
30 <body id="admin_smart-rules" class="admin">
31 [% INCLUDE 'header.inc' %]
32 [% INCLUDE 'prefs-admin-search.inc' %]
33
34 <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>
35
36 <div class="main container-fluid">
37     <div class="row">
38         <div class="col-sm-10 col-sm-push-2">
39             <main>
40
41     <h1 class="parameters">
42         [% IF humanbranch %]
43             Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
44         [% ELSE %]
45             Defining circulation and fine rules for all libraries
46         [% END %]
47     </h1>
48     <div class="help">
49         <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
50         <ul>
51             <li>same library, same patron category, same item type</li>
52             <li>same library, same patron category, all item types</li>
53             <li>same library, all patron categories, same item type</li>
54             <li>same library, all patron categories, all item types</li>
55             <li>default (all libraries), same patron category, same item type</li>
56             <li>default (all libraries), same patron category, all item types</li>
57             <li>default (all libraries), all patron categories, same item type</li>
58             <li>default (all libraries), all patron categories, all item types</li>
59         </ul>
60
61         <p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
62         current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
63         or the specific rule's type, whichever is less.</p>
64         <p>To modify a rule, create a new one with the same patron category and item type.</p>
65     </div>
66     <div>
67         [% UNLESS restricted_to_own_library %]
68             <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
69             Select a library :
70                 <select name="branch" id="branch" style="width:20em;">
71                     <option value="*">Standard rules for all libraries</option>
72                     [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
73                 </select>
74             </form>
75             [% IF ( definedbranch ) %]
76                 <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
77                     <label for="tobranch"><strong>Clone these rules to:</strong></label>
78                     <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
79                     <select name="tobranch" id="tobranch">
80                         [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
81                     </select>
82                     <input type="submit" id="clone_rules" value="Clone" />
83                 </form>
84             [% END %]
85         [% END %]
86
87         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
88             <input type="hidden" name="op" value="add" />
89             <input type="hidden" name="branch" value="[% current_branch | html %]"/>
90             <table id="default-circulation-rules">
91             <thead>
92             <tr>
93                 <th>&nbsp;</th>
94                 <th>Patron category</th>
95                 <th>&nbsp;</th>
96                 <th>Item type</th>
97                 <th>Actions</th>
98                 <th>Note</th>
99                 <th>Current checkouts allowed</th>
100                 <th>Current on-site checkouts allowed</th>
101                 <th>Loan period</th>
102                 <th>Days mode</th>
103                 <th>Unit</th>
104                 <th>Hard due date</th>
105                 <th>Fine amount</th>
106                 <th>Fine charging interval</th>
107                 <th>When to charge</th>
108                 <th>Fine grace period</th>
109                 <th>Overdue fines cap (amount)</th>
110                 <th>Cap fine at replacement price</th>
111                 <th>Suspension in days (day)</th>
112                 <th>Max. suspension duration (day)</th>
113                 <th>Suspension charging interval</th>
114                 <th>Renewals allowed (count)</th>
115                 <th>Renewal period</th>
116                 <th>No renewal before</th>
117                 <th>Automatic renewal</th>
118                 <th>No automatic renewal after</th>
119                 <th>No automatic renewal after (hard limit)</th>
120                 <th>Holds allowed (total)</th>
121                 <th>Holds allowed (daily)</th>
122                 <th>Holds per record (count)</th>
123                 <th>On shelf holds allowed</th>
124                 <th>OPAC item level holds</th>
125                 <th>Article requests</th>
126                 <th>Rental discount (%)</th>
127                 <th>Actions</th>
128             </tr>
129             </thead>
130             <tbody>
131                 [% SET row_count = 0 %]
132                 [% FOREACH c IN categorycodes %]
133                     [% SET c = '' UNLESS c.defined %]
134                     [% FOREACH i IN itemtypes %]
135                         [% SET i = '' UNLESS i.defined %]
136                         [% SET note = all_rules.$c.$i.note %]
137                         [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
138                         [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
139                         [% SET issuelength = all_rules.$c.$i.issuelength %]
140                         [% SET daysmode = all_rules.$c.$i.daysmode %]
141                         [% SET lengthunit = all_rules.$c.$i.lengthunit %]
142                         [% SET hardduedate = all_rules.$c.$i.hardduedate %]
143                         [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
144                         [% SET fine = all_rules.$c.$i.fine %]
145                         [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
146                         [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
147                         [% SET firstremind = all_rules.$c.$i.firstremind %]
148                         [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
149                         [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
150                         [% SET finedays = all_rules.$c.$i.finedays %]
151                         [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
152                         [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
153                         [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
154                         [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
155                         [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
156                         [% SET auto_renew = all_rules.$c.$i.auto_renew %]
157                         [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
158                         [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
159                         [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
160                         [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
161                         [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
162                         [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
163                         [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
164                         [% SET article_requests = all_rules.$c.$i.article_requests %]
165                         [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
166
167                         [% SET show_rule = note || maxissueqty || maxonsiteissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount %]
168                         [% IF show_rule %]
169                             [% SET row_count = row_count + 1 %]
170                             <tr row_countd="row_[% row_count | html %]">
171                                     <td>[% IF ( c == undef ) %]1[% ELSE %]0[% END %]</td>
172                                     <td>
173                                         [% IF c == undef %]
174                                             <em>All</em>
175                                         [% ELSE %]
176                                             [% Categories.GetName(c) | html %]
177                                         [% END %]
178                                     </td>
179                                     <td>[% IF ( i == undef ) %]1[% ELSE %]0[% END %]</td>
180                                     <td>
181                                         [% IF i == undef %]
182                                             <em>All</em>
183                                         [% ELSE %]
184                                             [% ItemTypes.GetDescription(i,1) | html %]
185                                         [% END %]
186                                     </td>
187                                     <td class="actions">
188                                       <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
189                                       <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% i || '*' | html %]&amp;categorycode=[% c || '*' | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
190                                     </td>
191                                     <td>
192                                         [% IF note.defined && note != '' %]
193                                             <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
194                                         [% ELSE %]<span>&nbsp;</span>[% END %]
195                                     </td>
196                                     <td>
197                                         [% IF maxissueqty.defined && maxissueqty != '' %]
198                                             [% maxissueqty | html %]
199                                         [% ELSE %]
200                                             <span>Unlimited</span>
201                                         [% END %]
202                                     </td>
203                                     <td>
204                                         [% IF maxonsiteissueqty.defined && maxonsiteissueqty != ''  %]
205                                             [% maxonsiteissueqty | html %]
206                                         [% ELSE %]
207                                             <span>Unlimited</span>
208                                         [% END %]
209                                     </td>
210                                     <td>[% issuelength | html %]</td>
211                                     <td>
212                                         [% SWITCH daysmode %]
213                                         [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Calendar</span>
214                                         [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Datedue</span>
215                                         [% CASE 'Days' %]<span title="Ignore the calendar">Days</span>
216                                         [% CASE 'Dayweek' %]<span title="Use the calendar to push the due date to the next open matching weekday for weekly loan periods, or the next open day otherwise">Dayweek</span>
217                                         [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
218                                         [% END %]
219                                     </td>
220                                     <td>
221                                         [% IF ( lengthunit == 'days' ) %]
222                                             Days
223                                         [% ELSIF ( lengthunit == 'hours') %]
224                                             Hours
225                                         [% ELSE %]
226                                             Undefined
227                                         [% END %]
228                                     </td>
229                                     <td>
230                                       [% IF ( hardduedate ) %]
231                                         [% IF ( hardduedatecompare == '-1' ) %]
232                                           before [% hardduedate | $KohaDates %]
233                                           <input type="hidden" name="hardduedatecomparebackup" value="-1" />
234                                         [% ELSIF ( hardduedatecompare == '0' ) %]
235                                           on [% hardduedate | $KohaDates %]
236                                           <input type="hidden" name="hardduedatecomparebackup" value="0" />
237                                         [% ELSIF ( hardduedatecompare == '1' ) %]
238                                           after [% hardduedate | $KohaDates %]
239                                           <input type="hidden" name="hardduedatecomparebackup" value="1" />
240                                         [% END %]
241                                       [% ELSE %]
242                                         <span>None defined</span>
243                                       [% END %]
244                                     </td>
245                                     <td>[% fine | html %]</td>
246                                     <td>[% chargeperiod | html %]</td>
247                                     <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
248                                     <td>[% firstremind | html %]</td>
249                                     <td>[% overduefinescap FILTER format("%.2f") %]</td>
250                                     <td>
251                                         [% IF cap_fine_to_replacement_price %]
252                                             <input type="checkbox" checked="checked" disabled="disabled" />
253                                         [% ELSE %]
254                                             <input type="checkbox" disabled="disabled" />
255                                         [% END %]
256                                     </td>
257                                     <td>[% finedays | html %]</td>
258                                     <td>[% maxsuspensiondays | html %]</td>
259                                     <td>[% suspension_chargeperiod | html %]</td>
260                                     <td>[% renewalsallowed | html %]</td>
261                                     <td>[% renewalperiod | html %]</td>
262                                     <td>[% norenewalbefore | html %]</td>
263                                     <td>
264                                         [% IF auto_renew %]
265                                             <span>Yes</span>
266                                         [% ELSE %]
267                                             <span>No</span>
268                                         [% END %]
269                                     </td>
270                                     <td>[% no_auto_renewal_after | html %]</td>
271                                     <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
272                                     <td>
273                                         [% IF reservesallowed.defined && reservesallowed != '' %]
274                                             [% reservesallowed | html %]
275                                         [% ELSE %]
276                                             <span>Unlimited</span>
277                                         [% END %]
278                                     </td>
279                                     <td>
280                                         [% IF holds_per_day.defined && holds_per_day != '' %]
281                                             [% holds_per_day | html %]
282                                         [% ELSE %]
283                                             <span>Unlimited</span>
284                                         [% END %]
285                                     </td>
286                                     <td>
287                                         [% IF holds_per_record.defined && holds_per_record != '' %]
288                                             [% holds_per_record | html %]
289                                         [% ELSE %]
290                                             <span>Unlimited</span>
291                                         [% END %]
292                                     </td>
293                                     <td>
294                                         [% IF onshelfholds == 1 %]
295                                             <span>Yes</span>
296                                         [% ELSIF onshelfholds == 2 %]
297                                             <span>If all unavailable</span>
298                                         [% ELSE %]
299                                             <span>If any unavailable</span>
300                                         [% END %]
301                                     </td>
302                                     <td>
303                                         [% IF opacitemholds == 'F'%]
304                                             <span>Force</span>
305                                         [% ELSIF opacitemholds == 'Y'%]
306                                             <span>Allow</span>
307                                         [% ELSE %]
308                                             <span>Don't allow</span>
309                                         [% END %]
310                                     </td>
311                                     <td>
312                                         [% IF article_requests == 'no' %]
313                                             <span>No</span>
314                                         [% ELSIF article_requests == 'yes' %]
315                                             <span>Yes</span>
316                                         [% ELSIF article_requests == 'bib_only' %]
317                                             <span>Record only</span>
318                                         [% ELSIF article_requests == 'item_only' %]
319                                             <span>Item only</span>
320                                         [% END %]
321                                     </td>
322                                     <td>[% rentaldiscount | html %]</td>
323                                     <td class="actions">
324                                       <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
325                                       <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% i || '*' | uri %]&amp;categorycode=[% c || '*' | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
326                                     </td>
327                             </tr>
328                         [% END %]
329                     [% END %]
330                 [% END %]
331                 <tr id="edit_row">
332                     <td>2</td>
333                     <td>
334                         <select name="categorycode" id="categorycode">
335                             <option value="*">All</option>
336                         [% FOREACH patron_category IN patron_categories%]
337                             <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
338                         [% END %]
339                         </select>
340                     </td>
341                     <td>0</td>
342                     <td>
343                         <select name="itemtype" id="matrixitemtype" style="width:13em;">
344                             <option value="*">All</option>
345                             [% FOREACH itemtypeloo IN itemtypeloop %]
346                                 [% NEXT IF itemtypeloo.parent_type %]
347                                 [% SET children = itemtypeloo.children_with_localization %]
348                                 [% IF children %]
349                                     <optgroup label="[% itemtypeloo.translated_description | html %]">
350                                         <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
351                                         [% FOREACH child IN children %]
352                                             <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
353                                         [% END %]
354                                     </optgroup>
355                                 [% ELSE %]
356                                     <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
357                                 [% END %]
358                             [% END %]
359                         </select>
360                     </td>
361                     <td class="actions">
362                         <input type="hidden" name="branch" value="[% current_branch | html %]"/>
363                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
364                         <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
365                     </td>
366                     <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
367                     <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
368                     <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
369                     <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
370                     <td>
371                         <select name="daysmode" id="daysmode">
372                             <option value="">Default</option>
373                             <option value="Calendar">Calendar</option>
374                             <option value="Datedue">Datedue</option>
375                             <option value="Days">Days</option>
376                             <option value="Dayweek">Dayweek</option>
377                         </select>
378                     </td>
379                     <td>
380                       <select name="lengthunit" id="lengthunit">
381                         <option value="days" selected="selected">Days</option>
382                         <option value="hours">Hours</option>
383                       </select>
384                     </td>
385                     <td>
386                         <select name="hardduedatecompare" id="hardduedatecompare">
387                            <option value="-1">Before</option>
388                            <option value="0">Exactly on</option>
389                            <option value="1">After</option>
390                         </select>
391                         <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="datepicker" />
392                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
393                     </td>
394                     <td><input type="text" name="fine" id="fine" size="4" /></td>
395                     <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
396                     <td>
397                         <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
398                            <option value="0">End of interval</option>
399                            <option value="1">Start of interval</option>
400                         </select>
401                     </td>
402                     <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
403                     <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
404                     <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
405                     <td><input type="text" name="finedays" id="fined" size="3" /> </td>
406                     <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
407                     <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
408                     <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
409                     <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
410                     <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
411                     <td>
412                         <select name="auto_renew" id="auto_renew">
413                             <option value="no" selected>No</option>
414                             <option value="yes">Yes</option>
415                         </select>
416                     </td>
417                     <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
418                     <td>
419                         <input type="text" size="10" name="no_auto_renewal_after_hard_limit" id="no_auto_renewal_after_hard_limit" value="[% no_auto_renewal_after_hard_limit | html %]" class="datepicker"/>
420                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
421                     </td>
422                     <td><input type="text" name="reservesallowed"  id="reservesallowed"  size="2" /></td>
423                     <td><input type="text" name="holds_per_day"    id="holds_per_day"    size="2" /></td>
424                     <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
425                     <td>
426                         <select name="onshelfholds" id="onshelfholds">
427                             <option value="1">Yes</option>
428                             <option value="0">If any unavailable</option>
429                             <option value="2">If all unavailable</option>
430                         </select>
431                     </td>
432                     <td>
433                         <select id="opacitemholds" name="opacitemholds">
434                             <option value="N">Don't allow</option>
435                             <option value="Y">Allow</option>
436                             <option value="F">Force</option>
437                         </select>
438                     </td>
439                     <td>
440                         <select id="article_requests" name="article_requests">
441                             <option value="no">No</option>
442                             <option value="yes">Yes</option>
443                             <option value="bib_only">Record only</option>
444                             <option value="item_only">Item only</option>
445                         </select>
446                     </td>
447                     <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
448                     <td class="actions">
449                         <input type="hidden" name="branch" value="[% current_branch | html %]"/>
450                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
451                         <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
452                     </td>
453                 </tr>
454                 <tfoot>
455                     <tr>
456                       <th>&nbsp;</th>
457                       <th>Patron category</th>
458                       <th>&nbsp;</th>
459                       <th>Item type</th>
460                       <th>&nbsp;</th>
461                       <th>Note</th>
462                       <th>Current checkouts allowed</th>
463                       <th>Current on-site checkouts allowed</th>
464                       <th>Loan period</th>
465                       <th>Days mode</th>
466                       <th>Unit</th>
467                       <th>Hard due date</th>
468                       <th>Fine amount</th>
469                       <th>Fine charging interval</th>
470                       <th>Charge when?</th>
471                       <th>Fine grace period</th>
472                       <th>Overdue fines cap (amount)</th>
473                       <th>Cap fine at replacement price</th>
474                       <th>Suspension in days (day)</th>
475                       <th>Max. suspension duration (day)</th>
476                       <th>Suspension charging interval</th>
477                       <th>Renewals allowed (count)</th>
478                       <th>Renewal period</th>
479                       <th>No renewal before</th>
480                       <th>Automatic renewal</th>
481                       <th>No automatic renewal after</th>
482                       <th>No automatic renewal after (hard limit)</th>
483                       <th>Holds allowed (total)</th>
484                       <th>Holds allowed (daily)</th>
485                       <th>Holds per record (count)</th>
486                       <th>On shelf holds allowed</th>
487                       <th>OPAC item level holds</th>
488                       <th>Article requests</th>
489                       <th>Rental discount (%)</th>
490                       <th>&nbsp;</th>
491                     </tr>
492                   </tfoot>
493                 </tbody>
494             </table>
495         </form>
496     </div>
497     <div id="defaults-for-this-library" class="container">
498     <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
499         <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>
500         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
501             <input type="hidden" name="op" value="set-branch-defaults" />
502             <input type="hidden" name="branch" value="[% current_branch | html %]"/>
503             <table>
504                 <tr>
505                     <th>&nbsp;</th>
506                     <th>Total current checkouts allowed</th>
507                     <th>Total current on-site checkouts allowed</th>
508                     <th>Maximum total holds allowed (count)</th>
509                     <th>Hold policy</th>
510                     <th>Hold pickup library match</th>
511                     <th>Return policy</th>
512                     <th>Actions</th>
513                 </tr>
514                 <tr>
515                     <td><em>Defaults</em></td>
516                     <td>
517                         [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
518                         <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
519                     </td>
520                     <td>
521                         [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %]
522                         <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
523                     </td>
524                     <td>
525                         [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
526                         <input name="max_holds" size="3" value="[% rule_value | html %]" />
527                     </td>
528                     <td>
529                         <select name="holdallowed">
530                             [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %]
531                             <option value="">
532                                 Not set
533                             </option>
534
535                             [% IF holdallowed == 2 %]
536                                 <option value="2" selected="selected">
537                             [% ELSE %]
538                                 <option value="2">
539                             [% END %]
540                                 From any library
541                             </option>
542
543                             [% IF holdallowed == 3 %]
544                             <option value="3" selected="selected">
545                             [% ELSE %]
546                             <option value="3">
547                             [% END %]
548                                 From local hold group
549                             </option>
550
551                             [% IF holdallowed == 1 %]
552                                 <option value="1" selected="selected">
553                             [% ELSE %]
554                                 <option value="1">
555                             [% END %]
556                                 From home library
557                             </option>
558
559                             [% IF holdallowed == 0 %]
560                                 <option value="0" selected="selected">
561                             [% ELSE %]
562                                 <option value="0">
563                             [% END %]
564                                 No holds allowed
565                             </option>
566                         </select>
567                     </td>
568                     <td>
569                         <select name="hold_fulfillment_policy">
570                             [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %]
571
572                             <option value="">
573                                 Not set
574                             </option>
575
576                             [% IF hold_fulfillment_policy == 'any' %]
577                                 <option value="any" selected="selected">
578                                     any library
579                                 </option>
580                             [% ELSE %]
581                                 <option value="any">
582                                     any library
583                                 </option>
584                             [% END %]
585
586                             [% IF hold_fulfillment_policy == 'holdgroup' %]
587                                 <option value="holdgroup" selected="selected">
588                                     item's hold group
589                                 </option>
590                             [% ELSE %]
591                                 <option value="holdgroup">
592                                     item's hold group
593                                 </option>
594                             [% END %]
595
596                             [% IF hold_fulfillment_policy == 'patrongroup' %]
597                                 <option value="patrongroup" selected="selected">
598                                     patron's hold group
599                                 </option>
600                             [% ELSE %]
601                                 <option value="patrongroup">
602                                     patron's hold group
603                                 </option>
604                             [% END %]
605
606                             [% IF hold_fulfillment_policy == 'homebranch' %]
607                                 <option value="homebranch" selected="selected">
608                                     item's home library
609                                 </option>
610                             [% ELSE %]
611                                 <option value="homebranch">
612                                     item's home library
613                                 </option>
614                             [% END %]
615
616                             [% IF hold_fulfillment_policy == 'holdingbranch' %]
617                                 <option value="holdingbranch" selected="selected">
618                                     item's holding library
619                                 </option>
620                             [% ELSE %]
621                                 <option value="holdingbranch">
622                                     item's holding library
623                                 </option>
624                             [% END %]
625                         </select>
626                     </td>
627                     <td>
628                         <select name="returnbranch">
629                             [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %]
630
631                             <option value="">
632                                 Not set
633                             </option>
634
635                             [% IF returnbranch == 'homebranch' %]
636                             <option value="homebranch" selected="selected">
637                             [% ELSE %]
638                             <option value="homebranch">
639                             [% END %]
640                                 Item returns home
641                             </option>
642                             [% IF returnbranch == 'holdingbranch' %]
643                             <option value="holdingbranch" selected="selected">
644                             [% ELSE %]
645                             <option value="holdingbranch">
646                             [% END %]
647                                 Item returns to issuing library
648                             </option>
649                             [% IF returnbranch == 'noreturn' %]
650                             <option value="noreturn" selected="selected">
651                             [% ELSE %]
652                             <option value="noreturn">
653                             [% END %]
654                                 Item floats
655                             </option>
656                         </select>
657                     </td>
658                     <td class="actions">
659                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
660                         <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch | html %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
661                     </td>
662                 </tr>
663             </table>
664         </form>
665     </div>
666     [% IF ( show_branch_cat_rule_form ) %]
667     <div id="holds-policy-by-patron-category" class="container">
668     <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
669         <p>For this library, you can specify the maximum number of loans that
670             a patron of a given category can make, regardless of the item type.
671         </p>
672         <p>If the total amount loanable for a given patron category is left blank,
673            no limit applies, except possibly for a limit you define for a specific item type.
674         </p>
675         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
676             <input type="hidden" name="op" value="add-branch-cat" />
677             <input type="hidden" name="branch" value="[% current_branch | html %]"/>
678             <table>
679                 <tr>
680                     <th>Patron category</th>
681                     <th>Total current checkouts allowed</th>
682                     <th>Total current on-site checkouts allowed</th>
683                     <th>Total holds allowed</th>
684                     <th>&nbsp;</th>
685                 </tr>
686                 [% FOREACH c IN categorycodes %]
687                     [% NEXT UNLESS c %]
688                     [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
689                     [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
690                     [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
691
692                     [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
693                     <tr>
694                         <td>
695                             [% IF c == undef %]
696                                 <em>Default</em>
697                             [% ELSE %]
698                                 [% Categories.GetName(c) | html %]
699                             [% END %]
700                         </td>
701                         <td>
702                             [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
703                                 [% patron_maxissueqty | html %]
704                             [% ELSE %]
705                                 <span>Unlimited</span>
706                             [% END %]
707                         </td>
708                         <td>
709                             [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
710                                 [% patron_maxonsiteissueqty | html %]
711                             [% ELSE %]
712                                 <span>Unlimited</span>
713                             [% END %]
714                         </td>
715                         <td>
716                             [% IF max_holds.defined && max_holds != '' %]
717                                 [% max_holds | html %]
718                             [% ELSE %]
719                                 <span>Unlimited</span>
720                             [% END %]
721                         </td>
722
723                         <td class="actions">
724                             <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
725                         </td>
726                     </tr>
727                     [% END %]
728                 [% END %]
729                 <tr>
730                     <td>
731                         <select name="categorycode">
732                         [% FOREACH patron_category IN patron_categories%]
733                             <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
734                         [% END %]
735                         </select>
736                     </td>
737                     <td><input name="patron_maxissueqty" size="3" type="text" /></td>
738                     <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
739                     <td><input name="max_holds" size="3" type="text" /></td>
740                     <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
741                 </tr>
742             </table>
743         </form>
744     </div>
745     [% END %]
746
747     <div id="refund-lost-item-fee-on-return" class="container">
748         [% IF current_branch == '*' %]
749             <h3>Default lost item fee refund on return policy</h3>
750         [% ELSE %]
751             <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
752         [% END %]
753         <p>Specify the default policy for lost item fees on return.
754         </p>
755         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
756             <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
757             <input type="hidden" name="branch" value="[% current_branch | html %]" />
758             <table>
759                 <tr>
760                     <th>Refund lost item fee</th>
761                     <th>&nbsp;</th>
762                 </tr>
763                 <tr>
764                     <td>
765                         <select name="refund">
766                           [%# Default branch %]
767                           [% IF ( current_branch == '*' ) %]
768                             [% IF ( defaultRefundRule ) %]
769                             <option value="1" selected="selected">
770                             [% ELSE %]
771                             <option value="1">
772                             [% END %]
773                                 Yes
774                             </option>
775                             [% IF ( not defaultRefundRule ) %]
776                             <option value="0" selected="selected">
777                             [% ELSE %]
778                             <option value="0">
779                             [% END %]
780                                 No
781                             </option>
782                           [% ELSE %]
783                           [%# Branch-specific %]
784                             [% IF ( not refundLostItemFeeRule ) %]
785                                 <option value="*" selected="selected">
786                             [% ELSE %]
787                                 <option value="*">
788                             [% END %]
789                               [% IF defaultRefundRule %]
790                                 Use default (Yes)
791                               [% ELSE %]
792                                 Use default (No)
793                               [% END %]
794                                 </option>
795                             [% IF ( not refundLostItemFeeRule ) %]
796                                 <option value="1">Yes</option>
797                                 <option value="0">No</option>
798                             [% ELSE %]
799                                 [% IF ( refundLostItemFeeRule.rule_value ) %]
800                                 <option value="1" selected="selected">
801                                 [% ELSE %]
802                                 <option value="1">
803                                 [% END %]
804                                     Yes
805                                 </option>
806                                 [% IF ( not refundLostItemFeeRule.rule_value ) %]
807                                 <option value="0" selected="selected">
808                                 [% ELSE %]
809                                 <option value="0">
810                                 [% END %]
811                                     No
812                                 </option>
813                             [% END %]
814                           [% END %]
815                         </select>
816                     </td>
817                     <td class="actions">
818                         <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
819                     </td>
820                     </td>
821                 </tr>
822             </table>
823         </form>
824     </div>
825
826     <div id="holds-policy-by-item-type" class="container">
827     <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
828         <p>
829             For this library, you can edit rules for given itemtypes, regardless
830             of the patron's category.
831         </p>
832         <p>
833             Currently, this means hold policies.
834             The various policies have the following effects:
835         </p>
836         <ul>
837             <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
838             <li><strong>From local hold group:</strong> Only patrons from libraries in the same item's home library hold groups may put this book on hold.</li>
839             <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
840             <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
841         </ul>
842         <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
843             <strong>Important: </strong>The policies are applied based on the ReservesControlBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReservesControlBranch">[% Koha.Preference('ReservesControlBranch') | html %]</a>.
844         </p>
845
846         <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
847             <input type="hidden" name="op" value="add-branch-item" />
848             <input type="hidden" name="branch" value="[% current_branch | html %]"/>
849             <table>
850                 <tr>
851                     <th>Item type</th>
852                     <th>Hold policy</th>
853                     <th>Hold pickup library match</th>
854                     <th>Return policy</th>
855                     <th>&nbsp;</th>
856                 </tr>
857                 [% FOREACH i IN itemtypeloop %]
858                     [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
859                     [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
860                     [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
861
862                     [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
863                         <tr>
864                             <td>
865                                 [% i.translated_description | html %]
866                             </td>
867                             <td>
868                                 [% IF holdallowed == 2 %]
869                                     <span>From any library</span>
870                                 [% ELSIF holdallowed == 3 %]
871                                     <span>From local hold group</span>
872                                 [% ELSIF holdallowed == 1 %]
873                                     <span>From home library</span>
874                                 [% ELSE %]
875                                     <span>No holds allowed</span>
876                                 [% END %]
877                             </td>
878                             <td>
879                                 [% IF hold_fulfillment_policy == 'any' %]
880                                     <span>any library</span>
881                                 [% ELSIF hold_fulfillment_policy == 'homebranch' %]
882                                     <span>item's home library</span>
883                                 [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
884                                     <span>item's hold group</span>
885                                 [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
886                                     <span>patron's hold group</span>
887                                 [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
888                                     <span>item's holding library</span>
889                                 [% END %]
890                             </td>
891                             <td>
892                                 [% IF returnbranch == 'homebranch' %]
893                                     <span>Item returns home</span>
894                                 [% ELSIF returnbranch == 'holdingbranch' %]
895                                     <span>Item returns to issuing branch</span>
896                                 [% ELSIF returnbranch == 'noreturn' %]
897                                     <span>Item floats</span>
898                                 [% END %]
899                             </td>
900                             <td class="actions">
901                                 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-item&amp;itemtype=[% i.itemtype | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
902                             </td>
903                         </tr>
904                     [% END %]
905                 [% END %]
906                 <tr>
907                     <td>
908                         <select name="itemtype">
909                         [% FOREACH itemtypeloo IN itemtypeloop %]
910                             <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
911                         [% END %]
912                         </select>
913                     </td>
914                     <td>
915                         <select name="holdallowed">
916                             <option value="2">From any library</option>
917                             <option value="3">From local hold group</option>
918                             <option value="1">From home library</option>
919                             <option value="0">No holds allowed</option>
920                         </select>
921                     </td>
922                     <td>
923                         <select name="hold_fulfillment_policy">
924                             <option value="any">
925                                 any library
926                             </option>
927
928                             <option value="holdgroup">
929                                 item's hold group
930                             </option>
931
932                             <option value="patrongroup">
933                                 patron's hold group
934                             </option>
935
936                             <option value="homebranch">
937                                 item's home library
938                             </option>
939
940                             <option value="holdingbranch">
941                                 item's holding library
942                             </option>
943                         </select>
944                     </td>
945                     <td>
946                         <select name="returnbranch">
947                             <option value="homebranch">Item returns home</option>
948                             <option value="holdingbranch">Item returns to issuing library</option>
949                             <option value="noreturn">Item floats</option>
950                         </select>
951                     </td>
952                     <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
953                 </tr>
954             </table>
955         </form>
956     </div>
957             </main>
958         </div> <!-- /.col-sm-10.col-sm-push-2 -->
959
960         <div class="col-sm-2 col-sm-pull-10">
961             <aside>
962                 [% INCLUDE 'admin-menu.inc' %]
963             </aside>
964         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
965      </div> <!-- /.row -->
966
967 [% MACRO jsinclude BLOCK %]
968     [% Asset.js("js/admin-menu.js") | $raw %]
969     [% INCLUDE 'datatables.inc' %]
970     [% INCLUDE 'calendar.inc' %]
971     <script>
972         $(document).ready(function() {
973             $("#default-circulation-rules").dataTable($.extend(true,{},dataTablesDefaults, {
974                 "aoColumnDefs": [
975                     { "bVisible": false, "aTargets": [ 0,2 ] },
976                     { "bSortable": false, "aTargets": ["_all"] }
977                 ],
978                 "aaSortingFixed": [ [0,'asc'], [1,'asc'], [2,'asc'], [3,'asc'] ],
979                 "bPaginate": false,
980                 "bAutoWidth": false
981             }));
982         });
983
984         function clear_edit(){
985             var cancel = confirm(_("Are you sure you want to cancel your changes?"));
986             if ( !cancel ) return;
987             $('#default-circulation-rules td').removeClass('highlighted-row');
988             var edit_row = $("#edit_row");
989             $(edit_row).find("input").each(function(){
990                 var type = $(this).attr("type");
991                 if (type != "button" && type != "submit" ) {
992                     $(this).val("");
993                     $(this).prop('disabled', false);
994                 }
995                 if ( type == "checkbox" ) {
996                     $(this).prop('checked', false);
997                 }
998             });
999             $(edit_row).find("select").prop('disabled', false);
1000             $(edit_row).find("select option:first-child").attr("selected", "selected");
1001             $(edit_row).find("td:last input[name='clear']").remove();
1002         }
1003
1004         var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
1005
1006         $(document).ready(function() {
1007             $('[data-toggle="popover"]').popover();
1008
1009             $(".delete").on("click",function(){
1010                 return confirmDelete(MSG_CONFIRM_DELETE);
1011             });
1012
1013             $("#clone_rules").on("click",function(){
1014                 var library_dropdown = document.getElementById("branch");
1015                 var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value;
1016                 var selected_library_text = $("#branch option:selected").text();
1017                 var to_library = $("#tobranch option:selected").text();
1018                 var MSG_CONFIRM_CLONE;
1019                 if (selected_library === "*") {
1020                     MSG_CONFIRM_CLONE = _("Are you sure you want to clone this standard rule to %s library? This will override the existing rules in this library.").format(to_library);
1021                     return confirmClone(MSG_CONFIRM_CLONE);
1022                 } else {
1023                     MSG_CONFIRM_CLONE = _("Are you sure you want to clone this circulation and fine rule from %s to %s library? This will override the existing rules in this library.").format(selected_library_text, to_library);
1024                     return confirmClone(MSG_CONFIRM_CLONE);
1025                 }
1026             });
1027
1028             $('#selectlibrary').find("input:submit").hide();
1029             $('#branch').change(function() {
1030                     $('#selectlibrary').submit();
1031             });
1032             $(".editrule").click(function(){
1033                 if ( $("#edit_row").find("input[type='text']").filter(function(){return this.value.length > 0 }).length > 0 ) {
1034                     var edit = confirm(_("Are you sure you want to edit another rule?"));
1035                     if (!edit) return false;
1036                 }
1037                 $('#default-circulation-rules td').removeClass('highlighted-row');
1038                 $(this).parent().parent().find("td").each(function (i) {
1039                     $(this).addClass('highlighted-row');
1040                     itm = $(this).text();
1041                     itm = itm.replace(/^\s*|\s*$/g,'');
1042                     var current_column = $("#edit_row td:eq("+i+")");
1043                     if ( i == 3 ) {
1044                         // specific processing for the Note column
1045                         var note = $(this).find("a[name='viewnote']").data("content");
1046                         $(current_column).find("input[type='text']").val(note);
1047                     } else if ( i == 9 ) {
1048                         // specific processing for the Hard due date column
1049                         var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1050                         var input_value = '';
1051                         if (typeof select_value === 'undefined'){
1052                             select_value = '-1';
1053                         }else {
1054                             input_value = itm.split(' ')[1];
1055                         }
1056                         $(current_column).find("input[type='text']").val(input_value);
1057                         $(current_column).find("select").val(select_value);
1058                     } else if ( i == 15 ) {
1059                         // specific processing for cap_fine_to_replacement_price
1060                         var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1061                         $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1062                         $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1063                     } else {
1064                         $(current_column).find("input[type='text']").val(itm);
1065                         // select the corresponding option
1066                         $(current_column).find("select option").each(function(){
1067                             opt = $(this).text().toLowerCase();
1068                             itm = itm.replace(/.*->(.*)/,"$1"); //If item type is part of a group we need to clear the parent description
1069                             opt = opt.replace(/^\s*|\s*$/g,'');
1070                             if ( opt == itm.toLowerCase() ) {
1071                                 $(this).attr('selected', 'selected');
1072                             }
1073                         });
1074                         if ( i == 0 || i == 1 ) {
1075                             // Disable the 2 first columns, we cannot update them.
1076                             var val = $(current_column).find("select option:selected").val();
1077                             var name = "categorycode";
1078                             if ( i == 1 ) {
1079                                 name="itemtype";
1080                             }
1081                             // Remove potential previous input added
1082                             $(current_column).find("input").remove();
1083                             $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1084                         } else if ( i == 5 || i == 6 || i == 25 || i == 26 || i == 27 ) {
1085                             // If the value is not an integer for
1086                             //     - "Current checkouts allowed"
1087                             //     - "Current on-site checkouts allowed"
1088                             //     - "Holds allowed (total)"
1089                             //     - "Holds allowed (daily)"
1090                             //     - "Holds per record (count)"
1091                             // The value is "Unlimited" (or an equivalent translated string)
1092                             // an it should be set to an empty string
1093                             if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) {
1094                                 $(current_column).find("input[type='text']").val("");
1095                             }
1096                         }
1097                     }
1098                 });
1099                 $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1100                 $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1101                 return false;
1102             });
1103             $(".clear_edit").on("click",function(e){
1104                 e.preventDefault();
1105                 clear_edit();
1106             });
1107         });
1108     </script>
1109 [% END %]
1110 [% INCLUDE 'intranet-bottom.inc' %]