View | Details | Raw Unified | Return to bug 32028
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1263 / +1255 lines)
Lines 55-1396 Link Here
55
    <div class="row">
55
    <div class="row">
56
        <div class="col-sm-10 col-sm-push-2">
56
        <div class="col-sm-10 col-sm-push-2">
57
            <main>
57
            <main>
58
                <h1 class="parameters">
59
                    [% IF humanbranch %]
60
                        Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
61
                    [% ELSE %]
62
                        Defining circulation and fine rules for all libraries
63
                    [% END %]
64
                </h1>
58
65
59
    <h1 class="parameters">
66
                <div class="page-section bg-info">
60
        [% IF humanbranch %]
67
                    <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
61
            Defining circulation and fine rules for "[% Branches.GetName( humanbranch ) | html %]"
68
                    <ul>
62
        [% ELSE %]
69
                        <li>same library, same patron category, same item type</li>
63
            Defining circulation and fine rules for all libraries
70
                        <li>same library, same patron category, all item types</li>
64
        [% END %]
71
                        <li>same library, all patron categories, same item type</li>
65
    </h1>
72
                        <li>same library, all patron categories, all item types</li>
66
    <div class="page-section">
73
                        <li>default (all libraries), same patron category, same item type</li>
67
        <div class="help">
74
                        <li>default (all libraries), same patron category, all item types</li>
68
            <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
75
                        <li>default (all libraries), all patron categories, same item type</li>
69
            <ul>
76
                        <li>default (all libraries), all patron categories, all item types</li>
70
                <li>same library, same patron category, same item type</li>
77
                    </ul>
71
                <li>same library, same patron category, all item types</li>
72
                <li>same library, all patron categories, same item type</li>
73
                <li>same library, all patron categories, all item types</li>
74
                <li>default (all libraries), same patron category, same item type</li>
75
                <li>default (all libraries), same patron category, all item types</li>
76
                <li>default (all libraries), all patron categories, same item type</li>
77
                <li>default (all libraries), all patron categories, all item types</li>
78
            </ul>
79
78
80
            <p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
79
                    <p>Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of
81
            current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
80
                    current checkouts allowed will be limited to either the maximum for the parent (counting sibling types)
82
            or the specific rule's type, whichever is less.</p>
81
                    or the specific rule's type, whichever is less.</p>
83
            <p>To modify a rule, create a new one with the same patron category and item type.</p>
82
                    <p>To modify a rule, create a new one with the same patron category and item type.</p>
84
        </div>
83
                </div>
85
        <div>
86
            [% UNLESS restricted_to_own_library %]
87
                <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
88
                Select a library :
89
                    <select name="branch" id="branch" style="width:20em;">
90
                        <option value="*">Standard rules for all libraries</option>
91
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
92
                    </select>
93
                </form>
94
                [% IF ( definedbranch ) %]
95
                    <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
96
                        <label for="tobranch"><strong>Clone these rules to:</strong></label>
97
                        <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
98
                        <select name="tobranch" id="tobranch">
99
                            [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
100
                        </select>
101
                        <input type="submit" id="clone_rules" class="btn btn-primary" value="Clone" />
102
                    </form>
103
                [% END %]
104
            [% END %]
105
84
106
            <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
85
                <div class="page-section">
107
                <input type="hidden" name="op" value="add" />
86
                    [% UNLESS restricted_to_own_library %]
108
                <input type="hidden" name="branch" value="[% current_branch | html %]"/>
87
                        <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
109
                <table id="default-circulation-rules">
88
                        Select a library :
110
                <thead>
89
                            <select name="branch" id="branch" style="width:20em;">
111
                <tr>
90
                                <option value="*">Standard rules for all libraries</option>
112
                    <th>&nbsp;</th>
91
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
113
                    <th class="fixed_sort">Patron category</th>
92
                            </select>
114
                    <th>&nbsp;</th>
93
                        </form>
115
                    <th class="fixed_sort">Item type</th>
94
                        [% IF ( definedbranch ) %]
116
                    <th class="noExport">Actions</th>
95
                            <form action="/cgi-bin/koha/admin/clone-rules.pl" method="post">
117
                    <th>Note</th>
96
                                <label for="tobranch"><strong>Clone these rules to:</strong></label>
118
                    <th>Current checkouts allowed</th>
97
                                <input type="hidden" name="frombranch" value="[% current_branch | html %]" />
119
                    <th>Current on-site checkouts allowed</th>
98
                                <select name="tobranch" id="tobranch">
120
                    <th>Loan period</th>
99
                                    [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
121
                    <th>Days mode</th>
100
                                </select>
122
                    <th>Unit</th>
101
                                <input type="submit" id="clone_rules" class="btn btn-primary" value="Clone" />
123
                    <th>Hard due date</th>
102
                            </form>
124
                    <th>Decreased loan period for high holds (day)</th>
103
                        [% END %]
125
                    <th>Fine amount</th>
126
                    <th>Fine charging interval</th>
127
                    <th>When to charge</th>
128
                    <th>Fine grace period</th>
129
                    <th>Overdue fines cap (amount)</th>
130
                    <th>Cap fine at replacement price</th>
131
                    <th>Suspension in days (day)</th>
132
                    <th>Max. suspension duration (day)</th>
133
                    <th>Suspension charging interval</th>
134
                    <th>Renewals allowed (count)</th>
135
                    [% IF Koha.Preference('UnseenRenewals') %]
136
                    <th>Unseen renewals allowed (count)</th>
137
                    [% END %]
138
                    <th>Renewal period</th>
139
                    <th>No renewal before</th>
140
                    <th>Automatic renewal</th>
141
                    <th>No automatic renewal after</th>
142
                    <th>No automatic renewal after (hard limit)</th>
143
                    <th>Holds allowed (total)</th>
144
                    <th>Holds allowed (daily)</th>
145
                    <th>Holds per record (count)</th>
146
                    <th>On shelf holds allowed</th>
147
                    <th>OPAC item level holds</th>
148
                    [% IF Koha.Preference('ArticleRequests') %]
149
                    <th>Article requests</th>
150
                    [% END %]
151
                    <th>Rental discount (%)</th>
152
                    [% IF Koha.Preference('UseRecalls') %]
153
                        <th>Recalls allowed (total)</th>
154
                        <th>Recalls per record (count)</th>
155
                        <th>On shelf recalls allowed</th>
156
                        <th>Recall due date interval (day)</th>
157
                        <th>Recall overdue fine amount</th>
158
                        <th>Recall pickup period (day)</th>
159
                    [% END %]
104
                    [% END %]
160
                    <th class="noExport">Actions</th>
105
                </div>
161
                </tr>
162
                </thead>
163
                <tbody>
164
                    [% SET row_count = 0 %]
165
                    [% FOREACH c IN categorycodes %]
166
                        [% SET c = '' UNLESS c.defined %]
167
                        [% FOREACH i IN itemtypes %]
168
                            [% SET i = '' UNLESS i.defined %]
169
                            [% SET note = all_rules.$c.$i.note %]
170
                            [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
171
                            [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
172
                            [% SET issuelength = all_rules.$c.$i.issuelength %]
173
                            [% SET daysmode = all_rules.$c.$i.daysmode %]
174
                            [% SET lengthunit = all_rules.$c.$i.lengthunit %]
175
                            [% SET hardduedate = all_rules.$c.$i.hardduedate %]
176
                            [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
177
                            [% SET fine = all_rules.$c.$i.fine %]
178
                            [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
179
                            [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
180
                            [% SET firstremind = all_rules.$c.$i.firstremind %]
181
                            [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
182
                            [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
183
                            [% SET finedays = all_rules.$c.$i.finedays %]
184
                            [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
185
                            [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
186
                            [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
187
                            [% SET unseenrenewalsallowed = all_rules.$c.$i.unseen_renewals_allowed %]
188
                            [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
189
                            [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
190
                            [% SET auto_renew = all_rules.$c.$i.auto_renew %]
191
                            [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
192
                            [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
193
                            [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
194
                            [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
195
                            [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
196
                            [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
197
                            [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
198
                            [% SET article_requests = all_rules.$c.$i.article_requests %]
199
                            [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
200
                            [% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
201
                            [% SET recalls_allowed = all_rules.$c.$i.recalls_allowed %]
202
                            [% SET recalls_per_record = all_rules.$c.$i.recalls_per_record %]
203
                            [% SET on_shelf_recalls = all_rules.$c.$i.on_shelf_recalls %]
204
                            [% SET recall_due_date_interval = all_rules.$c.$i.recall_due_date_interval %]
205
                            [% SET recall_overdue_fine = all_rules.$c.$i.recall_overdue_fine %]
206
                            [% SET recall_shelf_time = all_rules.$c.$i.recall_shelf_time %]
207
106
208
                            [% 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 || unseenrenewalsallowed || 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 || decreaseloanholds || recalls_allowed || recalls_per_record || on_shelf_recalls || recall_due_date_interval || recall_overdue_fine || recall_shelf_time %]
107
                <div class="page-section">
209
                            [% IF show_rule %]
108
                    <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
210
                                [% SET row_count = row_count + 1 %]
109
                        <input type="hidden" name="op" value="add" />
211
                                <tr row_countd="row_[% row_count | html %]">
110
                        <input type="hidden" name="branch" value="[% current_branch | html %]"/>
212
                                        <td>[% IF ( c == undef ) %]
111
                        <table id="default-circulation-rules">
213
                                                1
112
                        <thead>
214
                                            [% ELSE %]
113
                        <tr>
215
                                                0
114
                            <th>&nbsp;</th>
216
                                            [% END %]</td>
115
                            <th class="fixed_sort">Patron category</th>
217
                                        <td>
116
                            <th>&nbsp;</th>
218
                                            [% IF c == undef %]
117
                            <th class="fixed_sort">Item type</th>
219
                                                <em>All</em>
118
                            <th class="noExport">Actions</th>
220
                                            [% ELSE %]
119
                            <th>Note</th>
221
                                                [% Categories.GetName(c) | html %]
120
                            <th>Current checkouts allowed</th>
222
                                            [% END %]
121
                            <th>Current on-site checkouts allowed</th>
223
                                        </td>
122
                            <th>Loan period</th>
224
                                        <td>[% IF ( i == undef ) %]
123
                            <th>Days mode</th>
225
                                                1
124
                            <th>Unit</th>
226
                                            [% ELSE %]
125
                            <th>Hard due date</th>
227
                                                0
126
                            <th>Decreased loan period for high holds (day)</th>
228
                                            [% END %]</td>
127
                            <th>Fine amount</th>
229
                                        <td>
128
                            <th>Fine charging interval</th>
230
                                            [% IF i == undef %]
129
                            <th>When to charge</th>
231
                                                <em>All</em>
130
                            <th>Fine grace period</th>
232
                                            [% ELSE %]
131
                            <th>Overdue fines cap (amount)</th>
233
                                                [% ItemTypes.GetDescription(i,1) | html %]
132
                            <th>Cap fine at replacement price</th>
234
                                            [% END %]
133
                            <th>Suspension in days (day)</th>
235
                                        </td>
134
                            <th>Max. suspension duration (day)</th>
236
                                        <td class="actions">
135
                            <th>Suspension charging interval</th>
237
                                          <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
136
                            <th>Renewals allowed (count)</th>
238
                                          <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>
137
                            [% IF Koha.Preference('UnseenRenewals') %]
239
                                        </td>
138
                            <th>Unseen renewals allowed (count)</th>
240
                                        <td>
241
                                            [% IF note.defined && note != '' %]
242
                                                <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
243
                                            [% ELSE %]<span>&nbsp;</span>[% END %]
244
                                        </td>
245
                                        <td>
246
                                            [% IF maxissueqty.defined && maxissueqty != '' %]
247
                                                [% maxissueqty | html %]
248
                                            [% ELSE %]
249
                                                <span>Unlimited</span>
250
                                            [% END %]
251
                                        </td>
252
                                        <td>
253
                                            [% IF maxonsiteissueqty.defined && maxonsiteissueqty != ''  %]
254
                                                [% maxonsiteissueqty | html %]
255
                                            [% ELSE %]
256
                                                <span>Unlimited</span>
257
                                            [% END %]
258
                                        </td>
259
                                        <td>[% issuelength | html %]</td>
260
                                        <td>
261
                                            [% SWITCH daysmode %]
262
                                            [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Skip closed days</span>
263
                                            [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Next open day</span>
264
                                            [% CASE 'Days' %]<span title="Ignore the calendar">Ignore the calendar</span>
265
                                            [% 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">Same week day</span>
266
                                            [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
267
                                            [% END %]
268
                                        </td>
269
                                        <td>
270
                                            [% IF ( lengthunit == 'days' ) %]
271
                                                <span>Days</span>
272
                                            [% ELSIF ( lengthunit == 'hours') %]
273
                                                <span>Hours</span>
274
                                            [% ELSE %]
275
                                                <span>Undefined</span>
276
                                            [% END %]
277
                                        </td>
278
                                        <td>
279
                                          [% IF ( hardduedate ) %]
280
                                            [% IF ( hardduedatecompare == '-1' ) %]
281
                                              before [% hardduedate | $KohaDates %]
282
                                              <input type="hidden" name="hardduedatecomparebackup" value="-1" />
283
                                            [% ELSIF ( hardduedatecompare == '0' ) %]
284
                                              on [% hardduedate | $KohaDates %]
285
                                              <input type="hidden" name="hardduedatecomparebackup" value="0" />
286
                                            [% ELSIF ( hardduedatecompare == '1' ) %]
287
                                              after [% hardduedate | $KohaDates %]
288
                                              <input type="hidden" name="hardduedatecomparebackup" value="1" />
289
                                            [% END %]
290
                                          [% ELSE %]
291
                                            <span>None defined</span>
292
                                          [% END %]
293
                                        </td>
294
                                        <td>[% decreaseloanholds | html %]</td>
295
                                        <td>[% fine | html %]</td>
296
                                        <td>[% chargeperiod | html %]</td>
297
                                        <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
298
                                        <td>[% firstremind | html %]</td>
299
                                        <td>[% overduefinescap | $Price %]</td>
300
                                        <td>
301
                                            [% IF cap_fine_to_replacement_price %]
302
                                                <input type="checkbox" checked="checked" disabled="disabled" />
303
                                            [% ELSE %]
304
                                                <input type="checkbox" disabled="disabled" />
305
                                            [% END %]
306
                                        </td>
307
                                        <td>[% finedays | html %]</td>
308
                                        <td>[% maxsuspensiondays | html %]</td>
309
                                        <td>[% suspension_chargeperiod | html %]</td>
310
                                        <td>[% renewalsallowed | html %]</td>
311
                                        [% IF Koha.Preference('UnseenRenewals') %]
312
                                            <td>
313
                                                [% IF unseenrenewalsallowed.defined && unseenrenewalsallowed != '' %]
314
                                                    [% unseenrenewalsallowed | html %]
315
                                                [% ELSE %]
316
                                                    <span>Unlimited</span>
317
                                                [% END %]
318
                                            </td>
319
                                        [% END %]
320
                                        <td>[% renewalperiod | html %]</td>
321
                                        <td>[% norenewalbefore | html %]</td>
322
                                        <td>
323
                                            [% IF auto_renew %]
324
                                                <span>Yes</span>
325
                                            [% ELSE %]
326
                                                <span>No</span>
327
                                            [% END %]
328
                                        </td>
329
                                        <td>[% no_auto_renewal_after | html %]</td>
330
                                        <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
331
                                        <td>
332
                                            [% IF reservesallowed.defined && reservesallowed != '' %]
333
                                                [% reservesallowed | html %]
334
                                            [% ELSE %]
335
                                                <span>Unlimited</span>
336
                                            [% END %]
337
                                        </td>
338
                                        <td>
339
                                            [% IF holds_per_day.defined && holds_per_day != '' %]
340
                                                [% holds_per_day | html %]
341
                                            [% ELSE %]
342
                                                <span>Unlimited</span>
343
                                            [% END %]
344
                                        </td>
345
                                        <td>
346
                                            [% IF holds_per_record.defined && holds_per_record != '' %]
347
                                                [% holds_per_record | html %]
348
                                            [% ELSE %]
349
                                                <span>Unlimited</span>
350
                                            [% END %]
351
                                        </td>
352
                                        <td>
353
                                            [% IF onshelfholds == 1 %]
354
                                                <span>Yes</span>
355
                                            [% ELSIF onshelfholds == 2 %]
356
                                                <span>If all unavailable</span>
357
                                            [% ELSE %]
358
                                                <span>If any unavailable</span>
359
                                            [% END %]
360
                                        </td>
361
                                        <td>
362
                                            [% IF opacitemholds == 'F'%]
363
                                                <span>Force</span>
364
                                            [% ELSIF opacitemholds == 'Y'%]
365
                                                <span>Allow</span>
366
                                            [% ELSE %]
367
                                                <span>Don't allow</span>
368
                                            [% END %]
369
                                        </td>
370
                                        [% IF Koha.Preference('ArticleRequests') %]
371
                                        <td>
372
                                            [% IF article_requests == 'no' %]
373
                                                <span>No</span>
374
                                            [% ELSIF article_requests == 'yes' %]
375
                                                <span>Yes</span>
376
                                            [% ELSIF article_requests == 'bib_only' %]
377
                                                <span>Record only</span>
378
                                            [% ELSIF article_requests == 'item_only' %]
379
                                                <span>Item only</span>
380
                                            [% END %]
381
                                        </td>
382
                                        [% END %]
383
                                        <td>[% rentaldiscount | html %]</td>
384
                                        [% IF Koha.Preference('UseRecalls') %]
385
                                            <td>[% recalls_allowed | html %]</td>
386
                                            <td>[% recalls_per_record | html %]</td>
387
                                            <td>
388
                                                [% IF on_shelf_recalls == 'all' %]
389
                                                    <span>If all unavailable</span>
390
                                                [% ELSE %]
391
                                                    <span>If any unavailable</span>
392
                                                [% END %]
393
                                            </td>
394
                                            <td>[% recall_due_date_interval | html %]</td>
395
                                            <td>[% recall_overdue_fine | $Price %]</td>
396
                                            <td>[% recall_shelf_time | html %]</td>
397
                                        [% END %]
398
                                        <td class="actions">
399
                                          <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
400
                                          <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>
401
                                        </td>
402
                                </tr>
403
                            [% END %]
139
                            [% END %]
404
                        [% END %]
140
                            <th>Renewal period</th>
405
                    [% END %]
141
                            <th>No renewal before</th>
406
                    <tr class="noExport" id="edit_row">
142
                            <th>Automatic renewal</th>
407
                        <td>2</td>
143
                            <th>No automatic renewal after</th>
408
                        <td>
144
                            <th>No automatic renewal after (hard limit)</th>
409
                            <select name="categorycode" id="categorycode">
145
                            <th>Holds allowed (total)</th>
410
                                <option value="*">All</option>
146
                            <th>Holds allowed (daily)</th>
411
                            [% FOREACH patron_category IN patron_categories%]
147
                            <th>Holds per record (count)</th>
412
                                <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
148
                            <th>On shelf holds allowed</th>
149
                            <th>OPAC item level holds</th>
150
                            [% IF Koha.Preference('ArticleRequests') %]
151
                            <th>Article requests</th>
413
                            [% END %]
152
                            [% END %]
414
                            </select>
153
                            <th>Rental discount (%)</th>
415
                        </td>
154
                            [% IF Koha.Preference('UseRecalls') %]
416
                        <td>0</td>
155
                                <th>Recalls allowed (total)</th>
417
                        <td>
156
                                <th>Recalls per record (count)</th>
418
                            <select name="itemtype" id="matrixitemtype" style="width:13em;">
157
                                <th>On shelf recalls allowed</th>
419
                                <option value="*">All</option>
158
                                <th>Recall due date interval (day)</th>
420
                                [% FOREACH itemtypeloo IN itemtypeloop %]
159
                                <th>Recall overdue fine amount</th>
421
                                    [% NEXT IF itemtypeloo.parent_type %]
160
                                <th>Recall pickup period (day)</th>
422
                                    [% SET children = itemtypeloo.children_with_localization %]
161
                            [% END %]
423
                                    [% IF children.count %]
162
                            <th class="noExport">Actions</th>
424
                                        <optgroup label="[% itemtypeloo.translated_description | html %]">
163
                        </tr>
425
                                            <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
164
                        </thead>
426
                                            [% FOREACH child IN children %]
165
                        <tbody>
427
                                                <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
166
                            [% SET row_count = 0 %]
428
                                            [% END %]
167
                            [% FOREACH c IN categorycodes %]
429
                                        </optgroup>
168
                                [% SET c = '' UNLESS c.defined %]
430
                                    [% ELSE %]
169
                                [% FOREACH i IN itemtypes %]
431
                                        <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
170
                                    [% SET i = '' UNLESS i.defined %]
171
                                    [% SET note = all_rules.$c.$i.note %]
172
                                    [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
173
                                    [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
174
                                    [% SET issuelength = all_rules.$c.$i.issuelength %]
175
                                    [% SET daysmode = all_rules.$c.$i.daysmode %]
176
                                    [% SET lengthunit = all_rules.$c.$i.lengthunit %]
177
                                    [% SET hardduedate = all_rules.$c.$i.hardduedate %]
178
                                    [% SET hardduedatecompare = all_rules.$c.$i.hardduedatecompare %]
179
                                    [% SET fine = all_rules.$c.$i.fine %]
180
                                    [% SET chargeperiod = all_rules.$c.$i.chargeperiod %]
181
                                    [% SET chargeperiod_charge_at = all_rules.$c.$i.chargeperiod_charge_at %]
182
                                    [% SET firstremind = all_rules.$c.$i.firstremind %]
183
                                    [% SET overduefinescap = all_rules.$c.$i.overduefinescap %]
184
                                    [% SET cap_fine_to_replacement_price = all_rules.$c.$i.cap_fine_to_replacement_price %]
185
                                    [% SET finedays = all_rules.$c.$i.finedays %]
186
                                    [% SET maxsuspensiondays = all_rules.$c.$i.maxsuspensiondays %]
187
                                    [% SET suspension_chargeperiod = all_rules.$c.$i.suspension_chargeperiod %]
188
                                    [% SET renewalsallowed = all_rules.$c.$i.renewalsallowed %]
189
                                    [% SET unseenrenewalsallowed = all_rules.$c.$i.unseen_renewals_allowed %]
190
                                    [% SET renewalperiod = all_rules.$c.$i.renewalperiod %]
191
                                    [% SET norenewalbefore = all_rules.$c.$i.norenewalbefore %]
192
                                    [% SET auto_renew = all_rules.$c.$i.auto_renew %]
193
                                    [% SET no_auto_renewal_after = all_rules.$c.$i.no_auto_renewal_after %]
194
                                    [% SET no_auto_renewal_after_hard_limit = all_rules.$c.$i.no_auto_renewal_after_hard_limit %]
195
                                    [% SET reservesallowed = all_rules.$c.$i.reservesallowed %]
196
                                    [% SET holds_per_day = all_rules.$c.$i.holds_per_day %]
197
                                    [% SET holds_per_record = all_rules.$c.$i.holds_per_record %]
198
                                    [% SET onshelfholds = all_rules.$c.$i.onshelfholds %]
199
                                    [% SET opacitemholds = all_rules.$c.$i.opacitemholds %]
200
                                    [% SET article_requests = all_rules.$c.$i.article_requests %]
201
                                    [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
202
                                    [% SET decreaseloanholds = all_rules.$c.$i.decreaseloanholds %]
203
                                    [% SET recalls_allowed = all_rules.$c.$i.recalls_allowed %]
204
                                    [% SET recalls_per_record = all_rules.$c.$i.recalls_per_record %]
205
                                    [% SET on_shelf_recalls = all_rules.$c.$i.on_shelf_recalls %]
206
                                    [% SET recall_due_date_interval = all_rules.$c.$i.recall_due_date_interval %]
207
                                    [% SET recall_overdue_fine = all_rules.$c.$i.recall_overdue_fine %]
208
                                    [% SET recall_shelf_time = all_rules.$c.$i.recall_shelf_time %]
209
210
                                    [% 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 || unseenrenewalsallowed || 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 || decreaseloanholds || recalls_allowed || recalls_per_record || on_shelf_recalls || recall_due_date_interval || recall_overdue_fine || recall_shelf_time %]
211
                                    [% IF show_rule %]
212
                                        [% SET row_count = row_count + 1 %]
213
                                        <tr row_countd="row_[% row_count | html %]">
214
                                                <td>[% IF ( c == undef ) %]
215
                                                        1
216
                                                    [% ELSE %]
217
                                                        0
218
                                                    [% END %]</td>
219
                                                <td>
220
                                                    [% IF c == undef %]
221
                                                        <em>All</em>
222
                                                    [% ELSE %]
223
                                                        [% Categories.GetName(c) | html %]
224
                                                    [% END %]
225
                                                </td>
226
                                                <td>[% IF ( i == undef ) %]
227
                                                        1
228
                                                    [% ELSE %]
229
                                                        0
230
                                                    [% END %]</td>
231
                                                <td>
232
                                                    [% IF i == undef %]
233
                                                        <em>All</em>
234
                                                    [% ELSE %]
235
                                                        [% ItemTypes.GetDescription(i,1) | html %]
236
                                                    [% END %]
237
                                                </td>
238
                                                <td class="actions">
239
                                                  <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
240
                                                  <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>
241
                                                </td>
242
                                                <td>
243
                                                    [% IF note.defined && note != '' %]
244
                                                        <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
245
                                                    [% ELSE %]<span>&nbsp;</span>[% END %]
246
                                                </td>
247
                                                <td>
248
                                                    [% IF maxissueqty.defined && maxissueqty != '' %]
249
                                                        [% maxissueqty | html %]
250
                                                    [% ELSE %]
251
                                                        <span>Unlimited</span>
252
                                                    [% END %]
253
                                                </td>
254
                                                <td>
255
                                                    [% IF maxonsiteissueqty.defined && maxonsiteissueqty != ''  %]
256
                                                        [% maxonsiteissueqty | html %]
257
                                                    [% ELSE %]
258
                                                        <span>Unlimited</span>
259
                                                    [% END %]
260
                                                </td>
261
                                                <td>[% issuelength | html %]</td>
262
                                                <td>
263
                                                    [% SWITCH daysmode %]
264
                                                    [% CASE 'Calendar' %]<span title="Use the calendar to skip days the library is closed">Skip closed days</span>
265
                                                    [% CASE 'Datedue' %]<span title="Use the calendar to push the due date to the next open day">Next open day</span>
266
                                                    [% CASE 'Days' %]<span title="Ignore the calendar">Ignore the calendar</span>
267
                                                    [% 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">Same week day</span>
268
                                                    [% CASE %]<span title="Use the system preference 'useDaysMode' as a default value">Default</span>
269
                                                    [% END %]
270
                                                </td>
271
                                                <td>
272
                                                    [% IF ( lengthunit == 'days' ) %]
273
                                                        <span>Days</span>
274
                                                    [% ELSIF ( lengthunit == 'hours') %]
275
                                                        <span>Hours</span>
276
                                                    [% ELSE %]
277
                                                        <span>Undefined</span>
278
                                                    [% END %]
279
                                                </td>
280
                                                <td>
281
                                                  [% IF ( hardduedate ) %]
282
                                                    [% IF ( hardduedatecompare == '-1' ) %]
283
                                                      before [% hardduedate | $KohaDates %]
284
                                                      <input type="hidden" name="hardduedatecomparebackup" value="-1" />
285
                                                    [% ELSIF ( hardduedatecompare == '0' ) %]
286
                                                      on [% hardduedate | $KohaDates %]
287
                                                      <input type="hidden" name="hardduedatecomparebackup" value="0" />
288
                                                    [% ELSIF ( hardduedatecompare == '1' ) %]
289
                                                      after [% hardduedate | $KohaDates %]
290
                                                      <input type="hidden" name="hardduedatecomparebackup" value="1" />
291
                                                    [% END %]
292
                                                  [% ELSE %]
293
                                                    <span>None defined</span>
294
                                                  [% END %]
295
                                                </td>
296
                                                <td>[% decreaseloanholds | html %]</td>
297
                                                <td>[% fine | html %]</td>
298
                                                <td>[% chargeperiod | html %]</td>
299
                                                <td>[% IF chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
300
                                                <td>[% firstremind | html %]</td>
301
                                                <td>[% overduefinescap | $Price %]</td>
302
                                                <td>
303
                                                    [% IF cap_fine_to_replacement_price %]
304
                                                        <input type="checkbox" checked="checked" disabled="disabled" />
305
                                                    [% ELSE %]
306
                                                        <input type="checkbox" disabled="disabled" />
307
                                                    [% END %]
308
                                                </td>
309
                                                <td>[% finedays | html %]</td>
310
                                                <td>[% maxsuspensiondays | html %]</td>
311
                                                <td>[% suspension_chargeperiod | html %]</td>
312
                                                <td>[% renewalsallowed | html %]</td>
313
                                                [% IF Koha.Preference('UnseenRenewals') %]
314
                                                    <td>
315
                                                        [% IF unseenrenewalsallowed.defined && unseenrenewalsallowed != '' %]
316
                                                            [% unseenrenewalsallowed | html %]
317
                                                        [% ELSE %]
318
                                                            <span>Unlimited</span>
319
                                                        [% END %]
320
                                                    </td>
321
                                                [% END %]
322
                                                <td>[% renewalperiod | html %]</td>
323
                                                <td>[% norenewalbefore | html %]</td>
324
                                                <td>
325
                                                    [% IF auto_renew %]
326
                                                        <span>Yes</span>
327
                                                    [% ELSE %]
328
                                                        <span>No</span>
329
                                                    [% END %]
330
                                                </td>
331
                                                <td>[% no_auto_renewal_after | html %]</td>
332
                                                <td>[% no_auto_renewal_after_hard_limit | $KohaDates %]</td>
333
                                                <td>
334
                                                    [% IF reservesallowed.defined && reservesallowed != '' %]
335
                                                        [% reservesallowed | html %]
336
                                                    [% ELSE %]
337
                                                        <span>Unlimited</span>
338
                                                    [% END %]
339
                                                </td>
340
                                                <td>
341
                                                    [% IF holds_per_day.defined && holds_per_day != '' %]
342
                                                        [% holds_per_day | html %]
343
                                                    [% ELSE %]
344
                                                        <span>Unlimited</span>
345
                                                    [% END %]
346
                                                </td>
347
                                                <td>
348
                                                    [% IF holds_per_record.defined && holds_per_record != '' %]
349
                                                        [% holds_per_record | html %]
350
                                                    [% ELSE %]
351
                                                        <span>Unlimited</span>
352
                                                    [% END %]
353
                                                </td>
354
                                                <td>
355
                                                    [% IF onshelfholds == 1 %]
356
                                                        <span>Yes</span>
357
                                                    [% ELSIF onshelfholds == 2 %]
358
                                                        <span>If all unavailable</span>
359
                                                    [% ELSE %]
360
                                                        <span>If any unavailable</span>
361
                                                    [% END %]
362
                                                </td>
363
                                                <td>
364
                                                    [% IF opacitemholds == 'F'%]
365
                                                        <span>Force</span>
366
                                                    [% ELSIF opacitemholds == 'Y'%]
367
                                                        <span>Allow</span>
368
                                                    [% ELSE %]
369
                                                        <span>Don't allow</span>
370
                                                    [% END %]
371
                                                </td>
372
                                                [% IF Koha.Preference('ArticleRequests') %]
373
                                                <td>
374
                                                    [% IF article_requests == 'no' %]
375
                                                        <span>No</span>
376
                                                    [% ELSIF article_requests == 'yes' %]
377
                                                        <span>Yes</span>
378
                                                    [% ELSIF article_requests == 'bib_only' %]
379
                                                        <span>Record only</span>
380
                                                    [% ELSIF article_requests == 'item_only' %]
381
                                                        <span>Item only</span>
382
                                                    [% END %]
383
                                                </td>
384
                                                [% END %]
385
                                                <td>[% rentaldiscount | html %]</td>
386
                                                [% IF Koha.Preference('UseRecalls') %]
387
                                                    <td>[% recalls_allowed | html %]</td>
388
                                                    <td>[% recalls_per_record | html %]</td>
389
                                                    <td>
390
                                                        [% IF on_shelf_recalls == 'all' %]
391
                                                            <span>If all unavailable</span>
392
                                                        [% ELSE %]
393
                                                            <span>If any unavailable</span>
394
                                                        [% END %]
395
                                                    </td>
396
                                                    <td>[% recall_due_date_interval | html %]</td>
397
                                                    <td>[% recall_overdue_fine | $Price %]</td>
398
                                                    <td>[% recall_shelf_time | html %]</td>
399
                                                [% END %]
400
                                                <td class="actions">
401
                                                  <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
402
                                                  <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>
403
                                                </td>
404
                                        </tr>
432
                                    [% END %]
405
                                    [% END %]
433
                                [% END %]
406
                                [% END %]
434
                            </select>
435
                        </td>
436
                        <td class="actions">
437
                            <input type="hidden" name="branch" value="[% current_branch | html %]"/>
438
                            <button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button>
439
                            <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
440
                        </td>
441
                        <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
442
                        <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
443
                        <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
444
                        <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
445
                        <td>
446
                            <select name="daysmode" id="daysmode">
447
                                <option value="" title="Use the system preference 'useDaysMode' as a default value">Default</option>
448
                                <option value="Calendar" title="Use the calendar to skip days the library is closed">Skip closed days</option>
449
                                <option value="Datedue" title="Use the calendar to push the due date to the next open day">Next open day</option>
450
                                <option value="Days" title="Ignore the calendar">Ignore the calendar</option>
451
                                <option value="Dayweek" 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">Same week day</option>
452
                            </select>
453
                        </td>
454
                        <td>
455
                          <select name="lengthunit" id="lengthunit">
456
                            <option value="days" selected="selected">Days</option>
457
                            <option value="hours">Hours</option>
458
                          </select>
459
                        </td>
460
                        <td>
461
                            <select name="hardduedatecompare" id="hardduedatecompare">
462
                               <option value="-1">Before</option>
463
                               <option value="0">Exactly on</option>
464
                               <option value="1">After</option>
465
                            </select>
466
                            <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="flatpickr" />
467
                            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
468
                        </td>
469
                        <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2" /></td>
470
                        <td><input type="text" name="fine" id="fine" size="4" /></td>
471
                        <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
472
                        <td>
473
                            <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
474
                               <option value="0">End of interval</option>
475
                               <option value="1">Start of interval</option>
476
                            </select>
477
                        </td>
478
                        <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
479
                        <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
480
                        <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
481
                        <td><input type="text" name="finedays" id="fined" size="3" /> </td>
482
                        <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
483
                        <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
484
                        <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
485
                        [% IF Koha.Preference('UnseenRenewals') %]
486
                            <td><input type="text" name="unseen_renewals_allowed" id="unseen_renewals_allowed" size="2" /></td>
487
                        [% END %]
488
                        <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
489
                        <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
490
                        <td>
491
                            <select name="auto_renew" id="auto_renew">
492
                                <option value="no" selected>No</option>
493
                                <option value="yes">Yes</option>
494
                            </select>
495
                        </td>
496
                        <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
497
                        <td>
498
                            <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="flatpickr"/>
499
                            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
500
                        </td>
501
                        <td><input type="text" name="reservesallowed"  id="reservesallowed"  size="2" /></td>
502
                        <td><input type="text" name="holds_per_day"    id="holds_per_day"    size="2" /></td>
503
                        <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
504
                        <td>
505
                            <select name="onshelfholds" id="onshelfholds">
506
                                <option value="1">Yes</option>
507
                                <option value="0">If any unavailable</option>
508
                                <option value="2">If all unavailable</option>
509
                            </select>
510
                        </td>
511
                        <td>
512
                            <select id="opacitemholds" name="opacitemholds">
513
                                <option value="N">Don't allow</option>
514
                                <option value="Y">Allow</option>
515
                                <option value="F">Force</option>
516
                            </select>
517
                        </td>
518
                        [% IF Koha.Preference('ArticleRequests') %]
519
                        <td>
520
                            <select id="article_requests" name="article_requests">
521
                                <option value="no">No</option>
522
                                <option value="yes">Yes</option>
523
                                <option value="bib_only">Record only</option>
524
                                <option value="item_only">Item only</option>
525
                            </select>
526
                        </td>
527
                        [% END %]
528
                        <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
529
                        [% IF Koha.Preference('UseRecalls') %]
530
                            <td><input type="text" name="recalls_allowed" id="recalls_allowed" size="3"></td>
531
                            <td><input type="text" name="recalls_per_record" id="recalls_per_record" size="3"></td>
532
                            <td>
533
                                <select name="on_shelf_recalls" id="on_shelf_recalls">
534
                                    <option value="any">If any unavailable</option>
535
                                    <option value="all">If all unavailable</option>
536
                                </select>
537
                            </td>
538
                            <td><input type="text" name="recall_due_date_interval" id="recall_due_date_interval" size="3"></td>
539
                            <td><input type="text" name="recall_overdue_fine" id="recall_overdue_fine" size="6"></td>
540
                            <td><input type="text" name="recall_shelf_time" id="recall_shelf_time" size="3"></td>
541
                        [% END %]
542
                        <td class="actions">
543
                            <input type="hidden" name="branch" value="[% current_branch | html %]"/>
544
                            <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
545
                            <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
546
                        </td>
547
                    </tr>
548
                    </tbody>
549
                    <tfoot>
550
                        <tr>
551
                          <th>&nbsp;</th>
552
                          <th>Patron category</th>
553
                          <th>&nbsp;</th>
554
                          <th>Item type</th>
555
                          <th>&nbsp;</th>
556
                          <th>Note</th>
557
                          <th>Current checkouts allowed</th>
558
                          <th>Current on-site checkouts allowed</th>
559
                          <th>Loan period</th>
560
                          <th>Days mode</th>
561
                          <th>Unit</th>
562
                          <th>Hard due date</th>
563
                          <th>Decreased loan period for high holds (day)</th>
564
                          <th>Fine amount</th>
565
                          <th>Fine charging interval</th>
566
                          <th>Charge when?</th>
567
                          <th>Fine grace period</th>
568
                          <th>Overdue fines cap (amount)</th>
569
                          <th>Cap fine at replacement price</th>
570
                          <th>Suspension in days (day)</th>
571
                          <th>Max. suspension duration (day)</th>
572
                          <th>Suspension charging interval</th>
573
                          <th>Renewals allowed (count)</th>
574
                          [% IF Koha.Preference('UnseenRenewals') %]
575
                          <th>Unseen renewals allowed (count)</th>
576
                          [% END %]
577
                          <th>Renewal period</th>
578
                          <th>No renewal before</th>
579
                          <th>Automatic renewal</th>
580
                          <th>No automatic renewal after</th>
581
                          <th>No automatic renewal after (hard limit)</th>
582
                          <th>Holds allowed (total)</th>
583
                          <th>Holds allowed (daily)</th>
584
                          <th>Holds per record (count)</th>
585
                          <th>On shelf holds allowed</th>
586
                          <th>OPAC item level holds</th>
587
                          [% IF Koha.Preference('ArticleRequests') %]
588
                          <th>Article requests</th>
589
                          [% END %]
590
                          <th>Rental discount (%)</th>
591
                          [% IF Koha.Preference('UseRecalls') %]
592
                            <th>Recalls allowed (total)</th>
593
                            <th>Recalls per record (count)</th>
594
                            <th>On shelf recalls allowed</th>
595
                            <th>Recall due date interval (day)</th>
596
                            <th>Recall overdue fine amount</th>
597
                            <th>Recall pickup period (day)</th>
598
                          [% END %]
599
                          <th>&nbsp;</th>
600
                        </tr>
601
                    </tfoot>
602
                </table>
603
            </form>
604
        </div><!-- ./page-section -->
605
    </div>
606
    <div id="defaults-for-this-library" class="container">
607
    <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h3>
608
        <div class="page-section">
609
            <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>
610
            <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
611
                <input type="hidden" name="op" value="set-branch-defaults" />
612
                <input type="hidden" name="branch" value="[% current_branch | html %]"/>
613
                <table>
614
                    <tr>
615
                        <th>&nbsp;</th>
616
                        <th>Total current checkouts allowed</th>
617
                        <th>Total current on-site checkouts allowed</th>
618
                        <th>Maximum total holds allowed (count)</th>
619
                        <th>Hold policy</th>
620
                        <th>Hold pickup library match</th>
621
                        <th>Return policy</th>
622
                        <th class="noExport">Actions</th>
623
                    </tr>
624
                    [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
625
                    [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty', { want_rule => 1 } ) %]
626
                    [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
627
                    [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
628
                    [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
629
                    [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
630
                    [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
631
                    <tr>
632
                        <td>
633
                            [% IF ( default_checkout_hold_and_return_policy ) %]
634
                                <em>
635
                                Defaults
636
                                </em>
637
                            [% ELSE %]
638
                                Not set
639
                            [% END %]
407
                            [% END %]
640
                        </td>
408
                            <tr class="noExport" id="edit_row">
641
                        <td>
409
                                <td>2</td>
642
                            <input type="text" name="patron_maxissueqty" size="9" value="[% patron_maxissueqty.rule_value | html %]" placeholder="Unlimited"/>
410
                                <td>
643
                        </td>
411
                                    <select name="categorycode" id="categorycode">
644
                        <td>
412
                                        <option value="*">All</option>
645
                            <input type="text" name="patron_maxonsiteissueqty" size="9" value="[% patron_maxonsiteissueqty.rule_value | html %]" placeholder="Unlimited"/>
413
                                    [% FOREACH patron_category IN patron_categories%]
646
                        </td>
414
                                        <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
647
                        <td>
415
                                    [% END %]
648
                            <input name="max_holds" size="9" value="[% rule_value.rule_value | html %]" placeholder="Unlimited"/>
416
                                    </select>
649
                        </td>
417
                                </td>
650
                        <td>
418
                                <td>0</td>
651
                            <select name="holdallowed">
419
                                <td>
652
                                <option value="">
420
                                    <select name="itemtype" id="matrixitemtype" style="width:13em;">
653
                                    Not set
421
                                        <option value="*">All</option>
654
                                </option>
422
                                        [% FOREACH itemtypeloo IN itemtypeloop %]
655
423
                                            [% NEXT IF itemtypeloo.parent_type %]
656
                                [% IF holdallowed.rule_value == 'from_any_library' %]
424
                                            [% SET children = itemtypeloo.children_with_localization %]
657
                                    <option value="from_any_library" selected="selected">
425
                                            [% IF children.count %]
658
                                [% ELSE %]
426
                                                <optgroup label="[% itemtypeloo.translated_description | html %]">
659
                                    <option value="from_any_library">
427
                                                    <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
428
                                                    [% FOREACH child IN children %]
429
                                                        <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
430
                                                    [% END %]
431
                                                </optgroup>
432
                                            [% ELSE %]
433
                                                <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
434
                                            [% END %]
435
                                        [% END %]
436
                                    </select>
437
                                </td>
438
                                <td class="actions">
439
                                    <input type="hidden" name="branch" value="[% current_branch | html %]"/>
440
                                    <button type="submit" class="btn btn-primary btn-xs"><i class="fa fa-save"></i> Save</button>
441
                                    <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
442
                                </td>
443
                                <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
444
                                <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
445
                                <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
446
                                <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
447
                                <td>
448
                                    <select name="daysmode" id="daysmode">
449
                                        <option value="" title="Use the system preference 'useDaysMode' as a default value">Default</option>
450
                                        <option value="Calendar" title="Use the calendar to skip days the library is closed">Skip closed days</option>
451
                                        <option value="Datedue" title="Use the calendar to push the due date to the next open day">Next open day</option>
452
                                        <option value="Days" title="Ignore the calendar">Ignore the calendar</option>
453
                                        <option value="Dayweek" 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">Same week day</option>
454
                                    </select>
455
                                </td>
456
                                <td>
457
                                  <select name="lengthunit" id="lengthunit">
458
                                    <option value="days" selected="selected">Days</option>
459
                                    <option value="hours">Hours</option>
460
                                  </select>
461
                                </td>
462
                                <td>
463
                                    <select name="hardduedatecompare" id="hardduedatecompare">
464
                                       <option value="-1">Before</option>
465
                                       <option value="0">Exactly on</option>
466
                                       <option value="1">After</option>
467
                                    </select>
468
                                    <input type="text" size="10" id="hardduedate" name="hardduedate" value="[% hardduedate | html %]" class="flatpickr" />
469
                                    <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
470
                                </td>
471
                                <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2" /></td>
472
                                <td><input type="text" name="fine" id="fine" size="4" /></td>
473
                                <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
474
                                <td>
475
                                    <select name="chargeperiod_charge_at" id="chargeperiod_charge_at">
476
                                       <option value="0">End of interval</option>
477
                                       <option value="1">Start of interval</option>
478
                                    </select>
479
                                </td>
480
                                <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
481
                                <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
482
                                <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
483
                                <td><input type="text" name="finedays" id="fined" size="3" /> </td>
484
                                <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
485
                                <td><input type="text" name="suspension_chargeperiod" id="suspension_chargeperiod" size="3" /> </td>
486
                                <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
487
                                [% IF Koha.Preference('UnseenRenewals') %]
488
                                    <td><input type="text" name="unseen_renewals_allowed" id="unseen_renewals_allowed" size="2" /></td>
660
                                [% END %]
489
                                [% END %]
661
                                    From any library
490
                                <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
662
                                </option>
491
                                <td><input type="text" name="norenewalbefore" id="norenewalbefore" size="3" /></td>
663
492
                                <td>
664
                                [% IF holdallowed.rule_value == 'from_local_hold_group' %]
493
                                    <select name="auto_renew" id="auto_renew">
665
                                <option value="from_local_hold_group" selected="selected">
494
                                        <option value="no" selected>No</option>
666
                                [% ELSE %]
495
                                        <option value="yes">Yes</option>
667
                                <option value="from_local_hold_group">
496
                                    </select>
497
                                </td>
498
                                <td><input type="text" name="no_auto_renewal_after" id="no_auto_renewal_after" size="3" /></td>
499
                                <td>
500
                                    <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="flatpickr"/>
501
                                    <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
502
                                </td>
503
                                <td><input type="text" name="reservesallowed"  id="reservesallowed"  size="2" /></td>
504
                                <td><input type="text" name="holds_per_day"    id="holds_per_day"    size="2" /></td>
505
                                <td><input type="text" name="holds_per_record" id="holds_per_record" size="2" /></td>
506
                                <td>
507
                                    <select name="onshelfholds" id="onshelfholds">
508
                                        <option value="1">Yes</option>
509
                                        <option value="0">If any unavailable</option>
510
                                        <option value="2">If all unavailable</option>
511
                                    </select>
512
                                </td>
513
                                <td>
514
                                    <select id="opacitemholds" name="opacitemholds">
515
                                        <option value="N">Don't allow</option>
516
                                        <option value="Y">Allow</option>
517
                                        <option value="F">Force</option>
518
                                    </select>
519
                                </td>
520
                                [% IF Koha.Preference('ArticleRequests') %]
521
                                <td>
522
                                    <select id="article_requests" name="article_requests">
523
                                        <option value="no">No</option>
524
                                        <option value="yes">Yes</option>
525
                                        <option value="bib_only">Record only</option>
526
                                        <option value="item_only">Item only</option>
527
                                    </select>
528
                                </td>
668
                                [% END %]
529
                                [% END %]
669
                                    From local hold group
530
                                <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
670
                                </option>
531
                                [% IF Koha.Preference('UseRecalls') %]
671
532
                                    <td><input type="text" name="recalls_allowed" id="recalls_allowed" size="3"></td>
672
                                [% IF holdallowed.rule_value == 'from_home_library' %]
533
                                    <td><input type="text" name="recalls_per_record" id="recalls_per_record" size="3"></td>
673
                                    <option value="from_home_library" selected="selected">
534
                                    <td>
674
                                [% ELSE %]
535
                                        <select name="on_shelf_recalls" id="on_shelf_recalls">
675
                                    <option value="from_home_library">
536
                                            <option value="any">If any unavailable</option>
537
                                            <option value="all">If all unavailable</option>
538
                                        </select>
539
                                    </td>
540
                                    <td><input type="text" name="recall_due_date_interval" id="recall_due_date_interval" size="3"></td>
541
                                    <td><input type="text" name="recall_overdue_fine" id="recall_overdue_fine" size="6"></td>
542
                                    <td><input type="text" name="recall_shelf_time" id="recall_shelf_time" size="3"></td>
676
                                [% END %]
543
                                [% END %]
677
                                    From home library
544
                                <td class="actions">
678
                                </option>
545
                                    <input type="hidden" name="branch" value="[% current_branch | html %]"/>
546
                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
547
                                    <button name="cancel" class="clear_edit btn btn-default btn-xs"><i class="fa fa-undo"></i> Clear</button>
548
                                </td>
549
                            </tr>
550
                            </tbody>
551
                            <tfoot>
552
                                <tr>
553
                                  <th>&nbsp;</th>
554
                                  <th>Patron category</th>
555
                                  <th>&nbsp;</th>
556
                                  <th>Item type</th>
557
                                  <th>&nbsp;</th>
558
                                  <th>Note</th>
559
                                  <th>Current checkouts allowed</th>
560
                                  <th>Current on-site checkouts allowed</th>
561
                                  <th>Loan period</th>
562
                                  <th>Days mode</th>
563
                                  <th>Unit</th>
564
                                  <th>Hard due date</th>
565
                                  <th>Decreased loan period for high holds (day)</th>
566
                                  <th>Fine amount</th>
567
                                  <th>Fine charging interval</th>
568
                                  <th>Charge when?</th>
569
                                  <th>Fine grace period</th>
570
                                  <th>Overdue fines cap (amount)</th>
571
                                  <th>Cap fine at replacement price</th>
572
                                  <th>Suspension in days (day)</th>
573
                                  <th>Max. suspension duration (day)</th>
574
                                  <th>Suspension charging interval</th>
575
                                  <th>Renewals allowed (count)</th>
576
                                  [% IF Koha.Preference('UnseenRenewals') %]
577
                                  <th>Unseen renewals allowed (count)</th>
578
                                  [% END %]
579
                                  <th>Renewal period</th>
580
                                  <th>No renewal before</th>
581
                                  <th>Automatic renewal</th>
582
                                  <th>No automatic renewal after</th>
583
                                  <th>No automatic renewal after (hard limit)</th>
584
                                  <th>Holds allowed (total)</th>
585
                                  <th>Holds allowed (daily)</th>
586
                                  <th>Holds per record (count)</th>
587
                                  <th>On shelf holds allowed</th>
588
                                  <th>OPAC item level holds</th>
589
                                  [% IF Koha.Preference('ArticleRequests') %]
590
                                  <th>Article requests</th>
591
                                  [% END %]
592
                                  <th>Rental discount (%)</th>
593
                                  [% IF Koha.Preference('UseRecalls') %]
594
                                    <th>Recalls allowed (total)</th>
595
                                    <th>Recalls per record (count)</th>
596
                                    <th>On shelf recalls allowed</th>
597
                                    <th>Recall due date interval (day)</th>
598
                                    <th>Recall overdue fine amount</th>
599
                                    <th>Recall pickup period (day)</th>
600
                                  [% END %]
601
                                  <th>&nbsp;</th>
602
                                </tr>
603
                            </tfoot>
604
                        </table>
605
                    </form>
606
                </div><!-- ./page-section -->
679
607
680
                                [% IF holdallowed.rule_value == 'not_allowed' %]
608
                <div id="defaults-for-this-library" class="page-section">
681
                                    <option value="not_allowed" selected="selected">
609
                    <h2>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) | html %][% END %]</h2>
682
                                [% ELSE %]
610
                    <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>
683
                                    <option value="not_allowed">
611
                    <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
684
                                [% END %]
612
                        <input type="hidden" name="op" value="set-branch-defaults" />
685
                                    No holds allowed
613
                        <input type="hidden" name="branch" value="[% current_branch | html %]"/>
686
                                </option>
614
                        <table>
687
                            </select>
615
                            <tr>
688
                        </td>
616
                                <th>&nbsp;</th>
689
                        <td>
617
                                <th>Total current checkouts allowed</th>
690
                            <select name="hold_fulfillment_policy">
618
                                <th>Total current on-site checkouts allowed</th>
619
                                <th>Maximum total holds allowed (count)</th>
620
                                <th>Hold policy</th>
621
                                <th>Hold pickup library match</th>
622
                                <th>Return policy</th>
623
                                <th class="noExport">Actions</th>
624
                            </tr>
625
                            [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
626
                            [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty', { want_rule => 1 } ) %]
627
                            [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
628
                            [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
629
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
630
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
631
                            [% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
632
                            <tr>
633
                                <td>
634
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
635
                                        <em>
636
                                        Defaults
637
                                        </em>
638
                                    [% ELSE %]
639
                                        Not set
640
                                    [% END %]
641
                                </td>
642
                                <td>
643
                                    <input type="text" name="patron_maxissueqty" size="9" value="[% patron_maxissueqty.rule_value | html %]" placeholder="Unlimited"/>
644
                                </td>
645
                                <td>
646
                                    <input type="text" name="patron_maxonsiteissueqty" size="9" value="[% patron_maxonsiteissueqty.rule_value | html %]" placeholder="Unlimited"/>
647
                                </td>
648
                                <td>
649
                                    <input name="max_holds" size="9" value="[% rule_value.rule_value | html %]" placeholder="Unlimited"/>
650
                                </td>
651
                                <td>
652
                                    <select name="holdallowed">
653
                                        <option value="">
654
                                            Not set
655
                                        </option>
691
656
692
                                <option value="">
657
                                        [% IF holdallowed.rule_value == 'from_any_library' %]
693
                                    Not set
658
                                            <option value="from_any_library" selected="selected">
694
                                </option>
659
                                        [% ELSE %]
660
                                            <option value="from_any_library">
661
                                        [% END %]
662
                                            From any library
663
                                        </option>
695
664
696
                                [% IF hold_fulfillment_policy.rule_value == 'any' %]
665
                                        [% IF holdallowed.rule_value == 'from_local_hold_group' %]
697
                                    <option value="any" selected="selected">
666
                                        <option value="from_local_hold_group" selected="selected">
698
                                        any library
667
                                        [% ELSE %]
699
                                    </option>
668
                                        <option value="from_local_hold_group">
700
                                [% ELSE %]
669
                                        [% END %]
701
                                    <option value="any">
670
                                            From local hold group
702
                                        any library
671
                                        </option>
703
                                    </option>
704
                                [% END %]
705
672
706
                                [% IF hold_fulfillment_policy.rule_value == 'holdgroup' %]
673
                                        [% IF holdallowed.rule_value == 'from_home_library' %]
707
                                    <option value="holdgroup" selected="selected">
674
                                            <option value="from_home_library" selected="selected">
708
                                        item's hold group
675
                                        [% ELSE %]
709
                                    </option>
676
                                            <option value="from_home_library">
710
                                [% ELSE %]
677
                                        [% END %]
711
                                    <option value="holdgroup">
678
                                            From home library
712
                                        item's hold group
679
                                        </option>
713
                                    </option>
714
                                [% END %]
715
680
716
                                [% IF hold_fulfillment_policy.rule_value == 'patrongroup' %]
681
                                        [% IF holdallowed.rule_value == 'not_allowed' %]
717
                                    <option value="patrongroup" selected="selected">
682
                                            <option value="not_allowed" selected="selected">
718
                                        patron's hold group
683
                                        [% ELSE %]
719
                                    </option>
684
                                            <option value="not_allowed">
720
                                [% ELSE %]
685
                                        [% END %]
721
                                    <option value="patrongroup">
686
                                            No holds allowed
722
                                        patron's hold group
687
                                        </option>
723
                                    </option>
688
                                    </select>
724
                                [% END %]
689
                                </td>
690
                                <td>
691
                                    <select name="hold_fulfillment_policy">
725
692
726
                                [% IF hold_fulfillment_policy.rule_value == 'homebranch' %]
693
                                        <option value="">
727
                                    <option value="homebranch" selected="selected">
694
                                            Not set
728
                                        item's home library
695
                                        </option>
729
                                    </option>
730
                                [% ELSE %]
731
                                    <option value="homebranch">
732
                                        item's home library
733
                                    </option>
734
                                [% END %]
735
696
736
                                [% IF hold_fulfillment_policy.rule_value == 'holdingbranch' %]
697
                                        [% IF hold_fulfillment_policy.rule_value == 'any' %]
737
                                    <option value="holdingbranch" selected="selected">
698
                                            <option value="any" selected="selected">
738
                                        item's holding library
699
                                                any library
739
                                    </option>
700
                                            </option>
740
                                [% ELSE %]
701
                                        [% ELSE %]
741
                                    <option value="holdingbranch">
702
                                            <option value="any">
742
                                        item's holding library
703
                                                any library
743
                                    </option>
704
                                            </option>
744
                                [% END %]
705
                                        [% END %]
745
                            </select>
746
                        </td>
747
                        <td>
748
                            <select name="returnbranch">
749
706
750
                                <option value="">
707
                                        [% IF hold_fulfillment_policy.rule_value == 'holdgroup' %]
751
                                    Not set
708
                                            <option value="holdgroup" selected="selected">
752
                                </option>
709
                                                item's hold group
710
                                            </option>
711
                                        [% ELSE %]
712
                                            <option value="holdgroup">
713
                                                item's hold group
714
                                            </option>
715
                                        [% END %]
753
716
754
                                [% IF returnbranch.rule_value == 'homebranch' %]
717
                                        [% IF hold_fulfillment_policy.rule_value == 'patrongroup' %]
755
                                <option value="homebranch" selected="selected">
718
                                            <option value="patrongroup" selected="selected">
756
                                [% ELSE %]
719
                                                patron's hold group
757
                                <option value="homebranch">
720
                                            </option>
758
                                [% END %]
721
                                        [% ELSE %]
759
                                    Item returns home
722
                                            <option value="patrongroup">
760
                                </option>
723
                                                patron's hold group
761
                                [% IF returnbranch.rule_value == 'holdingbranch' %]
724
                                            </option>
762
                                <option value="holdingbranch" selected="selected">
725
                                        [% END %]
763
                                [% ELSE %]
764
                                <option value="holdingbranch">
765
                                [% END %]
766
                                    Item returns to issuing library
767
                                </option>
768
                                [% IF returnbranch.rule_value == 'noreturn' %]
769
                                <option value="noreturn" selected="selected">
770
                                [% ELSE %]
771
                                <option value="noreturn">
772
                                [% END %]
773
                                    Item floats
774
                                </option>
775
                            </select>
776
                        </td>
777
                        <td class="actions">
778
                            <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
779
                            [% IF ( default_checkout_hold_and_return_policy ) %]
780
                                <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>
781
                            [% END %]
782
                        </td>
783
                    </tr>
784
                </table>
785
            </form>
786
        </div><!-- /.page-section -->
787
    </div>
788
    [% IF ( show_branch_cat_rule_form ) %]
789
    <div id="holds-policy-by-patron-category" class="container">
790
    <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
791
        <div class="page-section">
792
            <p>For this library, you can specify the maximum number of loans that
793
                a patron of a given category can make, regardless of the item type.
794
            </p>
795
            <p>If the total amount loanable for a given patron category is left blank,
796
               no limit applies, except possibly for a limit you define for a specific item type.
797
            </p>
798
            <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
799
                <input type="hidden" name="op" value="add-branch-cat" />
800
                <input type="hidden" name="branch" value="[% current_branch | html %]"/>
801
                <table>
802
                    <tr>
803
                        <th>Patron category</th>
804
                        <th>Total current checkouts allowed</th>
805
                        <th>Total current on-site checkouts allowed</th>
806
                        <th>Total holds allowed</th>
807
                        <th>&nbsp;</th>
808
                    </tr>
809
                    [% FOREACH c IN categorycodes %]
810
                        [% NEXT UNLESS c %]
811
                        [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
812
                        [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
813
                        [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
814
726
815
                        [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
727
                                        [% IF hold_fulfillment_policy.rule_value == 'homebranch' %]
816
                        <tr>
728
                                            <option value="homebranch" selected="selected">
817
                            <td>
729
                                                item's home library
818
                                [% IF c == undef %]
730
                                            </option>
819
                                    <em>Default</em>
731
                                        [% ELSE %]
820
                                [% ELSE %]
732
                                            <option value="homebranch">
821
                                    [% Categories.GetName(c) | html %]
733
                                                item's home library
822
                                [% END %]
734
                                            </option>
823
                            </td>
735
                                        [% END %]
824
                            <td>
825
                                [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
826
                                    [% patron_maxissueqty | html %]
827
                                [% ELSE %]
828
                                    <span>Unlimited</span>
829
                                [% END %]
830
                            </td>
831
                            <td>
832
                                [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
833
                                    [% patron_maxonsiteissueqty | html %]
834
                                [% ELSE %]
835
                                    <span>Unlimited</span>
836
                                [% END %]
837
                            </td>
838
                            <td>
839
                                [% IF max_holds.defined && max_holds != '' %]
840
                                    [% max_holds | html %]
841
                                [% ELSE %]
842
                                    <span>Unlimited</span>
843
                                [% END %]
844
                            </td>
845
736
846
                            <td class="actions">
737
                                        [% IF hold_fulfillment_policy.rule_value == 'holdingbranch' %]
847
                                <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>
738
                                            <option value="holdingbranch" selected="selected">
848
                            </td>
739
                                                item's holding library
849
                        </tr>
740
                                            </option>
850
                        [% END %]
741
                                        [% ELSE %]
851
                    [% END %]
742
                                            <option value="holdingbranch">
852
                    <tr>
743
                                                item's holding library
853
                        <td>
744
                                            </option>
854
                            <select name="categorycode">
745
                                        [% END %]
855
                            [% FOREACH patron_category IN patron_categories%]
746
                                    </select>
856
                                <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
747
                                </td>
857
                            [% END %]
748
                                <td>
858
                            </select>
749
                                    <select name="returnbranch">
859
                        </td>
750
860
                        <td><input name="patron_maxissueqty" size="3" type="text" /></td>
751
                                        <option value="">
861
                        <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
752
                                            Not set
862
                        <td><input name="max_holds" size="3" type="text" /></td>
753
                                        </option>
863
                        <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
864
                    </tr>
865
                </table>
866
            </form>
867
        </div><!-- ./page-section -->
868
    </div>
869
    [% END %]
870
754
871
    <div id="waiting-hold-cancel-category" class="container">
755
                                        [% IF returnbranch.rule_value == 'homebranch' %]
872
    [% IF humanbranch %]
756
                                        <option value="homebranch" selected="selected">
873
        <h3>Waiting hold cancellation policy for [% Branches.GetName( humanbranch ) | html %]</h3>
757
                                        [% ELSE %]
874
    [% ELSE %]
758
                                        <option value="homebranch">
875
        <h3>Default waiting hold cancellation policy</h3>
759
                                        [% END %]
876
    [% END %]
760
                                            Item returns home
877
        <div class="page-section">
761
                                        </option>
878
            <p>Specify if waiting holds can be cancelled for a given patron category.</p>
762
                                        [% IF returnbranch.rule_value == 'holdingbranch' %]
879
            <form id="set-waiting-hold-cancellation" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
763
                                        <option value="holdingbranch" selected="selected">
880
                <input type="hidden" name="op" value="set-waiting-hold-cancellation" />
764
                                        [% ELSE %]
881
                <input type="hidden" name="branch" value="[% current_branch | html %]"/>
765
                                        <option value="holdingbranch">
882
                <table>
766
                                        [% END %]
883
                    <tr>
767
                                            Item returns to issuing library
884
                        <th>Patron category</th>
768
                                        </option>
885
                        <th>Item type</th>
769
                                        [% IF returnbranch.rule_value == 'noreturn' %]
886
                        <th>Cancellation allowed</th>
770
                                        <option value="noreturn" selected="selected">
887
                        <th>&nbsp;</th>
771
                                        [% ELSE %]
888
                    </tr>
772
                                        <option value="noreturn">
889
                    [% FOREACH c IN categorycodes %]
773
                                        [% END %]
890
                        [% SET c = '*' UNLESS c.defined AND c != '' %]
774
                                            Item floats
891
                        [% FOREACH i IN itemtypes %]
775
                                        </option>
892
                            [% SET i = '*' UNLESS i.defined AND i != '' %]
776
                                    </select>
777
                                </td>
778
                                <td class="actions">
779
                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
780
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
781
                                        <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>
782
                                    [% END %]
783
                                </td>
784
                            </tr>
785
                        </table>
786
                    </form>
787
                </div>
893
788
894
                            [% SET waiting_hold_cancellation = CirculationRules.Search( current_branch, c, i, 'waiting_hold_cancellation' ) %]
789
                [% IF ( show_branch_cat_rule_form ) %]
790
                <div id="holds-policy-by-patron-category" class="page-section">
791
                    <h2>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h2>
792
                    <p>For this library, you can specify the maximum number of loans that
793
                        a patron of a given category can make, regardless of the item type.
794
                    </p>
795
                    <p>If the total amount loanable for a given patron category is left blank,
796
                       no limit applies, except possibly for a limit you define for a specific item type.
797
                    </p>
798
                    <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
799
                        <input type="hidden" name="op" value="add-branch-cat" />
800
                        <input type="hidden" name="branch" value="[% current_branch | html %]"/>
801
                        <table>
802
                            <tr>
803
                                <th>Patron category</th>
804
                                <th>Total current checkouts allowed</th>
805
                                <th>Total current on-site checkouts allowed</th>
806
                                <th>Total holds allowed</th>
807
                                <th>&nbsp;</th>
808
                            </tr>
809
                            [% FOREACH c IN categorycodes %]
810
                                [% NEXT UNLESS c %]
811
                                [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
812
                                [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
813
                                [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
895
814
896
                            [% IF ( waiting_hold_cancellation.defined && waiting_hold_cancellation != '' ) %]
815
                                [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
897
                                <tr>
816
                                <tr>
898
                                    <td>
817
                                    <td>
899
                                        [% IF c == '*' %]
818
                                        [% IF c == undef %]
900
                                            <em>All</em>
819
                                            <em>Default</em>
901
                                        [% ELSE %]
820
                                        [% ELSE %]
902
                                            [% Categories.GetName(c) | html %]
821
                                            [% Categories.GetName(c) | html %]
903
                                        [% END %]
822
                                        [% END %]
904
                                    </td>
823
                                    </td>
905
                                    <td>
824
                                    <td>
906
                                        [% IF i == '*' %]
825
                                        [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
907
                                            <em>All</em>
826
                                            [% patron_maxissueqty | html %]
908
                                        [% ELSE %]
827
                                        [% ELSE %]
909
                                            [% ItemTypes.GetDescription(i,1) | html %]
828
                                            <span>Unlimited</span>
910
                                        [% END %]
829
                                        [% END %]
911
                                    </td>
830
                                    </td>
912
                                    <td>
831
                                    <td>
913
                                        [% IF waiting_hold_cancellation %]
832
                                        [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
914
                                            <span>Yes</span>
833
                                            [% patron_maxonsiteissueqty | html %]
915
                                        [% ELSE %]
834
                                        [% ELSE %]
916
                                            <span>No</span>
835
                                            <span>Unlimited</span>
917
                                        [% END %]
836
                                        [% END %]
918
                                    </td>
837
                                    </td>
838
                                    <td>
839
                                        [% IF max_holds.defined && max_holds != '' %]
840
                                            [% max_holds | html %]
841
                                        [% ELSE %]
842
                                            <span>Unlimited</span>
843
                                        [% END %]
844
                                    </td>
845
919
                                    <td class="actions">
846
                                    <td class="actions">
920
                                        <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-waiting-hold-cancellation&amp;waiting_hold_cancellation_category=[% c | uri %]&amp;waiting_hold_cancellation_itemtype=[% i | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
847
                                        <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>
921
                                    </td>
848
                                    </td>
922
                                </tr>
849
                                </tr>
850
                                [% END %]
923
                            [% END %]
851
                            [% END %]
924
                        [% END %]
852
                            <tr>
925
                    [% END %]
853
                                <td>
926
                    <tr>
854
                                    <select name="categorycode">
927
                        <td>
855
                                    [% FOREACH patron_category IN patron_categories%]
928
                            <select name="waiting_hold_cancellation_category" id="waiting_hold_cancellation_category">
856
                                        <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
929
                                <option value="*">All</option>
857
                                    [% END %]
930
                            [% FOREACH patron_category IN patron_categories %]
858
                                    </select>
931
                                <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
859
                                </td>
932
                            [% END %]
860
                                <td><input name="patron_maxissueqty" size="3" type="text" /></td>
933
                            </select>
861
                                <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
934
                        </td>
862
                                <td><input name="max_holds" size="3" type="text" /></td>
935
                        <td>
863
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
936
                            <select name="waiting_hold_cancellation_itemtype" id="waiting_hold_cancellation_itemtype">
864
                            </tr>
937
                                <option value="*">All</option>
865
                        </table>
938
                            [% FOREACH itemtype IN itemtypeloop %]
866
                    </form>
939
                                <option value="[% itemtype.itemtype | html %]">[% ItemTypes.GetDescription(itemtype.itemtype) | html %]</option>
867
                </div>
940
                            [% END %]
941
                            </select>
942
                        </td>
943
                        <td>
944
                            <select name="waiting_hold_cancellation_policy" id="waiting_hold_cancellation_policy">
945
                                <option value="0" selected>No</option>
946
                                <option value="1">Yes</option>
947
                            </select>
948
                        </td>
949
                        <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
950
                    </tr>
951
                </table>
952
            </form>
953
        </div><!-- /.page-section -->
954
    </div>
955
956
[% IF Koha.Preference('ArticleRequests') %]
957
    <div id="open-article-requests-limit-patron-category" class="container">
958
    [% IF humanbranch %]
959
        <h3>Daily open article requests limit for [% Branches.GetName( humanbranch ) | html %]</h3>
960
    [% ELSE %]
961
        <h3>Default open article requests limit</h3>
962
    [% END %]
963
        <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p>
964
        <form id="set-article-requests-daily-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
965
            <input type="hidden" name="op" value="add-open-article-requests-limit" />
966
            <input type="hidden" name="branch" value="[% current_branch | html %]"/>
967
            <table>
968
                <tr>
969
                    <th>Patron category</th>
970
                    <th>Total article requests</th>
971
                    <th>&nbsp;</th>
972
                </tr>
973
                [% FOREACH c IN categorycodes %]
974
                    [% NEXT UNLESS c %]
975
                    [% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %]
976
977
                    [% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %]
978
                    <tr>
979
                        <td>
980
                            [% Categories.GetName(c) | html %]
981
                        </td>
982
                        <td>
983
                            [% IF open_article_requests_limit.defined && open_article_requests_limit != '' %]
984
                                [% open_article_requests_limit | html %]
985
                            [% ELSE %]
986
                                <span>Unlimited</span>
987
                            [% END %]
988
                        </td>
989
990
                        <td class="actions">
991
                            <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-open-article-requests-limit&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
992
                        </td>
993
                    </tr>
994
                    [% END %]
995
                [% END %]
868
                [% END %]
996
                <tr>
997
                    <td>
998
                        <select name="categorycode">
999
                        [% FOREACH patron_category IN patron_categories %]
1000
                            <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1001
                        [% END %]
1002
                        </select>
1003
                    </td>
1004
                    <td><input name="open_article_requests_limit" size="3" type="text" /></td>
1005
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1006
                </tr>
1007
            </table>
1008
        </form>
1009
    </div>
1010
    <div id="article-request-fee-category" class="container">
1011
    [% IF humanbranch %]
1012
        <h3>Article request fees for [% Branches.GetName( humanbranch ) | html %]</h3>
1013
    [% ELSE %]
1014
        <h3>Default article request fees</h3>
1015
    [% END %]
1016
        <p>Specify the article request fee for a given patron category.</p>
1017
        <form id="set-article-request-fee" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1018
            <input type="hidden" name="op" value="set-article-request-fee" />
1019
            <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1020
            <table>
1021
                <tr>
1022
                    <th>Patron category</th>
1023
                    <th>Fee</th>
1024
                    <th>&nbsp;</th>
1025
                </tr>
1026
                [% FOREACH c IN categorycodes %]
1027
                    [% SET c = '*' UNLESS c.defined AND c != '' %]
1028
1029
                    [% SET article_request_fee = CirculationRules.Search( current_branch, c, undef, 'article_request_fee' ) %]
1030
869
1031
                    [% IF ( article_request_fee.defined && article_request_fee != '' ) %]
870
                <div id="waiting-hold-cancel-category" class="page-section">
1032
                    <tr>
871
                [% IF humanbranch %]
1033
                        <td>
872
                    <h2>Waiting hold cancellation policy for [% Branches.GetName( humanbranch ) | html %]</h2>
1034
                            [% IF c == '*' %]
873
                [% ELSE %]
1035
                                <em>All</em>
874
                    <h2>Default waiting hold cancellation policy</h2>
1036
                            [% ELSE %]
1037
                                [% Categories.GetName(c) | html %]
1038
                            [% END %]
1039
                        </td>
1040
                        <td>
1041
                            [% IF article_request_fee.defined && article_request_fee != '' %]
1042
                                [% article_request_fee | html %]
1043
                            [% ELSE %]
1044
                                <span>0</span>
1045
                            [% END %]
1046
                        </td>
1047
                        <td class="actions">
1048
                            <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-article-request-fee&amp;article_request_fee_category=[% c | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
1049
                        </td>
1050
                    </tr>
1051
                    [% END %]
1052
                [% END %]
875
                [% END %]
1053
                <tr>
876
                    <p>Specify if waiting holds can be cancelled for a given patron category.</p>
1054
                    <td>
877
                    <form id="set-waiting-hold-cancellation" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1055
                        <select name="article_request_fee_category" id="article_request_fee_category">
878
                        <input type="hidden" name="op" value="set-waiting-hold-cancellation" />
1056
                            <option value="*">All</option>
879
                        <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1057
                        [% FOREACH patron_category IN patron_categories%]
880
                        <table>
1058
                            <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
881
                            <tr>
1059
                        [% END %]
882
                                <th>Patron category</th>
1060
                        </select>
883
                                <th>Item type</th>
1061
                    </td>
884
                                <th>Cancellation allowed</th>
1062
                    <td><input name="article_request_fee" size="3" type="text" /></td>
885
                                <th>&nbsp;</th>
1063
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
886
                            </tr>
1064
                </tr>
887
                            [% FOREACH c IN categorycodes %]
1065
            </table>
888
                                [% SET c = '*' UNLESS c.defined AND c != '' %]
1066
        </form>
889
                                [% FOREACH i IN itemtypes %]
1067
    </div>
890
                                    [% SET i = '*' UNLESS i.defined AND i != '' %]
1068
891
1069
[% END %]
892
                                    [% SET waiting_hold_cancellation = CirculationRules.Search( current_branch, c, i, 'waiting_hold_cancellation' ) %]
1070
893
1071
    <div id="refund-lost-item-fee-on-return" class="container">
894
                                    [% IF ( waiting_hold_cancellation.defined && waiting_hold_cancellation != '' ) %]
1072
        [% IF current_branch == '*' %]
895
                                        <tr>
1073
            <h3>Default lost item fee refund on return policy</h3>
896
                                            <td>
1074
        [% ELSE %]
897
                                                [% IF c == '*' %]
1075
            <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h3>
898
                                                    <em>All</em>
1076
        [% END %]
899
                                                [% ELSE %]
1077
        <div class="page-section">
900
                                                    [% Categories.GetName(c) | html %]
1078
            <p>Specify the default policy for lost item fees on return.</p>
901
                                                [% END %]
1079
            <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
902
                                            </td>
1080
                <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
903
                                            <td>
1081
                <input type="hidden" name="branch" value="[% current_branch | html %]" />
904
                                                [% IF i == '*' %]
1082
                <table>
905
                                                    <em>All</em>
1083
                    <tr>
906
                                                [% ELSE %]
1084
                        <th>Refund lost item replacement fee</th>
907
                                                    [% ItemTypes.GetDescription(i,1) | html %]
1085
                        <th>Refund lost item processing fee</th>
908
                                                [% END %]
1086
                        <th>&nbsp;</th>
909
                                            </td>
1087
                    </tr>
910
                                            <td>
1088
                    <tr>
911
                                                [% IF waiting_hold_cancellation %]
1089
                        <td>
912
                                                    <span>Yes</span>
1090
                            <select name="lostreturn">
913
                                                [% ELSE %]
1091
                              [%# Default branch %]
914
                                                    <span>No</span>
1092
                              [% IF ( current_branch == '*' ) %]
915
                                                [% END %]
1093
                                [% IF ( defaultRefundRule == 'refund' ) %]
916
                                            </td>
1094
                                <option value="refund" selected="selected">Refund lost item charge</option>
917
                                            <td class="actions">
1095
                                <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
918
                                                <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-waiting-hold-cancellation&amp;waiting_hold_cancellation_category=[% c | uri %]&amp;waiting_hold_cancellation_itemtype=[% i | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
1096
                                <option value="charge">Refund lost item charge and charge new overdue fine</option>
919
                                            </td>
1097
                                <option value="restore">Refund lost item charge and restore overdue fine</option>
920
                                        </tr>
1098
                                <option value="0">Leave lost item charge</option>
1099
                                [% ELSIF ( defaultRefundRule == 'refund_unpaid' ) %]
1100
                                <option value="refund">Refund lost item charge</option>
1101
                                <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1102
                                <option value="charge">Refund lost item charge and charge new overdue fine</option>
1103
                                <option value="restore">Refund lost item charge and restore overdue fine</option>
1104
                                <option value="0">Leave lost item charge</option>
1105
                                [% ELSIF ( defaultRefundRule == 'charge' ) %]
1106
                                <option value="refund">Refund lost item charge</option>
1107
                                <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1108
                                <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1109
                                <option value="restore">Refund lost item charge and restore overdue fine</option>
1110
                                <option value="0">Leave lost item charge</option>
1111
                                [% ELSIF ( defaultRefundRule == 'restore' ) %]
1112
                                <option value="refund">Refund lost item charge</option>
1113
                                <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1114
                                <option value="charge">Refund lost item charge and charge new overdue fine</option>
1115
                                <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
1116
                                <option value="0">Leave lost item charge</option>
1117
                                [% ELSIF ( defaultRefundRule == 0 ) %]
1118
                                <option value="refund">Refund lost item charge</option>
1119
                                <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1120
                                <option value="charge">Refund lost item charge and charge new overdue fine</option>
1121
                                <option value="restore">Refund lost item charge and restore overdue fine</option>
1122
                                <option value="0" selected="selected">Leave lost item charge</option>
1123
                                [% ELSE %]
1124
                                <option value="refund">Refund lost item charge</option>
1125
                                <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1126
                                <option value="charge">Refund lost item charge and charge new overdue fine</option>
1127
                                <option value="restore">Refund lost item charge and restore overdue fine</option>
1128
                                <option value="0">Leave lost item charge</option>
1129
                                [% END %]
1130
                              [% ELSE %]
1131
                              [%# Branch-specific %]
1132
                                [% IF ( not refundLostItemFeeRule ) %]
1133
                                    <option value="*" selected="selected">
1134
                                [% ELSE %]
1135
                                    <option value="*">
1136
                                [% END %]
1137
                                  [% IF defaultRefundRule == 'refund' %]
1138
                                    <span>Use default (Refund lost item charge)</span>
1139
                                  [% ELSIF defaultRefundRule == 'refund_unpaid' %]
1140
                                    Use default (Refund lost item charge (only if unpaid))
1141
                                  [% ELSIF defaultRefundRule == 'charge' %]
1142
                                    <span>Use default (Refund lost item charge and charge new overdue fine)</span>
1143
                                  [% ELSIF defaultRefundRule == 'restore' %]
1144
                                    <span>Use default (Refund lost item charge and restore overdue fine)</span>
1145
                                  [% ELSE %]
1146
                                    <span>Use default (Leave lost item charge)</span>
1147
                                  [% END %]
1148
                                    </option>
1149
                                [% IF ( not refundLostItemFeeRule ) %]
1150
                                    <option value="refund">Refund lost item charge</option>
1151
                                    <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1152
                                    <option value="charge">Refund lost item charge and charge new overdue fine</option>
1153
                                    <option value="restore">Refund lost item charge and restore overdue fine</option>
1154
                                    <option value="0">Leave lost item charge</option>
1155
                                [% ELSE %]
1156
                                    [% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %]
1157
                                    <option value="refund" selected="selected">Refund lost item charge</option>
1158
                                    <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1159
                                    <option value="charge">Refund lost item charge and charge new overdue fine</option>
1160
                                    <option value="restore">Refund lost item charge and restore overdue fine</option>
1161
                                    <option value="0">Leave lost item charge</option>
1162
                                    [% ELSIF ( refundLostItemFeeRule.rule_value == 'refund_unpaid' ) %]
1163
                                    <option value="refund">Refund lost item charge</option>
1164
                                    <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1165
                                    <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1166
                                    <option value="restore">Refund lost item charge and restore overdue fine</option>
1167
                                    <option value="0">Leave lost item charge</option>
1168
                                    [% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %]
1169
                                    <option value="refund">Refund lost item charge</option>
1170
                                    <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1171
                                    <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1172
                                    <option value="restore">Refund lost item charge and restore overdue fine</option>
1173
                                    <option value="0">Leave lost item charge</option>
1174
                                    [% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %]
1175
                                    <option value="refund">Refund lost item charge</option>
1176
                                    <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1177
                                    <option value="charge">Refund lost item charge and charge new overdue fine</option>
1178
                                    <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
1179
                                    <option value="0">Leave lost item charge</option>
1180
                                    [% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %]
1181
                                    <option value="refund">Refund lost item charge</option>
1182
                                    <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1183
                                    <option value="charge">Refund lost item charge and charge new overdue fine</option>
1184
                                    <option value="restore">Refund lost item charge and restore overdue fine</option>
1185
                                    <option value="0" selected="selected">Leave lost item charge</option>
1186
                                    [% END %]
921
                                    [% END %]
1187
                                [% END %]
922
                                [% END %]
1188
                              [% END %]
923
                            [% END %]
1189
                            </select>
924
                            <tr>
1190
                        </td>
925
                                <td>
1191
                        <td>
926
                                    <select name="waiting_hold_cancellation_category" id="waiting_hold_cancellation_category">
1192
                            <select name="processingreturn">
927
                                        <option value="*">All</option>
1193
                              [%# Default branch %]
928
                                    [% FOREACH patron_category IN patron_categories %]
1194
                              [% IF ( current_branch == '*' ) %]
929
                                        <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1195
                                [% IF ( defaultProcessingRefundRule == 'refund' ) %]
1196
                                <option value="refund" selected="selected">Refund lost item processing charge</option>
1197
                                <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1198
                                <option value="0">Leave lost item processing charge</option>
1199
                                [% ELSIF ( defaultProcessingRefundRule == 'refund_unpaid' ) %]
1200
                                <option value="refund">Refund lost item charge</option>
1201
                                <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1202
                                <option value="0">Leave lost item processing charge</option>
1203
                                [% ELSIF ( defaultProcessingRefundRule == 0 ) %]
1204
                                <option value="refund">Refund lost item processing charge</option>
1205
                                <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1206
                                <option value="0" selected="selected">Leave lost item processing charge</option>
1207
                                [% ELSE %]
1208
                                <option value="refund">Refund lost item processing charge</option>
1209
                                <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1210
                                <option value="0">Leave lost item processing charge</option>
1211
                                [% END %]
1212
                              [% ELSE %]
1213
                              [%# Branch-specific %]
1214
                                [% IF ( not refundProcessingFeeRule ) %]
1215
                                    <option value="*" selected="selected">
1216
                                [% ELSE %]
1217
                                    <option value="*">
1218
                                [% END %]
1219
                                  [% IF defaultProcessingRefundRule == 'refund' %]
1220
                                    <span>Use default (Refund lost item processing charge)</span>
1221
                                  [% ELSIF defaultProcessingRefundRule == 'refund_unpaid' %]
1222
                                    Use default (Refund lost item processing charge (only if unpaid))
1223
                                  [% ELSE %]
1224
                                    <span>Use default (Leave lost item processing charge)</span>
1225
                                  [% END %]
1226
                                    </option>
1227
                                [% IF ( not refundProcessingFeeRule ) %]
1228
                                    <option value="refund">Refund lost item processing charge</option>
1229
                                    <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1230
                                    <option value="0">Leave lost item processing charge</option>
1231
                                [% ELSE %]
1232
                                    [% IF ( refundProcessingFeeRule.rule_value == 'refund' ) %]
1233
                                    <option value="refund" selected="selected">Refund lost item processing charge</option>
1234
                                    <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1235
                                    <option value="0">Leave lost item processing charge</option>
1236
                                    [% ELSIF ( refundProcessingFeeRule.rule_value == 'refund_unpaid' ) %]
1237
                                    <option value="refund">Refund lost item processing charge</option>
1238
                                    <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1239
                                    <option value="0">Leave lost item processing charge</option>
1240
                                    [% ELSIF ( refundProcessingFeeRule.rule_value == 0 ) %]
1241
                                    <option value="refund">Refund lost item processing charge</option>
1242
                                    <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1243
                                    <option value="0" selected="selected">Leave lost item processing charge</option>
1244
                                    [% END %]
930
                                    [% END %]
1245
                                [% END %]
931
                                    </select>
1246
                              [% END %]
932
                                </td>
1247
                            </select>
933
                                <td>
1248
                        </td>
934
                                    <select name="waiting_hold_cancellation_itemtype" id="waiting_hold_cancellation_itemtype">
1249
                        <td class="actions">
935
                                        <option value="*">All</option>
1250
                            <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
936
                                    [% FOREACH itemtype IN itemtypeloop %]
1251
                        </td>
937
                                        <option value="[% itemtype.itemtype | html %]">[% ItemTypes.GetDescription(itemtype.itemtype) | html %]</option>
1252
                    </tr>
938
                                    [% END %]
1253
                </table>
939
                                    </select>
1254
            </form>
940
                                </td>
1255
        </div><!-- /.page-section -->
941
                                <td>
1256
    </div>
942
                                    <select name="waiting_hold_cancellation_policy" id="waiting_hold_cancellation_policy">
1257
943
                                        <option value="0" selected>No</option>
1258
    <div id="holds-policy-by-item-type" class="container">
944
                                        <option value="1">Yes</option>
1259
    <h3>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h3>
945
                                    </select>
1260
        <div class="page-section">
946
                                </td>
1261
            <p>
947
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1262
                For this library, you can edit rules for given itemtypes, regardless of the patron's category.
948
                            </tr>
1263
            </p>
949
                        </table>
1264
            <p>
950
                    </form>
1265
                Currently, this means hold policies. The various policies have the following effects:
951
                </div>
1266
            </p>
1267
            <ul>
1268
                <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
1269
                <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>
1270
                <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
1271
                <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
1272
            </ul>
1273
1274
            <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</p>
1275
            <p><strong>Important:</strong></p>
1276
952
1277
            <ul>
953
                [% IF Koha.Preference('ArticleRequests') %]
1278
                <li>The hold 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>.</li>
954
                <div id="open-article-requests-limit-patron-category" class="page-section">
1279
                <li>The return policy is applied based on the CircControlReturnsBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CircControlReturnsBranch">[% Koha.Preference('CircControlReturnsBranch') | html %]</a>.</li>
955
                [% IF humanbranch %]
1280
            </ul>
956
                    <h2>Daily open article requests limit for [% Branches.GetName( humanbranch ) | html %]</h2>
957
                [% ELSE %]
958
                    <h2>Default open article requests limit</h2>
959
                [% END %]
960
                    <p>Specify the maximum number simultaneous current article requests a patron of a given category can have.</p>
961
                    <form id="set-article-requests-daily-limit" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
962
                        <input type="hidden" name="op" value="add-open-article-requests-limit" />
963
                        <input type="hidden" name="branch" value="[% current_branch | html %]"/>
964
                        <table>
965
                            <tr>
966
                                <th>Patron category</th>
967
                                <th>Total article requests</th>
968
                                <th>&nbsp;</th>
969
                            </tr>
970
                            [% FOREACH c IN categorycodes %]
971
                                [% NEXT UNLESS c %]
972
                                [% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %]
1281
973
1282
            <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
974
                                [% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %]
1283
                <input type="hidden" name="op" value="add-branch-item" />
975
                                <tr>
1284
                <input type="hidden" name="branch" value="[% current_branch | html %]"/>
976
                                    <td>
1285
                <table>
977
                                        [% Categories.GetName(c) | html %]
1286
                    <tr>
978
                                    </td>
1287
                        <th>Item type</th>
979
                                    <td>
1288
                        <th>Hold policy</th>
980
                                        [% IF open_article_requests_limit.defined && open_article_requests_limit != '' %]
1289
                        <th>Hold pickup library match</th>
981
                                            [% open_article_requests_limit | html %]
1290
                        <th>Return policy</th>
982
                                        [% ELSE %]
1291
                        <th>&nbsp;</th>
983
                                            <span>Unlimited</span>
1292
                    </tr>
984
                                        [% END %]
1293
                    [% FOREACH i IN itemtypeloop %]
985
                                    </td>
1294
                        [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1295
                        [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1296
                        [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1297
986
1298
                        [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
987
                                    <td class="actions">
988
                                        <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-open-article-requests-limit&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
989
                                    </td>
990
                                </tr>
991
                                [% END %]
992
                            [% END %]
1299
                            <tr>
993
                            <tr>
1300
                                <td>
994
                                <td>
1301
                                    [% i.translated_description | html %]
995
                                    <select name="categorycode">
996
                                    [% FOREACH patron_category IN patron_categories %]
997
                                        <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
998
                                    [% END %]
999
                                    </select>
1302
                                </td>
1000
                                </td>
1001
                                <td><input name="open_article_requests_limit" size="3" type="text" /></td>
1002
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1003
                            </tr>
1004
                        </table>
1005
                    </form>
1006
                </div>
1007
1008
                <div id="article-request-fee-category" class="page-section">
1009
                [% IF humanbranch %]
1010
                    <h2>Article request fees for [% Branches.GetName( humanbranch ) | html %]</h2>
1011
                [% ELSE %]
1012
                    <h2>Default article request fees</h2>
1013
                [% END %]
1014
                    <p>Specify the article request fee for a given patron category.</p>
1015
                    <form id="set-article-request-fee" method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1016
                        <input type="hidden" name="op" value="set-article-request-fee" />
1017
                        <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1018
                        <table>
1019
                            <tr>
1020
                                <th>Patron category</th>
1021
                                <th>Fee</th>
1022
                                <th>&nbsp;</th>
1023
                            </tr>
1024
                            [% FOREACH c IN categorycodes %]
1025
                                [% SET c = '*' UNLESS c.defined AND c != '' %]
1026
1027
                                [% SET article_request_fee = CirculationRules.Search( current_branch, c, undef, 'article_request_fee' ) %]
1028
1029
                                [% IF ( article_request_fee.defined && article_request_fee != '' ) %]
1030
                                <tr>
1031
                                    <td>
1032
                                        [% IF c == '*' %]
1033
                                            <em>All</em>
1034
                                        [% ELSE %]
1035
                                            [% Categories.GetName(c) | html %]
1036
                                        [% END %]
1037
                                    </td>
1038
                                    <td>
1039
                                        [% IF article_request_fee.defined && article_request_fee != '' %]
1040
                                            [% article_request_fee | html %]
1041
                                        [% ELSE %]
1042
                                            <span>0</span>
1043
                                        [% END %]
1044
                                    </td>
1045
                                    <td class="actions">
1046
                                        <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-article-request-fee&amp;article_request_fee_category=[% c | uri %]&amp;branch=[% current_branch | uri %]"><i class="fa fa-trash"></i> Delete</a>
1047
                                    </td>
1048
                                </tr>
1049
                                [% END %]
1050
                            [% END %]
1051
                            <tr>
1303
                                <td>
1052
                                <td>
1304
                                    [% IF holdallowed == 'from_any_library' %]
1053
                                    <select name="article_request_fee_category" id="article_request_fee_category">
1305
                                        <span>From any library</span>
1054
                                        <option value="*">All</option>
1306
                                    [% ELSIF holdallowed == 'from_local_hold_group' %]
1055
                                    [% FOREACH patron_category IN patron_categories%]
1307
                                        <span>From local hold group</span>
1056
                                        <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1308
                                    [% ELSIF holdallowed == 'from_home_library' %]
1309
                                        <span>From home library</span>
1310
                                    [% ELSE %]
1311
                                        <span>No holds allowed</span>
1312
                                    [% END %]
1057
                                    [% END %]
1058
                                    </select>
1313
                                </td>
1059
                                </td>
1060
                                <td><input name="article_request_fee" size="3" type="text" /></td>
1061
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1062
                            </tr>
1063
                        </table>
1064
                    </form>
1065
                </div>
1066
                [% END %]
1067
1068
                <div id="refund-lost-item-fee-on-return" class="page-section">
1069
                [% IF current_branch == '*' %]
1070
                    <h2>Default lost item fee refund on return policy</h2>
1071
                [% ELSE %]
1072
                    <h2>Lost item fee refund on return policy for [% Branches.GetName(current_branch) | html %]</h2>
1073
                [% END %]
1074
                    <p>Specify the default policy for lost item fees on return.</p>
1075
                    <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1076
                        <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
1077
                        <input type="hidden" name="branch" value="[% current_branch | html %]" />
1078
                        <table>
1079
                            <tr>
1080
                                <th>Refund lost item replacement fee</th>
1081
                                <th>Refund lost item processing fee</th>
1082
                                <th>&nbsp;</th>
1083
                            </tr>
1084
                            <tr>
1314
                                <td>
1085
                                <td>
1315
                                    [% IF hold_fulfillment_policy == 'any' %]
1086
                                    <select name="lostreturn">
1316
                                        <span>any library</span>
1087
                                      [%# Default branch %]
1317
                                    [% ELSIF hold_fulfillment_policy == 'homebranch' %]
1088
                                      [% IF ( current_branch == '*' ) %]
1318
                                        <span>item's home library</span>
1089
                                        [% IF ( defaultRefundRule == 'refund' ) %]
1319
                                    [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
1090
                                        <option value="refund" selected="selected">Refund lost item charge</option>
1320
                                        <span>item's hold group</span>
1091
                                        <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1321
                                    [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
1092
                                        <option value="charge">Refund lost item charge and charge new overdue fine</option>
1322
                                        <span>patron's hold group</span>
1093
                                        <option value="restore">Refund lost item charge and restore overdue fine</option>
1323
                                    [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
1094
                                        <option value="0">Leave lost item charge</option>
1324
                                        <span>item's holding library</span>
1095
                                        [% ELSIF ( defaultRefundRule == 'refund_unpaid' ) %]
1325
                                    [% END %]
1096
                                        <option value="refund">Refund lost item charge</option>
1097
                                        <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1098
                                        <option value="charge">Refund lost item charge and charge new overdue fine</option>
1099
                                        <option value="restore">Refund lost item charge and restore overdue fine</option>
1100
                                        <option value="0">Leave lost item charge</option>
1101
                                        [% ELSIF ( defaultRefundRule == 'charge' ) %]
1102
                                        <option value="refund">Refund lost item charge</option>
1103
                                        <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1104
                                        <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1105
                                        <option value="restore">Refund lost item charge and restore overdue fine</option>
1106
                                        <option value="0">Leave lost item charge</option>
1107
                                        [% ELSIF ( defaultRefundRule == 'restore' ) %]
1108
                                        <option value="refund">Refund lost item charge</option>
1109
                                        <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1110
                                        <option value="charge">Refund lost item charge and charge new overdue fine</option>
1111
                                        <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
1112
                                        <option value="0">Leave lost item charge</option>
1113
                                        [% ELSIF ( defaultRefundRule == 0 ) %]
1114
                                        <option value="refund">Refund lost item charge</option>
1115
                                        <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1116
                                        <option value="charge">Refund lost item charge and charge new overdue fine</option>
1117
                                        <option value="restore">Refund lost item charge and restore overdue fine</option>
1118
                                        <option value="0" selected="selected">Leave lost item charge</option>
1119
                                        [% ELSE %]
1120
                                        <option value="refund">Refund lost item charge</option>
1121
                                        <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1122
                                        <option value="charge">Refund lost item charge and charge new overdue fine</option>
1123
                                        <option value="restore">Refund lost item charge and restore overdue fine</option>
1124
                                        <option value="0">Leave lost item charge</option>
1125
                                        [% END %]
1126
                                      [% ELSE %]
1127
                                      [%# Branch-specific %]
1128
                                        [% IF ( not refundLostItemFeeRule ) %]
1129
                                            <option value="*" selected="selected">
1130
                                        [% ELSE %]
1131
                                            <option value="*">
1132
                                        [% END %]
1133
                                          [% IF defaultRefundRule == 'refund' %]
1134
                                            <span>Use default (Refund lost item charge)</span>
1135
                                          [% ELSIF defaultRefundRule == 'refund_unpaid' %]
1136
                                            Use default (Refund lost item charge (only if unpaid))
1137
                                          [% ELSIF defaultRefundRule == 'charge' %]
1138
                                            <span>Use default (Refund lost item charge and charge new overdue fine)</span>
1139
                                          [% ELSIF defaultRefundRule == 'restore' %]
1140
                                            <span>Use default (Refund lost item charge and restore overdue fine)</span>
1141
                                          [% ELSE %]
1142
                                            <span>Use default (Leave lost item charge)</span>
1143
                                          [% END %]
1144
                                            </option>
1145
                                        [% IF ( not refundLostItemFeeRule ) %]
1146
                                            <option value="refund">Refund lost item charge</option>
1147
                                            <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1148
                                            <option value="charge">Refund lost item charge and charge new overdue fine</option>
1149
                                            <option value="restore">Refund lost item charge and restore overdue fine</option>
1150
                                            <option value="0">Leave lost item charge</option>
1151
                                        [% ELSE %]
1152
                                            [% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %]
1153
                                            <option value="refund" selected="selected">Refund lost item charge</option>
1154
                                            <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1155
                                            <option value="charge">Refund lost item charge and charge new overdue fine</option>
1156
                                            <option value="restore">Refund lost item charge and restore overdue fine</option>
1157
                                            <option value="0">Leave lost item charge</option>
1158
                                            [% ELSIF ( refundLostItemFeeRule.rule_value == 'refund_unpaid' ) %]
1159
                                            <option value="refund">Refund lost item charge</option>
1160
                                            <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option>
1161
                                            <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1162
                                            <option value="restore">Refund lost item charge and restore overdue fine</option>
1163
                                            <option value="0">Leave lost item charge</option>
1164
                                            [% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %]
1165
                                            <option value="refund">Refund lost item charge</option>
1166
                                            <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1167
                                            <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option>
1168
                                            <option value="restore">Refund lost item charge and restore overdue fine</option>
1169
                                            <option value="0">Leave lost item charge</option>
1170
                                            [% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %]
1171
                                            <option value="refund">Refund lost item charge</option>
1172
                                            <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1173
                                            <option value="charge">Refund lost item charge and charge new overdue fine</option>
1174
                                            <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option>
1175
                                            <option value="0">Leave lost item charge</option>
1176
                                            [% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %]
1177
                                            <option value="refund">Refund lost item charge</option>
1178
                                            <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option>
1179
                                            <option value="charge">Refund lost item charge and charge new overdue fine</option>
1180
                                            <option value="restore">Refund lost item charge and restore overdue fine</option>
1181
                                            <option value="0" selected="selected">Leave lost item charge</option>
1182
                                            [% END %]
1183
                                        [% END %]
1184
                                      [% END %]
1185
                                    </select>
1326
                                </td>
1186
                                </td>
1327
                                <td>
1187
                                <td>
1328
                                    [% IF returnbranch == 'homebranch' %]
1188
                                    <select name="processingreturn">
1329
                                        <span>Item returns home</span>
1189
                                      [%# Default branch %]
1330
                                    [% ELSIF returnbranch == 'holdingbranch' %]
1190
                                      [% IF ( current_branch == '*' ) %]
1331
                                        <span>Item returns to issuing branch</span>
1191
                                        [% IF ( defaultProcessingRefundRule == 'refund' ) %]
1332
                                    [% ELSIF returnbranch == 'noreturn' %]
1192
                                        <option value="refund" selected="selected">Refund lost item processing charge</option>
1333
                                        <span>Item floats</span>
1193
                                        <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1334
                                    [% END %]
1194
                                        <option value="0">Leave lost item processing charge</option>
1195
                                        [% ELSIF ( defaultProcessingRefundRule == 'refund_unpaid' ) %]
1196
                                        <option value="refund">Refund lost item charge</option>
1197
                                        <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1198
                                        <option value="0">Leave lost item processing charge</option>
1199
                                        [% ELSIF ( defaultProcessingRefundRule == 0 ) %]
1200
                                        <option value="refund">Refund lost item processing charge</option>
1201
                                        <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1202
                                        <option value="0" selected="selected">Leave lost item processing charge</option>
1203
                                        [% ELSE %]
1204
                                        <option value="refund">Refund lost item processing charge</option>
1205
                                        <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1206
                                        <option value="0">Leave lost item processing charge</option>
1207
                                        [% END %]
1208
                                      [% ELSE %]
1209
                                      [%# Branch-specific %]
1210
                                        [% IF ( not refundProcessingFeeRule ) %]
1211
                                            <option value="*" selected="selected">
1212
                                        [% ELSE %]
1213
                                            <option value="*">
1214
                                        [% END %]
1215
                                          [% IF defaultProcessingRefundRule == 'refund' %]
1216
                                            <span>Use default (Refund lost item processing charge)</span>
1217
                                          [% ELSIF defaultProcessingRefundRule == 'refund_unpaid' %]
1218
                                            Use default (Refund lost item processing charge (only if unpaid))
1219
                                          [% ELSE %]
1220
                                            <span>Use default (Leave lost item processing charge)</span>
1221
                                          [% END %]
1222
                                            </option>
1223
                                        [% IF ( not refundProcessingFeeRule ) %]
1224
                                            <option value="refund">Refund lost item processing charge</option>
1225
                                            <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1226
                                            <option value="0">Leave lost item processing charge</option>
1227
                                        [% ELSE %]
1228
                                            [% IF ( refundProcessingFeeRule.rule_value == 'refund' ) %]
1229
                                            <option value="refund" selected="selected">Refund lost item processing charge</option>
1230
                                            <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1231
                                            <option value="0">Leave lost item processing charge</option>
1232
                                            [% ELSIF ( refundProcessingFeeRule.rule_value == 'refund_unpaid' ) %]
1233
                                            <option value="refund">Refund lost item processing charge</option>
1234
                                            <option value="refund_unpaid" selected="selected">Refund lost item processing charge (only if unpaid)</option>
1235
                                            <option value="0">Leave lost item processing charge</option>
1236
                                            [% ELSIF ( refundProcessingFeeRule.rule_value == 0 ) %]
1237
                                            <option value="refund">Refund lost item processing charge</option>
1238
                                            <option value="refund_unpaid">Refund lost item processing charge (only if unpaid)</option>
1239
                                            <option value="0" selected="selected">Leave lost item processing charge</option>
1240
                                            [% END %]
1241
                                        [% END %]
1242
                                      [% END %]
1243
                                    </select>
1335
                                </td>
1244
                                </td>
1336
                                <td class="actions">
1245
                                <td class="actions">
1337
                                    <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>
1246
                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
1338
                                </td>
1247
                                </td>
1339
                            </tr>
1248
                            </tr>
1340
                        [% END %]
1249
                        </table>
1341
                    [% END %]
1250
                    </form>
1342
                    <tr>
1251
                </div>
1343
                        <td>
1252
1344
                            <select name="itemtype">
1253
                <div id="holds-policy-by-item-type" class="page-section">
1345
                            [% FOREACH itemtypeloo IN itemtypeloop %]
1254
                    <h2>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h2>
1346
                                <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
1255
                    <p>
1256
                        For this library, you can edit rules for given itemtypes, regardless of the patron's category.
1257
                    </p>
1258
                    <p>
1259
                        Currently, this means hold policies. The various policies have the following effects:
1260
                    </p>
1261
                    <ul>
1262
                        <li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
1263
                        <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>
1264
                        <li><strong>From home library:</strong> Only patrons from the item's home library may put this book on hold.</li>
1265
                        <li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
1266
                    </ul>
1267
1268
                    <p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</p>
1269
                    <p><strong>Important:</strong></p>
1270
1271
                    <ul>
1272
                        <li>The hold 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>.</li>
1273
                        <li>The return policy is applied based on the CircControlReturnsBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CircControlReturnsBranch">[% Koha.Preference('CircControlReturnsBranch') | html %]</a>.</li>
1274
                    </ul>
1275
1276
                    <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1277
                        <input type="hidden" name="op" value="add-branch-item" />
1278
                        <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1279
                        <table>
1280
                            <tr>
1281
                                <th>Item type</th>
1282
                                <th>Hold policy</th>
1283
                                <th>Hold pickup library match</th>
1284
                                <th>Return policy</th>
1285
                                <th>&nbsp;</th>
1286
                            </tr>
1287
                            [% FOREACH i IN itemtypeloop %]
1288
                                [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1289
                                [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1290
                                [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1291
1292
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1293
                                    <tr>
1294
                                        <td>
1295
                                            [% i.translated_description | html %]
1296
                                        </td>
1297
                                        <td>
1298
                                            [% IF holdallowed == 'from_any_library' %]
1299
                                                <span>From any library</span>
1300
                                            [% ELSIF holdallowed == 'from_local_hold_group' %]
1301
                                                <span>From local hold group</span>
1302
                                            [% ELSIF holdallowed == 'from_home_library' %]
1303
                                                <span>From home library</span>
1304
                                            [% ELSE %]
1305
                                                <span>No holds allowed</span>
1306
                                            [% END %]
1307
                                        </td>
1308
                                        <td>
1309
                                            [% IF hold_fulfillment_policy == 'any' %]
1310
                                                <span>any library</span>
1311
                                            [% ELSIF hold_fulfillment_policy == 'homebranch' %]
1312
                                                <span>item's home library</span>
1313
                                            [% ELSIF hold_fulfillment_policy == 'holdgroup' %]
1314
                                                <span>item's hold group</span>
1315
                                            [% ELSIF hold_fulfillment_policy == 'patrongroup' %]
1316
                                                <span>patron's hold group</span>
1317
                                            [% ELSIF hold_fulfillment_policy == 'holdingbranch' %]
1318
                                                <span>item's holding library</span>
1319
                                            [% END %]
1320
                                        </td>
1321
                                        <td>
1322
                                            [% IF returnbranch == 'homebranch' %]
1323
                                                <span>Item returns home</span>
1324
                                            [% ELSIF returnbranch == 'holdingbranch' %]
1325
                                                <span>Item returns to issuing branch</span>
1326
                                            [% ELSIF returnbranch == 'noreturn' %]
1327
                                                <span>Item floats</span>
1328
                                            [% END %]
1329
                                        </td>
1330
                                        <td class="actions">
1331
                                            <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>
1332
                                        </td>
1333
                                    </tr>
1334
                                [% END %]
1347
                            [% END %]
1335
                            [% END %]
1348
                            </select>
1336
                            <tr>
1349
                        </td>
1337
                                <td>
1350
                        <td>
1338
                                    <select name="itemtype">
1351
                            <select name="holdallowed">
1339
                                    [% FOREACH itemtypeloo IN itemtypeloop %]
1352
                                <option value="from_any_library">From any library</option>
1340
                                        <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
1353
                                <option value="from_local_hold_group">From local hold group</option>
1341
                                    [% END %]
1354
                                <option value="from_home_library">From home library</option>
1342
                                    </select>
1355
                                <option value="not_allowed">No holds allowed</option>
1343
                                </td>
1356
                            </select>
1344
                                <td>
1357
                        </td>
1345
                                    <select name="holdallowed">
1358
                        <td>
1346
                                        <option value="from_any_library">From any library</option>
1359
                            <select name="hold_fulfillment_policy">
1347
                                        <option value="from_local_hold_group">From local hold group</option>
1360
                                <option value="any">
1348
                                        <option value="from_home_library">From home library</option>
1361
                                    any library
1349
                                        <option value="not_allowed">No holds allowed</option>
1362
                                </option>
1350
                                    </select>
1351
                                </td>
1352
                                <td>
1353
                                    <select name="hold_fulfillment_policy">
1354
                                        <option value="any">
1355
                                            any library
1356
                                        </option>
1363
1357
1364
                                <option value="holdgroup">
1358
                                        <option value="holdgroup">
1365
                                    item's hold group
1359
                                            item's hold group
1366
                                </option>
1360
                                        </option>
1367
1361
1368
                                <option value="patrongroup">
1362
                                        <option value="patrongroup">
1369
                                    patron's hold group
1363
                                            patron's hold group
1370
                                </option>
1364
                                        </option>
1371
1365
1372
                                <option value="homebranch">
1366
                                        <option value="homebranch">
1373
                                    item's home library
1367
                                            item's home library
1374
                                </option>
1368
                                        </option>
1375
1369
1376
                                <option value="holdingbranch">
1370
                                        <option value="holdingbranch">
1377
                                    item's holding library
1371
                                            item's holding library
1378
                                </option>
1372
                                        </option>
1379
                            </select>
1373
                                    </select>
1380
                        </td>
1374
                                </td>
1381
                        <td>
1375
                                <td>
1382
                            <select name="returnbranch">
1376
                                    <select name="returnbranch">
1383
                                <option value="homebranch">Item returns home</option>
1377
                                        <option value="homebranch">Item returns home</option>
1384
                                <option value="holdingbranch">Item returns to issuing library</option>
1378
                                        <option value="holdingbranch">Item returns to issuing library</option>
1385
                                <option value="noreturn">Item floats</option>
1379
                                        <option value="noreturn">Item floats</option>
1386
                            </select>
1380
                                    </select>
1387
                        </td>
1381
                                </td>
1388
                        <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1382
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
1389
                    </tr>
1383
                            </tr>
1390
                </table>
1384
                        </table>
1391
            </form>
1385
                    </form>
1392
        </div><!-- /.page-section -->
1386
                </div>
1393
    </div>
1394
            </main>
1387
            </main>
1395
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
1388
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
1396
1389
1397
- 

Return to bug 32028