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

(-)a/C4/Circulation.pm (-31 / +18 lines)
Lines 385-390 sub TooMany { Link Here
385
	# Get which branchcode we need
385
	# Get which branchcode we need
386
    $branch = _GetCircControlBranch($item_object->unblessed,$borrower);
386
    $branch = _GetCircControlBranch($item_object->unblessed,$borrower);
387
    my $type = $item_object->effective_itemtype;
387
    my $type = $item_object->effective_itemtype;
388
    my $checkout_type = $onsite_checkout
389
        ? $switch_onsite_checkout
390
            ? $Koha::Checkouts::type->{checkout}
391
            : $Koha::Checkouts::type->{onsite_checkout}
392
        : $Koha::Checkouts::type->{checkout};
388
393
389
    # given branch, patron category, and item type, determine
394
    # given branch, patron category, and item type, determine
390
    # applicable issuing rule
395
    # applicable issuing rule
Lines 396-409 sub TooMany { Link Here
396
            rule_name    => 'maxissueqty',
401
            rule_name    => 'maxissueqty',
397
        }
402
        }
398
    );
403
    );
399
    my $maxonsiteissueqty_rule = Koha::CirculationRules->get_effective_rule(
400
        {
401
            categorycode => $cat_borrower,
402
            itemtype     => $type,
403
            branchcode   => $branch,
404
            rule_name    => 'maxonsiteissueqty',
405
        }
406
    );
407
404
408
405
409
    # if a rule is found and has a loan limit set, count
406
    # if a rule is found and has a loan limit set, count
Lines 473-486 sub TooMany { Link Here
473
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $count_query, {}, @bind_params );
470
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $count_query, {}, @bind_params );
474
471
475
        my $max_checkouts_allowed = $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef;
472
        my $max_checkouts_allowed = $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef;
476
        my $max_onsite_checkouts_allowed = $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef;
477
473
478
        if ( $onsite_checkout and $max_onsite_checkouts_allowed ne '' ) {
474
        if ( $onsite_checkout and $max_checkouts_allowed ne '' ) {
479
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
475
            if ( $onsite_checkout_count >= $max_checkouts_allowed )  {
480
                return {
476
                return {
481
                    reason => 'TOO_MANY_ONSITE_CHECKOUTS',
477
                    reason => 'TOO_MANY_ONSITE_CHECKOUTS',
482
                    count => $onsite_checkout_count,
478
                    count => $onsite_checkout_count,
483
                    max_allowed => $max_onsite_checkouts_allowed,
479
                    max_allowed => $max_checkouts_allowed,
484
                }
480
                }
485
            }
481
            }
486
        }
482
        }
Lines 505-511 sub TooMany { Link Here
505
    }
501
    }
506
502
507
    # Now count total loans against the limit for the branch
503
    # Now count total loans against the limit for the branch
508
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
504
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower, $checkout_type );
509
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') {
505
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') {
510
        my @bind_params = ();
506
        my @bind_params = ();
511
        my $branch_count_query = qq|
507
        my $branch_count_query = qq|
Lines 527-540 sub TooMany { Link Here
527
        }
523
        }
528
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
524
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
529
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty};
525
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty};
530
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxonsiteissueqty};
531
526
532
        if ( $onsite_checkout and $max_onsite_checkouts_allowed ne '' ) {
527
        if ( $onsite_checkout and $max_checkouts_allowed ne '' ) {
533
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
528
            if ( $onsite_checkout_count >= $max_checkouts_allowed )  {
534
                return {
529
                return {
535
                    reason => 'TOO_MANY_ONSITE_CHECKOUTS',
530
                    reason => 'TOO_MANY_ONSITE_CHECKOUTS',
536
                    count => $onsite_checkout_count,
531
                    count => $onsite_checkout_count,
537
                    max_allowed => $max_onsite_checkouts_allowed,
532
                    max_allowed => $max_checkouts_allowed,
538
                }
533
                }
539
            }
534
            }
540
        }
535
        }
Lines 1623-1629 sub GetHardDueDate { Link Here
1623
1618
1624
=head2 GetBranchBorrowerCircRule
1619
=head2 GetBranchBorrowerCircRule
1625
1620
1626
  my $branch_cat_rule = GetBranchBorrowerCircRule($branchcode, $categorycode);
1621
  my $branch_cat_rule = GetBranchBorrowerCircRule($branchcode, $categorycode, $checkout_type);
1627
1622
1628
Retrieves circulation rule attributes that apply to the given
1623
Retrieves circulation rule attributes that apply to the given
1629
branch and patron category, regardless of item type.  
1624
branch and patron category, regardless of item type.  
Lines 1633-1653 patron_maxissueqty - maximum number of loans that a Link Here
1633
patron of the given category can have at the given
1628
patron of the given category can have at the given
1634
branch.  If the value is undef, no limit.
1629
branch.  If the value is undef, no limit.
1635
1630
1636
patron_maxonsiteissueqty - maximum of on-site checkouts that a
1631
The order in which rules are searched is defined in circulation
1637
patron of the given category can have at the given
1632
rules user interface.
1638
branch.  If the value is undef, no limit.
1639
1640
This will check for different branch/category combinations in the following order:
1641
branch and category
1642
branch only
1643
category only
1644
default branch and category
1645
1633
1646
If no rule has been found in the database, it will default to
1634
If no rule has been found in the database, it will default to
1647
the buillt in rule:
1635
the buillt in rule:
1648
1636
1649
patron_maxissueqty - undef
1637
patron_maxissueqty - undef
1650
patron_maxonsiteissueqty - undef
1651
1638
1652
C<$branchcode> and C<$categorycode> should contain the
1639
C<$branchcode> and C<$categorycode> should contain the
1653
literal branch code and patron category code, respectively - no
1640
literal branch code and patron category code, respectively - no
Lines 1656-1676 wildcards. Link Here
1656
=cut
1643
=cut
1657
1644
1658
sub GetBranchBorrowerCircRule {
1645
sub GetBranchBorrowerCircRule {
1659
    my ( $branchcode, $categorycode ) = @_;
1646
    my ( $branchcode, $categorycode, $checkout_type ) = @_;
1660
1647
1661
    # Initialize default values
1648
    # Initialize default values
1662
    my $rules = {
1649
    my $rules = {
1663
        patron_maxissueqty       => undef,
1650
        patron_maxissueqty       => undef,
1664
        patron_maxonsiteissueqty => undef,
1665
    };
1651
    };
1666
1652
1667
    # Search for rules!
1653
    # Search for rules!
1668
    foreach my $rule_name (qw( patron_maxissueqty patron_maxonsiteissueqty )) {
1654
    foreach my $rule_name (qw( patron_maxissueqty )) {
1669
        my $rule = Koha::CirculationRules->get_effective_rule(
1655
        my $rule = Koha::CirculationRules->get_effective_rule(
1670
            {
1656
            {
1671
                categorycode => $categorycode,
1657
                categorycode => $categorycode,
1672
                itemtype     => undef,
1658
                itemtype     => undef,
1673
                branchcode   => $branchcode,
1659
                branchcode   => $branchcode,
1660
                checkout_type => $checkout_type,
1674
                rule_name    => $rule_name,
1661
                rule_name    => $rule_name,
1675
            }
1662
            }
1676
        );
1663
        );
(-)a/Koha/CirculationRules.pm (-6 lines)
Lines 53-61 our $RULE_KINDS = { Link Here
53
    patron_maxissueqty => {
53
    patron_maxissueqty => {
54
        scope => [ 'branchcode', 'categorycode', 'checkout_type' ],
54
        scope => [ 'branchcode', 'categorycode', 'checkout_type' ],
55
    },
55
    },
56
    patron_maxonsiteissueqty => {
57
        scope => [ 'branchcode', 'categorycode' ],
58
    },
59
    max_holds => {
56
    max_holds => {
60
        scope => [ 'branchcode', 'categorycode' ],
57
        scope => [ 'branchcode', 'categorycode' ],
61
    },
58
    },
Lines 118-126 our $RULE_KINDS = { Link Here
118
    maxissueqty => {
115
    maxissueqty => {
119
        scope => [ 'branchcode', 'categorycode', 'itemtype', 'checkout_type' ],
116
        scope => [ 'branchcode', 'categorycode', 'itemtype', 'checkout_type' ],
120
    },
117
    },
121
    maxonsiteissueqty => {
122
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
123
    },
124
    maxsuspensiondays => {
118
    maxsuspensiondays => {
125
        scope => [ 'branchcode', 'categorycode', 'itemtype', 'checkout_type' ],
119
        scope => [ 'branchcode', 'categorycode', 'itemtype', 'checkout_type' ],
126
    },
120
    },
(-)a/admin/smart-rules.pl (-18 / +1 lines)
Lines 84-90 if ($op eq 'delete') { Link Here
84
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
84
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
85
            rules        => {
85
            rules        => {
86
                maxissueqty                      => undef,
86
                maxissueqty                      => undef,
87
                maxonsiteissueqty                => undef,
88
                rentaldiscount                   => undef,
87
                rentaldiscount                   => undef,
89
                fine                             => undef,
88
                fine                             => undef,
90
                finedays                         => undef,
89
                finedays                         => undef,
Lines 128-134 elsif ($op eq 'delete-branch-cat') { Link Here
128
                    rules        => {
127
                    rules        => {
129
                        max_holds                      => undef,
128
                        max_holds                      => undef,
130
                        patron_maxissueqty             => undef,
129
                        patron_maxissueqty             => undef,
131
                        patron_maxonsiteissueqty       => undef,
132
                    }
130
                    }
133
                }
131
                }
134
            );
132
            );
Lines 151-157 elsif ($op eq 'delete-branch-cat') { Link Here
151
                    rules        => {
149
                    rules        => {
152
                        max_holds                => undef,
150
                        max_holds                => undef,
153
                        patron_maxissueqty       => undef,
151
                        patron_maxissueqty       => undef,
154
                        patron_maxonsiteissueqty => undef,
155
                    }
152
                    }
156
                }
153
                }
157
            );
154
            );
Lines 164-170 elsif ($op eq 'delete-branch-cat') { Link Here
164
                rules        => {
161
                rules        => {
165
                    max_holds                => undef,
162
                    max_holds                => undef,
166
                    patron_maxissueqty       => undef,
163
                    patron_maxissueqty       => undef,
167
                    patron_maxonsiteissueqty => undef,
168
                }
164
                }
169
            }
165
            }
170
        );
166
        );
Lines 187-193 elsif ($op eq 'delete-branch-cat') { Link Here
187
                rules        => {
183
                rules        => {
188
                    max_holds         => undef,
184
                    max_holds         => undef,
189
                    patron_maxissueqty       => undef,
185
                    patron_maxissueqty       => undef,
190
                    patron_maxonsiteissueqty => undef,
191
                }
186
                }
192
            }
187
            }
193
        );
188
        );
Lines 260-266 elsif ($op eq 'add') { Link Here
260
    my $chargeperiod = $input->param('chargeperiod');
255
    my $chargeperiod = $input->param('chargeperiod');
261
    my $chargeperiod_charge_at = $input->param('chargeperiod_charge_at');
256
    my $chargeperiod_charge_at = $input->param('chargeperiod_charge_at');
262
    my $maxissueqty = strip_non_numeric( scalar $input->param('maxissueqty') );
257
    my $maxissueqty = strip_non_numeric( scalar $input->param('maxissueqty') );
263
    my $maxonsiteissueqty = strip_non_numeric( scalar $input->param('maxonsiteissueqty') );
264
    my $renewalsallowed  = $input->param('renewalsallowed');
258
    my $renewalsallowed  = $input->param('renewalsallowed');
265
    my $renewalperiod    = $input->param('renewalperiod');
259
    my $renewalperiod    = $input->param('renewalperiod');
266
    my $norenewalbefore  = $input->param('norenewalbefore');
260
    my $norenewalbefore  = $input->param('norenewalbefore');
Lines 289-299 elsif ($op eq 'add') { Link Here
289
    my $overduefinescap = $input->param('overduefinescap') || '';
283
    my $overduefinescap = $input->param('overduefinescap') || '';
290
    my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on';
284
    my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on';
291
    my $note = $input->param('note');
285
    my $note = $input->param('note');
292
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";
286
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $cap_fine_to_replacement_price";
293
287
294
    my $rules = {
288
    my $rules = {
295
        maxissueqty                   => $maxissueqty,
289
        maxissueqty                   => $maxissueqty,
296
        maxonsiteissueqty             => $maxonsiteissueqty,
297
        rentaldiscount                => $rentaldiscount,
290
        rentaldiscount                => $rentaldiscount,
298
        fine                          => $fine,
291
        fine                          => $fine,
299
        finedays                      => $finedays,
292
        finedays                      => $finedays,
Lines 337-344 elsif ($op eq 'add') { Link Here
337
elsif ($op eq "set-branch-defaults") {
330
elsif ($op eq "set-branch-defaults") {
338
    my $categorycode  = $input->param('categorycode');
331
    my $categorycode  = $input->param('categorycode');
339
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
332
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
340
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
341
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
342
    my $holdallowed   = $input->param('holdallowed');
333
    my $holdallowed   = $input->param('holdallowed');
343
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
334
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
344
    my $returnbranch  = $input->param('returnbranch');
335
    my $returnbranch  = $input->param('returnbranch');
Lines 364-370 elsif ($op eq "set-branch-defaults") { Link Here
364
                branchcode   => undef,
355
                branchcode   => undef,
365
                rules        => {
356
                rules        => {
366
                    patron_maxissueqty             => $patron_maxissueqty,
357
                    patron_maxissueqty             => $patron_maxissueqty,
367
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
368
                }
358
                }
369
            }
359
            }
370
        );
360
        );
Lines 386-392 elsif ($op eq "set-branch-defaults") { Link Here
386
                branchcode   => $branch,
376
                branchcode   => $branch,
387
                rules        => {
377
                rules        => {
388
                    patron_maxissueqty             => $patron_maxissueqty,
378
                    patron_maxissueqty             => $patron_maxissueqty,
389
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
390
                }
379
                }
391
            }
380
            }
392
        );
381
        );
Lines 403-410 elsif ($op eq "set-branch-defaults") { Link Here
403
elsif ($op eq "add-branch-cat") {
392
elsif ($op eq "add-branch-cat") {
404
    my $categorycode  = $input->param('categorycode');
393
    my $categorycode  = $input->param('categorycode');
405
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
394
    my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
406
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
407
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
408
    my $max_holds = $input->param('max_holds');
395
    my $max_holds = $input->param('max_holds');
409
    $max_holds =~ s/\s//g;
396
    $max_holds =~ s/\s//g;
410
    $max_holds = undef if $max_holds !~ /^\d+/;
397
    $max_holds = undef if $max_holds !~ /^\d+/;
Lines 418-424 elsif ($op eq "add-branch-cat") { Link Here
418
                    rules        => {
405
                    rules        => {
419
                        max_holds         => $max_holds,
406
                        max_holds         => $max_holds,
420
                        patron_maxissueqty       => $patron_maxissueqty,
407
                        patron_maxissueqty       => $patron_maxissueqty,
421
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
422
                    }
408
                    }
423
                }
409
                }
424
            );
410
            );
Lines 430-436 elsif ($op eq "add-branch-cat") { Link Here
430
                    rules        => {
416
                    rules        => {
431
                        max_holds         => $max_holds,
417
                        max_holds         => $max_holds,
432
                        patron_maxissueqty       => $patron_maxissueqty,
418
                        patron_maxissueqty       => $patron_maxissueqty,
433
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
434
                    }
419
                    }
435
                }
420
                }
436
            );
421
            );
Lines 443-449 elsif ($op eq "add-branch-cat") { Link Here
443
                rules        => {
428
                rules        => {
444
                    max_holds         => $max_holds,
429
                    max_holds         => $max_holds,
445
                    patron_maxissueqty       => $patron_maxissueqty,
430
                    patron_maxissueqty       => $patron_maxissueqty,
446
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
447
                }
431
                }
448
            }
432
            }
449
        );
433
        );
Lines 455-461 elsif ($op eq "add-branch-cat") { Link Here
455
                rules        => {
439
                rules        => {
456
                    max_holds         => $max_holds,
440
                    max_holds         => $max_holds,
457
                    patron_maxissueqty       => $patron_maxissueqty,
441
                    patron_maxissueqty       => $patron_maxissueqty,
458
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
459
                }
442
                }
460
            }
443
            }
461
        );
444
        );
(-)a/installer/data/mysql/atomicupdate/bug_25089_2_convert_circulation_rules.perl (+33 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    # First, convert maxonsiteissueqty to maxissueqty
5
    my $update_sth = $dbh->prepare(q|
6
        UPDATE circulation_rules
7
        SET checkout_type = ?,
8
            rule_name = ?
9
        WHERE rule_name=?
10
    |);
11
    $update_sth->execute(
12
        'ONSITE',                       # checkout_type => 'ONSITE' (on-site checkout)
13
        'maxissueqty',
14
        'maxonsiteissueqty'
15
    );
16
17
    # Then, convert patron_maxonsiteissueqty to patron_maxissueqty
18
    $update_sth = $dbh->prepare(q|
19
        UPDATE circulation_rules
20
        SET checkout_type = ?,
21
            rule_name = ?
22
        WHERE rule_name=?
23
    |);
24
    $update_sth->execute(
25
        'ONSITE',                       # checkout_type => 'ONSITE' (on-site checkout)
26
        'patron_maxissueqty',
27
        'patron_maxonsiteissueqty'
28
    );
29
30
    # Always end with this (adjust the bug info)
31
    SetVersion( $DBversion );
32
    print "Upgrade to $DBversion done (Bug 25089 - Convert maxonsiteissueqty to maxissueqty )\n";
33
}
(-)a/installer/onboarding.pl (-1 lines)
Lines 273-279 if ( $step == 5 ) { Link Here
273
                holds_per_day                    => $holds_per_day,
273
                holds_per_day                    => $holds_per_day,
274
                holds_per_record                 => $holds_per_record,
274
                holds_per_record                 => $holds_per_record,
275
                maxissueqty                      => $maxissueqty,
275
                maxissueqty                      => $maxissueqty,
276
                maxonsiteissueqty                => "",
277
                maxsuspensiondays                => "",
276
                maxsuspensiondays                => "",
278
                no_auto_renewal_after            => "",
277
                no_auto_renewal_after            => "",
279
                no_auto_renewal_after_hard_limit => "",
278
                no_auto_renewal_after_hard_limit => "",
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-32 / +5 lines)
Lines 91-97 Link Here
91
                <th>Actions</th>
91
                <th>Actions</th>
92
                <th>Note</th>
92
                <th>Note</th>
93
                <th>Current checkouts allowed</th>
93
                <th>Current checkouts allowed</th>
94
                <th>Current on-site checkouts allowed</th>
95
                <th>Loan period</th>
94
                <th>Loan period</th>
96
                <th>Days mode</th>
95
                <th>Days mode</th>
97
                <th>Unit</th>
96
                <th>Unit</th>
Lines 129-135 Link Here
129
                        [% SET i = '' UNLESS i.defined %]
128
                        [% SET i = '' UNLESS i.defined %]
130
                        [% SET note = all_rules.$c.$i.note %]
129
                        [% SET note = all_rules.$c.$i.note %]
131
                        [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
130
                        [% SET maxissueqty = all_rules.$c.$i.maxissueqty %]
132
                        [% SET maxonsiteissueqty = all_rules.$c.$i.maxonsiteissueqty %]
133
                        [% SET issuelength = all_rules.$c.$i.issuelength %]
131
                        [% SET issuelength = all_rules.$c.$i.issuelength %]
134
                        [% SET daysmode = all_rules.$c.$i.daysmode %]
132
                        [% SET daysmode = all_rules.$c.$i.daysmode %]
135
                        [% SET lengthunit = all_rules.$c.$i.lengthunit %]
133
                        [% SET lengthunit = all_rules.$c.$i.lengthunit %]
Lines 158-164 Link Here
158
                        [% SET article_requests = all_rules.$c.$i.article_requests %]
156
                        [% SET article_requests = all_rules.$c.$i.article_requests %]
159
                        [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
157
                        [% SET rentaldiscount = all_rules.$c.$i.rentaldiscount %]
160
158
161
                        [% SET show_rule = note || maxissueqty || maxonsiteissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount %]
159
                        [% SET show_rule = note || maxissueqty || issuelength || daysmode || lengthunit || hardduedate || hardduedatecompare || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalperiod || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || rentaldiscount %]
162
                        [% IF show_rule %]
160
                        [% IF show_rule %]
163
                            [% SET row_count = row_count + 1 %]
161
                            [% SET row_count = row_count + 1 %]
164
                            <tr row_countd="row_[% row_count | html %]">
162
                            <tr row_countd="row_[% row_count | html %]">
Lines 192-204 Link Here
192
                                            <span>Unlimited</span>
190
                                            <span>Unlimited</span>
193
                                        [% END %]
191
                                        [% END %]
194
                                    </td>
192
                                    </td>
195
                                    <td>
196
                                        [% IF maxonsiteissueqty.defined && maxonsiteissueqty != ''  %]
197
                                            [% maxonsiteissueqty | html %]
198
                                        [% ELSE %]
199
                                            <span>Unlimited</span>
200
                                        [% END %]
201
                                    </td>
202
                                    <td>[% issuelength | html %]</td>
193
                                    <td>[% issuelength | html %]</td>
203
                                    <td>
194
                                    <td>
204
                                        [% SWITCH daysmode %]
195
                                        [% SWITCH daysmode %]
Lines 344-350 Link Here
344
                    </td>
335
                    </td>
345
                    <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
336
                    <td><input type="text" name="note" id="note" size="15" value="" maxlength="100"></td>
346
                    <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
337
                    <td><input type="text" name="maxissueqty" id="maxissueqty" size="3" /></td>
347
                    <td><input type="text" name="maxonsiteissueqty" id="maxonsiteissueqty" size="3" /></td>
348
                    <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
338
                    <td><input type="text" name="issuelength" id="issuelength" size="3" /> </td>
349
                    <td>
339
                    <td>
350
                        <select name="daysmode" id="daysmode">
340
                        <select name="daysmode" id="daysmode">
Lines 437-443 Link Here
437
                      <th>&nbsp;</th>
427
                      <th>&nbsp;</th>
438
                      <th>Note</th>
428
                      <th>Note</th>
439
                      <th>Current checkouts allowed</th>
429
                      <th>Current checkouts allowed</th>
440
                      <th>Current on-site checkouts allowed</th>
441
                      <th>Loan period</th>
430
                      <th>Loan period</th>
442
                      <th>Days mode</th>
431
                      <th>Days mode</th>
443
                      <th>Unit</th>
432
                      <th>Unit</th>
Lines 481-487 Link Here
481
                <tr>
470
                <tr>
482
                    <th>&nbsp;</th>
471
                    <th>&nbsp;</th>
483
                    <th>Total current checkouts allowed</th>
472
                    <th>Total current checkouts allowed</th>
484
                    <th>Total current on-site checkouts allowed</th>
485
                    <th>Maximum total holds allowed (count)</th>
473
                    <th>Maximum total holds allowed (count)</th>
486
                    <th>Hold policy</th>
474
                    <th>Hold policy</th>
487
                    <th>Hold pickup library match</th>
475
                    <th>Hold pickup library match</th>
Lines 494-503 Link Here
494
                        [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
482
                        [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty' ) %]
495
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
483
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
496
                    </td>
484
                    </td>
497
                    <td>
498
                        [% SET patron_maxonsiteissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxonsiteissueqty' ) %]
499
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
500
                    </td>
501
                    <td>
485
                    <td>
502
                        [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
486
                        [% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds' ) %]
503
                        <input name="max_holds" size="3" value="[% rule_value | html %]" />
487
                        <input name="max_holds" size="3" value="[% rule_value | html %]" />
Lines 656-672 Link Here
656
                <tr>
640
                <tr>
657
                    <th>Patron category</th>
641
                    <th>Patron category</th>
658
                    <th>Total current checkouts allowed</th>
642
                    <th>Total current checkouts allowed</th>
659
                    <th>Total current on-site checkouts allowed</th>
660
                    <th>Total holds allowed</th>
643
                    <th>Total holds allowed</th>
661
                    <th>&nbsp;</th>
644
                    <th>&nbsp;</th>
662
                </tr>
645
                </tr>
663
                [% FOREACH c IN categorycodes %]
646
                [% FOREACH c IN categorycodes %]
664
                    [% NEXT UNLESS c %]
647
                    [% NEXT UNLESS c %]
665
                    [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
648
                    [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
666
                    [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
667
                    [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
649
                    [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
668
650
669
                    [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
651
                    [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
670
                    <tr>
652
                    <tr>
671
                        <td>
653
                        <td>
672
                            [% IF c == undef %]
654
                            [% IF c == undef %]
Lines 682-694 Link Here
682
                                <span>Unlimited</span>
664
                                <span>Unlimited</span>
683
                            [% END %]
665
                            [% END %]
684
                        </td>
666
                        </td>
685
                        <td>
686
                            [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
687
                                [% patron_maxonsiteissueqty | html %]
688
                            [% ELSE %]
689
                                <span>Unlimited</span>
690
                            [% END %]
691
                        </td>
692
                        <td>
667
                        <td>
693
                            [% IF max_holds.defined && max_holds != '' %]
668
                            [% IF max_holds.defined && max_holds != '' %]
694
                                [% max_holds | html %]
669
                                [% max_holds | html %]
Lines 712-718 Link Here
712
                        </select>
687
                        </select>
713
                    </td>
688
                    </td>
714
                    <td><input name="patron_maxissueqty" size="3" type="text" /></td>
689
                    <td><input name="patron_maxissueqty" size="3" type="text" /></td>
715
                    <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
716
                    <td><input name="max_holds" size="3" type="text" /></td>
690
                    <td><input name="max_holds" size="3" type="text" /></td>
717
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
691
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
718
                </tr>
692
                </tr>
Lines 1009-1015 Link Here
1009
                        // specific processing for the Note column
983
                        // specific processing for the Note column
1010
                        var note = $(this).find("a[name='viewnote']").data("content");
984
                        var note = $(this).find("a[name='viewnote']").data("content");
1011
                        $(current_column).find("input[type='text']").val(note);
985
                        $(current_column).find("input[type='text']").val(note);
1012
                    } else if ( i == 9 ) {
986
                    } else if ( i == 8 ) {
1013
                        // specific processing for the Hard due date column
987
                        // specific processing for the Hard due date column
1014
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
988
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1015
                        var input_value = '';
989
                        var input_value = '';
Lines 1020-1026 Link Here
1020
                        }
994
                        }
1021
                        $(current_column).find("input[type='text']").val(input_value);
995
                        $(current_column).find("input[type='text']").val(input_value);
1022
                        $(current_column).find("select").val(select_value);
996
                        $(current_column).find("select").val(select_value);
1023
                    } else if ( i == 15 ) {
997
                    } else if ( i == 14 ) {
1024
                        // specific processing for cap_fine_to_replacement_price
998
                        // specific processing for cap_fine_to_replacement_price
1025
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
999
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1026
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1000
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
Lines 1045-1054 Link Here
1045
                            // Remove potential previous input added
1019
                            // Remove potential previous input added
1046
                            $(current_column).find("input").remove();
1020
                            $(current_column).find("input").remove();
1047
                            $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1021
                            $(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
1048
                        } else if ( i == 5 || i == 6 || i == 25 || i == 26 || i == 27 ) {
1022
                        } else if ( i == 5 || i == 25 || i == 26 || i == 27 ) {
1049
                            // If the value is not an integer for
1023
                            // If the value is not an integer for
1050
                            //     - "Current checkouts allowed"
1024
                            //     - "Current checkouts allowed"
1051
                            //     - "Current on-site checkouts allowed"
1052
                            //     - "Holds allowed (total)"
1025
                            //     - "Holds allowed (total)"
1053
                            //     - "Holds allowed (daily)"
1026
                            //     - "Holds allowed (daily)"
1054
                            //     - "Holds per record (count)"
1027
                            //     - "Holds per record (count)"
(-)a/t/db_dependent/Circulation/Branch.t (-14 / +33 lines)
Lines 25-31 use Koha::CirculationRules; Link Here
25
25
26
use Koha::Patrons;
26
use Koha::Patrons;
27
27
28
use Test::More tests => 14;
28
use Test::More tests => 15;
29
use t::lib::Mocks;
29
use t::lib::Mocks;
30
use t::lib::TestBuilder;
30
use t::lib::TestBuilder;
31
31
Lines 143-171 my $borrower_id1 = Koha::Patron->new({ Link Here
143
143
144
is_deeply(
144
is_deeply(
145
    GetBranchBorrowerCircRule(),
145
    GetBranchBorrowerCircRule(),
146
    { patron_maxissueqty => undef, patron_maxonsiteissueqty => undef },
146
    { patron_maxissueqty => undef },
147
"Without parameter, GetBranchBorrower returns undef (unilimited) for patron_maxissueqty and patron_maxonsiteissueqty if no rules defined"
147
"Without parameter, GetBranchBorrower returns undef (unilimited) for patron_maxissueqty if no rules defined"
148
);
148
);
149
149
150
Koha::CirculationRules->set_rules(
150
Koha::CirculationRules->set_rules(
151
    {
151
    {
152
        branchcode   => $samplebranch1->{branchcode},
152
        branchcode   => $samplebranch1->{branchcode},
153
        categorycode => $samplecat->{categorycode},
153
        categorycode => $samplecat->{categorycode},
154
        checkout_type => undef,
154
        rules        => {
155
        rules        => {
155
            patron_maxissueqty       => 5,
156
            patron_maxissueqty       => 5,
156
            patron_maxonsiteissueqty => 6,
157
        }
157
        }
158
    }
158
    }
159
);
159
);
160
160
161
Koha::CirculationRules->set_rules(
162
    {
163
        branchcode   => $samplebranch1->{branchcode},
164
        categorycode => $samplecat->{categorycode},
165
        checkout_type => $Koha::Checkouts::type->{onsite_checkout},
166
        rules        => {
167
            patron_maxissueqty       => 9001,
168
        }
169
    }
170
);
161
171
162
Koha::CirculationRules->set_rules(
172
Koha::CirculationRules->set_rules(
163
    {
173
    {
164
        branchcode   => $samplebranch2->{branchcode},
174
        branchcode   => $samplebranch2->{branchcode},
165
        categorycode => undef,
175
        categorycode => undef,
176
        checkout_type => undef,
166
        rules        => {
177
        rules        => {
167
            patron_maxissueqty       => 3,
178
            patron_maxissueqty       => 3,
168
            patron_maxonsiteissueqty => 2,
169
        }
179
        }
170
    }
180
    }
171
);
181
);
Lines 184-192 Koha::CirculationRules->set_rules( Link Here
184
    {
194
    {
185
        branchcode   => undef,
195
        branchcode   => undef,
186
        categorycode => undef,
196
        categorycode => undef,
197
        checkout_type => undef,
187
        rules        => {
198
        rules        => {
188
            patron_maxissueqty       => 4,
199
            patron_maxissueqty       => 4,
189
            patron_maxonsiteissueqty => 5,
190
        }
200
        }
191
    }
201
    }
192
);
202
);
Lines 235-260 Koha::CirculationRules->set_rules( Link Here
235
#Test GetBranchBorrowerCircRule
245
#Test GetBranchBorrowerCircRule
236
is_deeply(
246
is_deeply(
237
    GetBranchBorrowerCircRule(),
247
    GetBranchBorrowerCircRule(),
238
    { patron_maxissueqty => 4, patron_maxonsiteissueqty => 5 },
248
    { patron_maxissueqty => 4 },
239
"Without parameter, GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty of default_circ_rules"
249
"Without parameter, GetBranchBorrower returns the patron_maxissueqty of default_circ_rules"
240
);
250
);
241
is_deeply(
251
is_deeply(
242
    GetBranchBorrowerCircRule( $samplebranch2->{branchcode} ),
252
    GetBranchBorrowerCircRule( $samplebranch2->{branchcode} ),
243
    { patron_maxissueqty => 3, patron_maxonsiteissueqty => 2 },
253
    { patron_maxissueqty => 3 },
244
"Without only the branchcode specified, GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty corresponding"
254
"Without only the branchcode specified, GetBranchBorrower returns the patron_maxissueqty corresponding"
245
);
255
);
246
is_deeply(
256
is_deeply(
247
    GetBranchBorrowerCircRule(
257
    GetBranchBorrowerCircRule(
248
        $samplebranch1->{branchcode},
258
        $samplebranch1->{branchcode},
249
        $samplecat->{categorycode}
259
        $samplecat->{categorycode}
250
    ),
260
    ),
251
    { patron_maxissueqty => 5, patron_maxonsiteissueqty => 6 },
261
    { patron_maxissueqty => 5 },
252
    "GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty of the branch1 and the category1"
262
    "GetBranchBorrower returns the patron_maxissueqty of the branch1 and the category1"
263
);
264
is_deeply(
265
    GetBranchBorrowerCircRule(
266
        $samplebranch1->{branchcode},
267
        $samplecat->{categorycode},
268
        $Koha::Checkouts::type->{onsite_checkout}
269
    ),
270
    { patron_maxissueqty => 9001 },
271
     "GetBranchBorrower returns the patron_maxissueqty of the branch1 and the category1 and checkout_type on-site"
253
);
272
);
254
is_deeply(
273
is_deeply(
255
    GetBranchBorrowerCircRule( -1, -1 ),
274
    GetBranchBorrowerCircRule( -1, -1 ),
256
    { patron_maxissueqty => 4, patron_maxonsiteissueqty => 5 },
275
    { patron_maxissueqty => 4 },
257
"GetBranchBorrower with wrong parameters returns the patron_maxissueqty and patron_maxonsiteissueqty of default_circ_rules"
276
"GetBranchBorrower with wrong parameters returns the patron_maxissueqty of default_circ_rules"
258
);
277
);
259
278
260
#Test GetBranchItemRule
279
#Test GetBranchItemRule
(-)a/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t (-2 / +24 lines)
Lines 87-95 Koha::CirculationRules->set_rules( Link Here
87
        branchcode   => $branch->{branchcode},
87
        branchcode   => $branch->{branchcode},
88
        categorycode => undef,
88
        categorycode => undef,
89
        itemtype     => undef,
89
        itemtype     => undef,
90
        checkout_type => undef,
90
        rules        => {
91
        rules        => {
91
            maxissueqty       => 2,
92
            maxissueqty       => 2,
92
            maxonsiteissueqty => 1,
93
            lengthunit        => 'days',
93
            lengthunit        => 'days',
94
            issuelength       => 5,
94
            issuelength       => 5,
95
            hardduedate        => undef,
95
            hardduedate        => undef,
Lines 97-102 Koha::CirculationRules->set_rules( Link Here
97
        }
97
        }
98
    }
98
    }
99
);
99
);
100
Koha::CirculationRules->set_rules(
101
    {
102
        branchcode   => $branch->{branchcode},
103
        categorycode => undef,
104
        itemtype     => undef,
105
        checkout_type => $Koha::Checkouts::type->{onsite_checkout},
106
        rules        => {
107
            maxissueqty       => 1,
108
        }
109
    }
110
);
100
111
101
t::lib::Mocks::mock_userenv({ patron => $patron });
112
t::lib::Mocks::mock_userenv({ patron => $patron });
102
113
Lines 159-167 Koha::CirculationRules->set_rules( Link Here
159
        branchcode   => $branch->{branchcode},
170
        branchcode   => $branch->{branchcode},
160
        categorycode => undef,
171
        categorycode => undef,
161
        itemtype     => undef,
172
        itemtype     => undef,
173
        checkout_type => undef,
174
        rules        => {
175
            maxissueqty       => 2,
176
        }
177
    }
178
);
179
Koha::CirculationRules->set_rules(
180
    {
181
        branchcode   => $branch->{branchcode},
182
        categorycode => undef,
183
        itemtype     => undef,
184
        checkout_type => $Koha::Checkouts::type->{onsite_checkout},
162
        rules        => {
185
        rules        => {
163
            maxissueqty       => 2,
186
            maxissueqty       => 2,
164
            maxonsiteissueqty => 1,
165
        }
187
        }
166
    }
188
    }
167
);
189
);
(-)a/t/db_dependent/Circulation/TooMany.t (-13 / +24 lines)
Lines 108-116 subtest '1 Issuingrule exist 0 0: no issue allowed' => sub { Link Here
108
            branchcode   => $branch->{branchcode},
108
            branchcode   => $branch->{branchcode},
109
            categorycode => $category->{categorycode},
109
            categorycode => $category->{categorycode},
110
            itemtype     => undef,
110
            itemtype     => undef,
111
            checkout_type => undef,
111
            rules        => {
112
            rules        => {
112
                maxissueqty       => 0,
113
                maxissueqty       => 0,
113
                maxonsiteissueqty => 0,
114
            }
114
            }
115
        },
115
        },
116
    );
116
    );
Lines 165-173 subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub { Link Here
165
            branchcode   => $branch->{branchcode},
165
            branchcode   => $branch->{branchcode},
166
            categorycode => $category->{categorycode},
166
            categorycode => $category->{categorycode},
167
            itemtype     => undef,
167
            itemtype     => undef,
168
            checkout_type => undef,
168
            rules        => {
169
            rules        => {
169
                maxissueqty       => 1,
170
                maxissueqty       => 1,
170
                maxonsiteissueqty => undef,
171
            }
172
        },
173
    );
174
    Koha::CirculationRules->set_rules(
175
        {
176
            branchcode   => $branch->{branchcode},
177
            categorycode => $category->{categorycode},
178
            itemtype     => undef,
179
            checkout_type => $Koha::Checkouts::type->{onsite_checkout},
180
            rules        => {
181
                maxissueqty       => undef,
171
            }
182
            }
172
        },
183
        },
173
    );
184
    );
Lines 220-228 subtest '1 Issuingrule exist 1 1: issue is allowed' => sub { Link Here
220
            branchcode   => $branch->{branchcode},
231
            branchcode   => $branch->{branchcode},
221
            categorycode => $category->{categorycode},
232
            categorycode => $category->{categorycode},
222
            itemtype     => undef,
233
            itemtype     => undef,
234
            checkout_type => undef,
223
            rules        => {
235
            rules        => {
224
                maxissueqty       => 1,
236
                maxissueqty       => 1,
225
                maxonsiteissueqty => 1,
226
            }
237
            }
227
        }
238
        }
228
    );
239
    );
Lines 260-268 subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub { Link Here
260
            branchcode   => $branch->{branchcode},
271
            branchcode   => $branch->{branchcode},
261
            categorycode => $category->{categorycode},
272
            categorycode => $category->{categorycode},
262
            itemtype     => undef,
273
            itemtype     => undef,
274
            checkout_type => undef,
263
            rules        => {
275
            rules        => {
264
                maxissueqty       => 1,
276
                maxissueqty       => 1,
265
                maxonsiteissueqty => 1,
266
            }
277
            }
267
        }
278
        }
268
    );
279
    );
Lines 316-324 subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub { Link Here
316
            branchcode   => $branch->{branchcode},
327
            branchcode   => $branch->{branchcode},
317
            categorycode => $category->{categorycode},
328
            categorycode => $category->{categorycode},
318
            itemtype     => undef,
329
            itemtype     => undef,
330
            checkout_type => undef,
319
            rules        => {
331
            rules        => {
320
                maxissueqty       => 1,
332
                maxissueqty       => 1,
321
                maxonsiteissueqty => 1,
322
            }
333
            }
323
        }
334
        }
324
    );
335
    );
Lines 375-383 subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { Link Here
375
            branchcode   => $branch->{branchcode},
386
            branchcode   => $branch->{branchcode},
376
            categorycode => $category->{categorycode},
387
            categorycode => $category->{categorycode},
377
            itemtype     => undef,
388
            itemtype     => undef,
389
            checkout_type => undef,
378
            rules        => {
390
            rules        => {
379
                maxissueqty       => 1,
391
                maxissueqty       => 1,
380
                maxonsiteissueqty => 1,
381
            }
392
            }
382
        }
393
        }
383
    );
394
    );
Lines 427-435 subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { Link Here
427
            branchcode   => $branch->{branchcode},
438
            branchcode   => $branch->{branchcode},
428
            categorycode => $category->{categorycode},
439
            categorycode => $category->{categorycode},
429
            itemtype     => undef,
440
            itemtype     => undef,
441
            checkout_type => undef,
430
            rules        => {
442
            rules        => {
431
                maxissueqty       => 1,
443
                maxissueqty       => 1,
432
                maxonsiteissueqty => 1,
433
            }
444
            }
434
        }
445
        }
435
    );
446
    );
Lines 505-510 subtest 'General vs specific rules limit quantity correctly' => sub { Link Here
505
            categorycode => '*',
516
            categorycode => '*',
506
            itemtype     => $itemtype->{itemtype},
517
            itemtype     => $itemtype->{itemtype},
507
            branchcode   => '*',
518
            branchcode   => '*',
519
            checkout_type => '*',
508
            rules        => {
520
            rules        => {
509
                issuelength => 1,
521
                issuelength => 1,
510
                firstremind => 1,        # 1 day of grace
522
                firstremind => 1,        # 1 day of grace
Lines 519-528 subtest 'General vs specific rules limit quantity correctly' => sub { Link Here
519
        {
531
        {
520
            branchcode   => '*',
532
            branchcode   => '*',
521
            categorycode => '*',
533
            categorycode => '*',
534
            checkout_type => '*',
522
            itemtype     => $itemtype->{itemtype},
535
            itemtype     => $itemtype->{itemtype},
523
            rules        => {
536
            rules        => {
524
                maxissueqty       => 1,
537
                maxissueqty       => 1,
525
                maxonsiteissueqty => 1,
526
            }
538
            }
527
        }
539
        }
528
    );
540
    );
Lines 573-581 subtest 'General vs specific rules limit quantity correctly' => sub { Link Here
573
            branchcode   => $branch->{branchcode},
585
            branchcode   => $branch->{branchcode},
574
            categorycode => $category->{categorycode},
586
            categorycode => $category->{categorycode},
575
            itemtype     => $itemtype->{itemtype},
587
            itemtype     => $itemtype->{itemtype},
588
            checkout_type => undef,
576
            rules        => {
589
            rules        => {
577
                maxissueqty       => 1,
590
                maxissueqty       => 1,
578
                maxonsiteissueqty => 1,
579
            }
591
            }
580
        }
592
        }
581
    );
593
    );
Lines 669-677 subtest 'General vs specific rules limit quantity correctly' => sub { Link Here
669
            branchcode   => $branch2->{branchcode},
681
            branchcode   => $branch2->{branchcode},
670
            categorycode => $category->{categorycode},
682
            categorycode => $category->{categorycode},
671
            itemtype     => $itemtype->{itemtype},
683
            itemtype     => $itemtype->{itemtype},
684
            checkout_type => undef,
672
            rules        => {
685
            rules        => {
673
                maxissueqty       => 1,
686
                maxissueqty       => 1,
674
                maxonsiteissueqty => 1,
675
            }
687
            }
676
        }
688
        }
677
    );
689
    );
Lines 691-699 subtest 'empty string means unlimited' => sub { Link Here
691
            branchcode   => '*',
703
            branchcode   => '*',
692
            categorycode => '*',
704
            categorycode => '*',
693
            itemtype     => '*',
705
            itemtype     => '*',
706
            checkout_type => '*',
694
            rules        => {
707
            rules        => {
695
                maxissueqty       => '',
708
                maxissueqty       => '',
696
                maxonsiteissueqty => '',
697
            }
709
            }
698
        },
710
        },
699
    );
711
    );
Lines 706-712 subtest 'empty string means unlimited' => sub { Link Here
706
    is(
718
    is(
707
        C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ),
719
        C4::Circulation::TooMany( $patron, $item_object, { onsite_checkout => 1 } ),
708
        undef,
720
        undef,
709
        'maxonsiteissueqty="" should mean unlimited'
721
        'maxissueqty="" should mean unlimited'
710
    );
722
    );
711
723
712
    teardown();
724
    teardown();
713
- 

Return to bug 25089