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

(-)a/admin/smart-rules.pl (-3 / +148 lines)
Lines 75-80 $cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY ); Link Here
75
if ($op eq 'delete') {
75
if ($op eq 'delete') {
76
    my $itemtype     = $input->param('itemtype');
76
    my $itemtype     = $input->param('itemtype');
77
    my $categorycode = $input->param('categorycode');
77
    my $categorycode = $input->param('categorycode');
78
    my $checkout_type = $input->param('checkout_type');
79
78
    $debug and warn "deleting $1 $2 $branch";
80
    $debug and warn "deleting $1 $2 $branch";
79
81
80
    Koha::CirculationRules->set_rules(
82
    Koha::CirculationRules->set_rules(
Lines 82-87 if ($op eq 'delete') { Link Here
82
            categorycode => $categorycode eq '*' ? undef : $categorycode,
84
            categorycode => $categorycode eq '*' ? undef : $categorycode,
83
            branchcode   => $branch eq '*' ? undef : $branch,
85
            branchcode   => $branch eq '*' ? undef : $branch,
84
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
86
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
87
            checkout_type => $checkout_type eq '*' ? undef : $checkout_type,
85
            rules        => {
88
            rules        => {
86
                maxissueqty                      => undef,
89
                maxissueqty                      => undef,
87
                rentaldiscount                   => undef,
90
                rentaldiscount                   => undef,
Lines 126-132 elsif ($op eq 'delete-branch-cat') { Link Here
126
                    categorycode => undef,
129
                    categorycode => undef,
127
                    rules        => {
130
                    rules        => {
128
                        max_holds                      => undef,
131
                        max_holds                      => undef,
129
                        patron_maxissueqty             => undef,
132
                    }
133
                }
134
            );
135
            Koha::CirculationRules->set_rules(
136
                {
137
                    branchcode   => undef,
138
                    categorycode => undef,
139
                    checkout_type => $Koha::Checkouts::type->{checkout},
140
                    rules        => {
141
                        patron_maxissueqty                      => undef,
142
                    }
143
                }
144
            );
145
            Koha::CirculationRules->set_rules(
146
                {
147
                    branchcode   => undef,
148
                    categorycode => undef,
149
                    checkout_type => $Koha::Checkouts::type->{onsite_checkout},
150
                    rules        => {
151
                        patron_maxissueqty       => undef,
130
                    }
152
                    }
131
                }
153
                }
132
            );
154
            );
Lines 148-153 elsif ($op eq 'delete-branch-cat') { Link Here
148
                    branchcode   => undef,
170
                    branchcode   => undef,
149
                    rules        => {
171
                    rules        => {
150
                        max_holds                => undef,
172
                        max_holds                => undef,
173
                    }
174
                }
175
            );
176
            Koha::CirculationRules->set_rules(
177
                {
178
                    categorycode => $categorycode,
179
                    branchcode   => undef,
180
                    checkout_type => $Koha::Checkouts::type->{checkout},
181
                    rules        => {
182
                        patron_maxissueqty       => undef,
183
                    }
184
                }
185
            );
186
            Koha::CirculationRules->set_rules(
187
                {
188
                    categorycode => $categorycode,
189
                    branchcode   => undef,
190
                    checkout_type => $Koha::Checkouts::type->{onsite_checkout},
191
                    rules        => {
151
                        patron_maxissueqty       => undef,
192
                        patron_maxissueqty       => undef,
152
                    }
193
                    }
153
                }
194
                }
Lines 158-163 elsif ($op eq 'delete-branch-cat') { Link Here
158
            {
199
            {
159
                branchcode   => $branch,
200
                branchcode   => $branch,
160
                categorycode => undef,
201
                categorycode => undef,
202
                checkout_type => $Koha::Checkouts::type->{checkout},
203
                rules        => {
204
                    patron_maxissueqty       => undef,
205
                }
206
            }
207
        );
208
        Koha::CirculationRules->set_rules(
209
            {
210
                branchcode   => $branch,
211
                categorycode => undef,
212
                checkout_type => $Koha::Checkouts::type->{onsite_checkout},
161
                rules        => {
213
                rules        => {
162
                    max_holds                => undef,
214
                    max_holds                => undef,
163
                    patron_maxissueqty       => undef,
215
                    patron_maxissueqty       => undef,
Lines 182-188 elsif ($op eq 'delete-branch-cat') { Link Here
182
                branchcode   => $branch,
234
                branchcode   => $branch,
183
                rules        => {
235
                rules        => {
184
                    max_holds         => undef,
236
                    max_holds         => undef,
185
                    patron_maxissueqty       => undef,
237
                }
238
            }
239
        );
240
        Koha::CirculationRules->set_rules(
241
            {
242
                categorycode => $categorycode,
243
                branchcode   => $branch,
244
                checkout_type => $Koha::Checkouts::type->{checkout},
245
                rules        => {
246
                    patron_maxissueqty => undef,
247
                }
248
            }
249
        );
250
        Koha::CirculationRules->set_rules(
251
            {
252
                categorycode => $categorycode,
253
                branchcode   => $branch,
254
                checkout_type => $Koha::Checkouts::type->{onsite_checkout},
255
                rules        => {
256
                    patron_maxissueqty => undef,
186
                }
257
                }
187
            }
258
            }
188
        );
259
        );
Lines 247-252 elsif ($op eq 'add') { Link Here
247
    my $br = $branch; # branch
318
    my $br = $branch; # branch
248
    my $bor  = $input->param('categorycode'); # borrower category
319
    my $bor  = $input->param('categorycode'); # borrower category
249
    my $itemtype  = $input->param('itemtype');     # item type
320
    my $itemtype  = $input->param('itemtype');     # item type
321
    my $checkout_type = $input->param('checkout_type');
250
    my $fine = $input->param('fine');
322
    my $fine = $input->param('fine');
251
    my $finedays     = $input->param('finedays');
323
    my $finedays     = $input->param('finedays');
252
    my $maxsuspensiondays = $input->param('maxsuspensiondays') || '';
324
    my $maxsuspensiondays = $input->param('maxsuspensiondays') || '';
Lines 322-327 elsif ($op eq 'add') { Link Here
322
            categorycode => $bor eq '*' ? undef : $bor,
394
            categorycode => $bor eq '*' ? undef : $bor,
323
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
395
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
324
            branchcode   => $br eq '*' ? undef : $br,
396
            branchcode   => $br eq '*' ? undef : $br,
397
            checkout_type => $checkout_type eq '*' ? undef : $checkout_type,
325
            rules        => $rules,
398
            rules        => $rules,
326
        }
399
        }
327
    );
400
    );
Lines 330-335 elsif ($op eq 'add') { Link Here
330
elsif ($op eq "set-branch-defaults") {
403
elsif ($op eq "set-branch-defaults") {
331
    my $categorycode  = $input->param('categorycode');
404
    my $categorycode  = $input->param('categorycode');
332
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
405
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
406
    my $patron_maxonsiteissueqty   = strip_non_numeric( scalar $input->param('patron_maxonsiteissueqty') );
333
    my $holdallowed   = $input->param('holdallowed');
407
    my $holdallowed   = $input->param('holdallowed');
334
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
408
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
335
    my $returnbranch  = $input->param('returnbranch');
409
    my $returnbranch  = $input->param('returnbranch');
Lines 353-363 elsif ($op eq "set-branch-defaults") { Link Here
353
            {
427
            {
354
                categorycode => undef,
428
                categorycode => undef,
355
                branchcode   => undef,
429
                branchcode   => undef,
430
                checkout_type => $Koha::Checkouts::type->{checkout},
356
                rules        => {
431
                rules        => {
357
                    patron_maxissueqty             => $patron_maxissueqty,
432
                    patron_maxissueqty             => $patron_maxissueqty,
358
                }
433
                }
359
            }
434
            }
360
        );
435
        );
436
        Koha::CirculationRules->set_rules(
437
            {
438
                categorycode => undef,
439
                branchcode   => undef,
440
                checkout_type => $Koha::Checkouts::type->{onsite_checkout},
441
                rules        => {
442
                    patron_maxissueqty             => $patron_maxonsiteissueqty,
443
                }
444
            }
445
        );
361
    } else {
446
    } else {
362
        Koha::CirculationRules->set_rules(
447
        Koha::CirculationRules->set_rules(
363
            {
448
            {
Lines 374-384 elsif ($op eq "set-branch-defaults") { Link Here
374
            {
459
            {
375
                categorycode => undef,
460
                categorycode => undef,
376
                branchcode   => $branch,
461
                branchcode   => $branch,
462
                checkout_type => $Koha::Checkouts::type->{checkout},
377
                rules        => {
463
                rules        => {
378
                    patron_maxissueqty             => $patron_maxissueqty,
464
                    patron_maxissueqty             => $patron_maxissueqty,
379
                }
465
                }
380
            }
466
            }
381
        );
467
        );
468
        Koha::CirculationRules->set_rules(
469
            {
470
                categorycode => undef,
471
                branchcode   => $branch,
472
                checkout_type => $Koha::Checkouts::type->{onsite_checkout},
473
                rules        => {
474
                    patron_maxissueqty             => $patron_maxonsiteissueqty,
475
                }
476
            }
477
        );
382
    }
478
    }
383
    Koha::CirculationRules->set_rule(
479
    Koha::CirculationRules->set_rule(
384
        {
480
        {
Lines 392-397 elsif ($op eq "set-branch-defaults") { Link Here
392
elsif ($op eq "add-branch-cat") {
488
elsif ($op eq "add-branch-cat") {
393
    my $categorycode  = $input->param('categorycode');
489
    my $categorycode  = $input->param('categorycode');
394
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
490
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
491
    my $patron_maxonsiteissueqty = strip_non_numeric( scalar $input->param('patron_maxonsiteissueqty') );
395
    my $max_holds = $input->param('max_holds');
492
    my $max_holds = $input->param('max_holds');
396
    $max_holds =~ s/\s//g;
493
    $max_holds =~ s/\s//g;
397
    $max_holds = undef if $max_holds !~ /^\d+/;
494
    $max_holds = undef if $max_holds !~ /^\d+/;
Lines 402-447 elsif ($op eq "add-branch-cat") { Link Here
402
                {
499
                {
403
                    categorycode => undef,
500
                    categorycode => undef,
404
                    branchcode   => undef,
501
                    branchcode   => undef,
502
                    checkout_type => $Koha::Checkouts::type->{checkout},
405
                    rules        => {
503
                    rules        => {
406
                        max_holds         => $max_holds,
504
                        max_holds         => $max_holds,
407
                        patron_maxissueqty       => $patron_maxissueqty,
505
                        patron_maxissueqty       => $patron_maxissueqty,
408
                    }
506
                    }
409
                }
507
                }
410
            );
508
            );
509
            Koha::CirculationRules->set_rules(
510
                {
511
                    categorycode => undef,
512
                    branchcode   => undef,
513
                    checkout_type => $Koha::Checkouts::type->{onsite_checkout},
514
                    rules        => {
515
                        max_holds         => $max_holds,
516
                        patron_maxissueqty       => $patron_maxonsiteissueqty,
517
                    }
518
                }
519
            );
411
        } else {
520
        } else {
412
            Koha::CirculationRules->set_rules(
521
            Koha::CirculationRules->set_rules(
413
                {
522
                {
414
                    categorycode => $categorycode,
523
                    categorycode => $categorycode,
415
                    branchcode   => undef,
524
                    branchcode   => undef,
525
                    checkout_type => $Koha::Checkouts::type->{checkout},
416
                    rules        => {
526
                    rules        => {
417
                        max_holds         => $max_holds,
527
                        max_holds         => $max_holds,
418
                        patron_maxissueqty       => $patron_maxissueqty,
528
                        patron_maxissueqty       => $patron_maxissueqty,
419
                    }
529
                    }
420
                }
530
                }
421
            );
531
            );
532
            Koha::CirculationRules->set_rules(
533
                {
534
                    categorycode => $categorycode,
535
                    branchcode   => undef,
536
                    checkout_type => $Koha::Checkouts::type->{onsite_checkout},
537
                    rules        => {
538
                        max_holds         => $max_holds,
539
                        patron_maxissueqty       => $patron_maxonsiteissueqty,
540
                    }
541
                }
542
            );
422
        }
543
        }
423
    } elsif ($categorycode eq "*") {
544
    } elsif ($categorycode eq "*") {
424
        Koha::CirculationRules->set_rules(
545
        Koha::CirculationRules->set_rules(
425
            {
546
            {
426
                categorycode => undef,
547
                categorycode => undef,
427
                branchcode   => $branch,
548
                branchcode   => $branch,
549
                checkout_type => $Koha::Checkouts::type->{checkout},
428
                rules        => {
550
                rules        => {
429
                    max_holds         => $max_holds,
551
                    max_holds         => $max_holds,
430
                    patron_maxissueqty       => $patron_maxissueqty,
552
                    patron_maxissueqty       => $patron_maxissueqty,
431
                }
553
                }
432
            }
554
            }
433
        );
555
        );
556
        Koha::CirculationRules->set_rules(
557
            {
558
                categorycode => undef,
559
                branchcode   => $branch,
560
                checkout_type => $Koha::Checkouts::type->{onsite_checkout},
561
                rules        => {
562
                    max_holds         => $max_holds,
563
                    patron_maxissueqty       => $patron_maxonsiteissueqty,
564
                }
565
            }
566
        );
434
    } else {
567
    } else {
435
        Koha::CirculationRules->set_rules(
568
        Koha::CirculationRules->set_rules(
436
            {
569
            {
437
                categorycode => $categorycode,
570
                categorycode => $categorycode,
438
                branchcode   => $branch,
571
                branchcode   => $branch,
572
                checkout_type => $Koha::Checkouts::type->{checkout},
439
                rules        => {
573
                rules        => {
440
                    max_holds         => $max_holds,
574
                    max_holds         => $max_holds,
441
                    patron_maxissueqty       => $patron_maxissueqty,
575
                    patron_maxissueqty       => $patron_maxissueqty,
442
                }
576
                }
443
            }
577
            }
444
        );
578
        );
579
        Koha::CirculationRules->set_rules(
580
            {
581
                categorycode => $categorycode,
582
                branchcode   => $branch,
583
                checkout_type => $Koha::Checkouts::type->{onsite_checkout},
584
                rules        => {
585
                    max_holds         => $max_holds,
586
                    patron_maxissueqty       => $patron_maxonsiteissueqty,
587
                }
588
            }
589
        );
445
    }
590
    }
446
}
591
}
447
elsif ($op eq "add-branch-item") {
592
elsif ($op eq "add-branch-item") {
Lines 551-557 my $definedbranch = $all_rules->count ? 1 : 0; Link Here
551
my $rules = {};
696
my $rules = {};
552
while ( my $r = $all_rules->next ) {
697
while ( my $r = $all_rules->next ) {
553
    $r = $r->unblessed;
698
    $r = $r->unblessed;
554
    $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{rule_name} } = $r->{rule_value};
699
    $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{checkout_type} // '' }->{ $r->{rule_name} } = $r->{rule_value};
555
}
700
}
556
701
557
$template->param(show_branch_cat_rule_form => 1);
702
$template->param(show_branch_cat_rule_form => 1);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-20 / +68 lines)
Lines 5-10 Link Here
5
[% USE Branches %]
5
[% USE Branches %]
6
[% USE Categories %]
6
[% USE Categories %]
7
[% USE ItemTypes %]
7
[% USE ItemTypes %]
8
[% USE Checkouts %]
8
[% USE CirculationRules %]
9
[% USE CirculationRules %]
9
[% SET footerjs = 1 %]
10
[% SET footerjs = 1 %]
10
11
Lines 22-27 Link Here
22
[% END %]
23
[% END %]
23
[% itemtypes.push(undef) %]
24
[% itemtypes.push(undef) %]
24
25
26
[% SET checkout_types = [] %]
27
[% FOREACH ct IN Checkouts.checkout_type %]
28
    [% checkout_types.push( ct.value ) %]
29
[% END %]
30
[% checkout_types.push(undef) %]
31
25
[% INCLUDE 'doc-head-open.inc' %]
32
[% INCLUDE 'doc-head-open.inc' %]
26
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
33
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
27
[% INCLUDE 'doc-head-close.inc' %]
34
[% INCLUDE 'doc-head-close.inc' %]
Lines 86-91 Link Here
86
            <table id="default-circulation-rules">
93
            <table id="default-circulation-rules">
87
            <thead>
94
            <thead>
88
            <tr>
95
            <tr>
96
                <th>Checkout type</th>
89
                <th>Patron category</th>
97
                <th>Patron category</th>
90
                <th>Item type</th>
98
                <th>Item type</th>
91
                <th>Actions</th>
99
                <th>Actions</th>
Lines 122-131 Link Here
122
            </thead>
130
            </thead>
123
            <tbody>
131
            <tbody>
124
                [% SET row_count = 0 %]
132
                [% SET row_count = 0 %]
125
                [% FOREACH c IN categorycodes %]
133
                [% FOREACH ct IN checkout_types %]
126
                    [% SET c = '' UNLESS c.defined %]
134
                    [% FOREACH c IN categorycodes %]
127
                    [% FOREACH i IN itemtypes %]
135
                        [% SET c = '' UNLESS c.defined %]
136
                        [% FOREACH i IN itemtypes %]
128
                        [% SET i = '' UNLESS i.defined %]
137
                        [% SET i = '' UNLESS i.defined %]
138
                        [% SET ct = '' UNLESS ct.defined %]
129
                        [% SET note = all_rules.$c.$i.note %]
139
                        [% SET note = all_rules.$c.$i.note %]
130
                        [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
140
                        [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
131
                        [% SET issuelength = all_rules.$c.$i.issuelength %]
141
                        [% SET issuelength = all_rules.$c.$i.issuelength %]
Lines 160-165 Link Here
160
                        [% IF show_rule %]
170
                        [% IF show_rule %]
161
                            [% SET row_count = row_count + 1 %]
171
                            [% SET row_count = row_count + 1 %]
162
                            <tr row_countd="row_[% row_count | html %]">
172
                            <tr row_countd="row_[% row_count | html %]">
173
                                    <td>
174
                                        [% IF ct == undef %]
175
                                            <em>All</em>
176
                                        [% ELSE %]
177
                                            [% IF ct == 'CHECKOUT' %]
178
                                                <em>Normal checkout</em>
179
                                            [% ELSIF ct == 'ONSITE' %]
180
                                                <em>On-site checkout</em>
181
                                            [% END %]
182
                                        [% END %]
183
                                    </td>
163
                                    <td>
184
                                    <td>
164
                                        [% IF c == undef %]
185
                                        [% IF c == undef %]
165
                                            <em>All</em>
186
                                            <em>All</em>
Lines 176-182 Link Here
176
                                    </td>
197
                                    </td>
177
                                    <td class="actions">
198
                                    <td class="actions">
178
                                      <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
199
                                      <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
179
                                      <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>
200
                                      <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;checkout_type=[% ct || '*' | html %]&amp;itemtype=[% i || '*' | html %]&amp;categorycode=[% c || '*' | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
180
                                    </td>
201
                                    </td>
181
                                    <td>
202
                                    <td>
182
                                        [% IF note.defined && note != '' %]
203
                                        [% IF note.defined && note != '' %]
Lines 309-317 Link Here
309
                                    </td>
330
                                    </td>
310
                            </tr>
331
                            </tr>
311
                        [% END %]
332
                        [% END %]
333
                        [% END %]
312
                    [% END %]
334
                    [% END %]
313
                [% END %]
335
                [% END %]
314
                <tr id="edit_row">
336
                <tr id="edit_row">
337
                    <td>
338
                        <select name="checkout_type" id="matrixcheckout_type" style="width:13em;">
339
                            <option value="*">All</option>
340
                            <option value="CHECKOUT">Normal checkout</option>
341
                            <option value="ONSITE">On-site checkout</option>
342
                        </select>
343
                    </td>
315
                    <td>
344
                    <td>
316
                        <select name="categorycode" id="categorycode">
345
                        <select name="categorycode" id="categorycode">
317
                            <option value="*">All</option>
346
                            <option value="*">All</option>
Lines 422-427 Link Here
422
                </tr>
451
                </tr>
423
                <tfoot>
452
                <tfoot>
424
                    <tr>
453
                    <tr>
454
                      <th>Checkout type</th>
425
                      <th>Patron category</th>
455
                      <th>Patron category</th>
426
                      <th>Item type</th>
456
                      <th>Item type</th>
427
                      <th>&nbsp;</th>
457
                      <th>&nbsp;</th>
Lines 470-475 Link Here
470
                <tr>
500
                <tr>
471
                    <th>&nbsp;</th>
501
                    <th>&nbsp;</th>
472
                    <th>Total current checkouts allowed</th>
502
                    <th>Total current checkouts allowed</th>
503
                    <th>Total current on-site checkouts allowed</th>
473
                    <th>Maximum total holds allowed (count)</th>
504
                    <th>Maximum total holds allowed (count)</th>
474
                    <th>Hold policy</th>
505
                    <th>Hold policy</th>
475
                    <th>Hold pickup library match</th>
506
                    <th>Hold pickup library match</th>
Lines 479-494 Link Here
479
                <tr>
510
                <tr>
480
                    <td><em>Defaults</em></td>
511
                    <td><em>Defaults</em></td>
481
                    <td>
512
                    <td>
482
                        [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
513
                        [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, Checkouts.checkout_type.checkout, 'patron_maxissueqty' ) %]
483
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
514
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
484
                    </td>
515
                    </td>
485
                    <td>
516
                    <td>
486
                        [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
517
                        [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, Checkouts.checkout_type.onsite_checkout, 'patron_maxissueqty' ) %]
518
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
519
                    </td>
520
                    <td>
521
                        [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, undef, 'max_holds' ) %]
487
                        <input name="max_holds" size="3" value="[% rule_value | html %]" />
522
                        <input name="max_holds" size="3" value="[% rule_value | html %]" />
488
                    </td>
523
                    </td>
489
                    <td>
524
                    <td>
490
                        <select name="holdallowed">
525
                        <select name="holdallowed">
491
                            [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %]
526
                            [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, undef, 'holdallowed' ) %]
492
                            <option value="">
527
                            <option value="">
493
                                Not set
528
                                Not set
494
                            </option>
529
                            </option>
Lines 528-534 Link Here
528
                    </td>
563
                    </td>
529
                    <td>
564
                    <td>
530
                        <select name="hold_fulfillment_policy">
565
                        <select name="hold_fulfillment_policy">
531
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %]
566
                            [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, undef, 'hold_fulfillment_policy' ) %]
532
567
533
                            <option value="">
568
                            <option value="">
534
                                Not set
569
                                Not set
Lines 587-593 Link Here
587
                    </td>
622
                    </td>
588
                    <td>
623
                    <td>
589
                        <select name="returnbranch">
624
                        <select name="returnbranch">
590
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %]
625
                            [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, undef, 'returnbranch' ) %]
591
626
592
                            <option value="">
627
                            <option value="">
593
                                Not set
628
                                Not set
Lines 640-652 Link Here
640
                <tr>
675
                <tr>
641
                    <th>Patron category</th>
676
                    <th>Patron category</th>
642
                    <th>Total current checkouts allowed</th>
677
                    <th>Total current checkouts allowed</th>
678
                    <th>Total current on-site checkouts allowed</th>
643
                    <th>Total holds allowed</th>
679
                    <th>Total holds allowed</th>
644
                    <th>&nbsp;</th>
680
                    <th>&nbsp;</th>
645
                </tr>
681
                </tr>
646
                [% FOREACH c IN categorycodes %]
682
                [% FOREACH c IN categorycodes %]
647
                    [% NEXT UNLESS c %]
683
                    [% NEXT UNLESS c %]
648
                    [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
684
                    [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, Checkouts.checkout_type.checkout, 'patron_maxissueqty' ) %]
649
                    [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
685
                    [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, Checkouts.checkout_type.onsite_checkout, 'patron_maxissueqty' ) %]
686
                    [% SET max_holds = CirculationRules.Search( branchcode, c, undef, undef, 'max_holds' ) %]
650
687
651
                    [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
688
                    [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
652
                    <tr>
689
                    <tr>
Lines 664-669 Link Here
664
                                <span>Unlimited</span>
701
                                <span>Unlimited</span>
665
                            [% END %]
702
                            [% END %]
666
                        </td>
703
                        </td>
704
                        <td>
705
                            [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
706
                                [% patron_maxonsiteissueqty | html %]
707
                            [% ELSE %]
708
                                <span>Unlimited</span>
709
                            [% END %]
710
                        </td>
667
                        <td>
711
                        <td>
668
                            [% IF max_holds.defined && max_holds != '' %]
712
                            [% IF max_holds.defined && max_holds != '' %]
669
                                [% max_holds | html %]
713
                                [% max_holds | html %]
Lines 687-692 Link Here
687
                        </select>
731
                        </select>
688
                    </td>
732
                    </td>
689
                    <td><input name="patron_maxissueqty" size="3" type="text" /></td>
733
                    <td><input name="patron_maxissueqty" size="3" type="text" /></td>
734
                    <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
690
                    <td><input name="max_holds" size="3" type="text" /></td>
735
                    <td><input name="max_holds" size="3" type="text" /></td>
691
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
736
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
692
                </tr>
737
                </tr>
Lines 806-814 Link Here
806
                    <th>&nbsp;</th>
851
                    <th>&nbsp;</th>
807
                </tr>
852
                </tr>
808
                [% FOREACH i IN itemtypeloop %]
853
                [% FOREACH i IN itemtypeloop %]
809
                    [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
854
                    [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, undef, 'holdallowed' ) %]
810
                    [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
855
                    [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, undef, 'hold_fulfillment_policy' ) %]
811
                    [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
856
                    [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, undef, 'returnbranch' ) %]
812
857
813
                    [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
858
                    [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
814
                        <tr>
859
                        <tr>
Lines 979-989 Link Here
979
                    itm = $(this).text();
1024
                    itm = $(this).text();
980
                    itm = itm.replace(/^\s*|\s*$/g,'');
1025
                    itm = itm.replace(/^\s*|\s*$/g,'');
981
                    var current_column = $("#edit_row td:eq("+i+")");
1026
                    var current_column = $("#edit_row td:eq("+i+")");
982
                    if ( i == 3 ) {
1027
                    if ( i == 4 ) {
983
                        // specific processing for the Note column
1028
                        // specific processing for the Note column
984
                        var note = $(this).find("a[name='viewnote']").data("content");
1029
                        var note = $(this).find("a[name='viewnote']").data("content");
985
                        $(current_column).find("input[type='text']").val(note);
1030
                        $(current_column).find("input[type='text']").val(note);
986
                    } else if ( i == 8 ) {
1031
                    } else if ( i == 9 ) {
987
                        // specific processing for the Hard due date column
1032
                        // specific processing for the Hard due date column
988
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1033
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
989
                        var input_value = '';
1034
                        var input_value = '';
Lines 994-1000 Link Here
994
                        }
1039
                        }
995
                        $(current_column).find("input[type='text']").val(input_value);
1040
                        $(current_column).find("input[type='text']").val(input_value);
996
                        $(current_column).find("select").val(select_value);
1041
                        $(current_column).find("select").val(select_value);
997
                    } else if ( i == 14 ) {
1042
                    } else if ( i == 15 ) {
998
                        // specific processing for cap_fine_to_replacement_price
1043
                        // specific processing for cap_fine_to_replacement_price
999
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1044
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1000
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1045
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
Lines 1009-1025 Link Here
1009
                                $(this).attr('selected', 'selected');
1054
                                $(this).attr('selected', 'selected');
1010
                            }
1055
                            }
1011
                        });
1056
                        });
1012
                        if ( i == 0 || i == 1 ) {
1057
                        if ( i == 0 || i == 1 || i == 2 ) {
1013
                            // Disable the 2 first columns, we cannot update them.
1058
                            // Disable the 2 first columns, we cannot update them.
1014
                            var val = $(current_column).find("select option:selected").val();
1059
                            var val = $(current_column).find("select option:selected").val();
1015
                            var name = "categorycode";
1060
                            var name = "categorycode";
1016
                            if ( i == 1 ) {
1061
                            if ( i == 1 ) {
1017
                                name="itemtype";
1062
                                name="itemtype";
1018
                            }
1063
                            }
1064
                            if ( i == 2 ) {
1065
                                name="checkout_type";
1066
                            }
1019
                            // Remove potential previous input added
1067
                            // Remove potential previous input added
1020
                            $(current_column).find("input").remove();
1068
                            $(current_column).find("input").remove();
1021
                            $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1069
                            $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1022
                        } else if ( i == 5 || i == 25 || i == 26 || i == 27 ) {
1070
                        } else if ( i == 6 || i == 25 || i == 26 || i == 27 ) {
1023
                            // If the value is not an integer for
1071
                            // If the value is not an integer for
1024
                            //     - "Current checkouts allowed"
1072
                            //     - "Current checkouts allowed"
1025
                            //     - "Holds allowed (total)"
1073
                            //     - "Holds allowed (total)"
Lines 1035-1040 Link Here
1035
                });
1083
                });
1036
                $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1084
                $("#default-circulation-rules tr:last td:eq(0) select").prop('disabled', true);
1037
                $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1085
                $("#default-circulation-rules tr:last td:eq(1) select").prop('disabled', true);
1086
                $("#default-circulation-rules tr:last td:eq(2) select").prop('disabled', true);
1038
                return false;
1087
                return false;
1039
            });
1088
            });
1040
            $(".clear_edit").on("click",function(e){
1089
            $(".clear_edit").on("click",function(e){
1041
- 

Return to bug 25089