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

(-)a/C4/Circulation.pm (-11 / +11 lines)
Lines 503-509 sub TooMany { Link Here
503
503
504
    # Now count total loans against the limit for the branch
504
    # Now count total loans against the limit for the branch
505
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
505
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
506
    if (defined($branch_borrower_circ_rule->{maxissueqty})) {
506
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty})) {
507
        my @bind_params = ();
507
        my @bind_params = ();
508
        my $branch_count_query = q|
508
        my $branch_count_query = q|
509
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
509
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
Lines 523-530 sub TooMany { Link Here
523
            push @bind_params, $branch;
523
            push @bind_params, $branch;
524
        }
524
        }
525
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
525
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
526
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{maxissueqty};
526
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty};
527
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{maxonsiteissueqty};
527
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxonsiteissueqty};
528
528
529
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
529
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
530
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
530
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
Lines 555-561 sub TooMany { Link Here
555
        }
555
        }
556
    }
556
    }
557
557
558
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{maxissueqty}) ) {
558
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{patron_maxissueqty}) ) {
559
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
559
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
560
    }
560
    }
561
561
Lines 1575-1585 Retrieves circulation rule attributes that apply to the given Link Here
1575
branch and patron category, regardless of item type.  
1575
branch and patron category, regardless of item type.  
1576
The return value is a hashref containing the following key:
1576
The return value is a hashref containing the following key:
1577
1577
1578
maxissueqty - maximum number of loans that a
1578
patron_maxissueqty - maximum number of loans that a
1579
patron of the given category can have at the given
1579
patron of the given category can have at the given
1580
branch.  If the value is undef, no limit.
1580
branch.  If the value is undef, no limit.
1581
1581
1582
maxonsiteissueqty - maximum of on-site checkouts that a
1582
patron_maxonsiteissueqty - maximum of on-site checkouts that a
1583
patron of the given category can have at the given
1583
patron of the given category can have at the given
1584
branch.  If the value is undef, no limit.
1584
branch.  If the value is undef, no limit.
1585
1585
Lines 1592-1599 default branch and category Link Here
1592
If no rule has been found in the database, it will default to
1592
If no rule has been found in the database, it will default to
1593
the buillt in rule:
1593
the buillt in rule:
1594
1594
1595
maxissueqty - undef
1595
patron_maxissueqty - undef
1596
maxonsiteissueqty - undef
1596
patron_maxonsiteissueqty - undef
1597
1597
1598
C<$branchcode> and C<$categorycode> should contain the
1598
C<$branchcode> and C<$categorycode> should contain the
1599
literal branch code and patron category code, respectively - no
1599
literal branch code and patron category code, respectively - no
Lines 1630-1641 sub GetBranchBorrowerCircRule { Link Here
1630
1630
1631
    # Initialize default values
1631
    # Initialize default values
1632
    my $rules = {
1632
    my $rules = {
1633
        maxissueqty       => undef,
1633
        patron_maxissueqty       => undef,
1634
        maxonsiteissueqty => undef,
1634
        patron_maxonsiteissueqty => undef,
1635
    };
1635
    };
1636
1636
1637
    # Search for rules!
1637
    # Search for rules!
1638
    foreach my $rule_name (qw( maxissueqty maxonsiteissueqty )) {
1638
    foreach my $rule_name (qw( patron_maxissueqty patron_maxonsiteissueqty )) {
1639
        foreach my $params (@params) {
1639
        foreach my $params (@params) {
1640
            my $rule = Koha::CirculationRules->search(
1640
            my $rule = Koha::CirculationRules->search(
1641
                {
1641
                {
(-)a/admin/smart-rules.pl (-26 / +26 lines)
Lines 104-111 elsif ($op eq 'delete-branch-cat') { Link Here
104
            itemtype     => undef,
104
            itemtype     => undef,
105
            rules        => {
105
            rules        => {
106
                max_holds         => undef,
106
                max_holds         => undef,
107
                maxissueqty       => undef,
107
                patron_maxissueqty             => undef,
108
                maxonsiteissueqty => undef,
108
                patron_maxonsiteissueqty       => undef,
109
            }
109
            }
110
        }
110
        }
111
    );
111
    );
Lines 235-250 elsif ($op eq 'add') { Link Here
235
}
235
}
236
elsif ($op eq "set-branch-defaults") {
236
elsif ($op eq "set-branch-defaults") {
237
    my $categorycode  = $input->param('categorycode');
237
    my $categorycode  = $input->param('categorycode');
238
    my $maxissueqty   = $input->param('maxissueqty');
238
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
239
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
239
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
240
    my $holdallowed   = $input->param('holdallowed');
240
    my $holdallowed   = $input->param('holdallowed');
241
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
241
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
242
    my $returnbranch  = $input->param('returnbranch');
242
    my $returnbranch  = $input->param('returnbranch');
243
    my $max_holds = $input->param('max_holds');
243
    my $max_holds = $input->param('max_holds');
244
    $maxissueqty =~ s/\s//g;
244
    $patron_maxissueqty =~ s/\s//g;
245
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
245
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
246
    $maxonsiteissueqty =~ s/\s//g;
246
    $patron_maxonsiteissueqty =~ s/\s//g;
247
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
247
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
248
    $holdallowed =~ s/\s//g;
248
    $holdallowed =~ s/\s//g;
249
    $holdallowed = undef if $holdallowed !~ /^\d+/;
249
    $holdallowed = undef if $holdallowed !~ /^\d+/;
250
    $max_holds =~ s/\s//g;
250
    $max_holds =~ s/\s//g;
Lines 273-280 elsif ($op eq "set-branch-defaults") { Link Here
273
                itemtype     => undef,
273
                itemtype     => undef,
274
                branchcode   => undef,
274
                branchcode   => undef,
275
                rules        => {
275
                rules        => {
276
                    maxissueqty       => $maxissueqty,
276
                    patron_maxissueqty             => $patron_maxissueqty,
277
                    maxonsiteissueqty => $maxonsiteissueqty,
277
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
278
                }
278
                }
279
            }
279
            }
280
        );
280
        );
Lines 302-309 elsif ($op eq "set-branch-defaults") { Link Here
302
                itemtype     => undef,
302
                itemtype     => undef,
303
                branchcode   => $branch,
303
                branchcode   => $branch,
304
                rules        => {
304
                rules        => {
305
                    maxissueqty       => $maxissueqty,
305
                    patron_maxissueqty             => $patron_maxissueqty,
306
                    maxonsiteissueqty => $maxonsiteissueqty,
306
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
307
                }
307
                }
308
            }
308
            }
309
        );
309
        );
Lines 320-332 elsif ($op eq "set-branch-defaults") { Link Here
320
}
320
}
321
elsif ($op eq "add-branch-cat") {
321
elsif ($op eq "add-branch-cat") {
322
    my $categorycode  = $input->param('categorycode');
322
    my $categorycode  = $input->param('categorycode');
323
    my $maxissueqty   = $input->param('maxissueqty');
323
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
324
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
324
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
325
    my $max_holds = $input->param('max_holds');
325
    my $max_holds = $input->param('max_holds');
326
    $maxissueqty =~ s/\s//g;
326
    $patron_maxissueqty =~ s/\s//g;
327
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
327
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
328
    $maxonsiteissueqty =~ s/\s//g;
328
    $patron_maxonsiteissueqty =~ s/\s//g;
329
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
329
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
330
    $max_holds =~ s/\s//g;
330
    $max_holds =~ s/\s//g;
331
    $max_holds = undef if $max_holds !~ /^\d+/;
331
    $max_holds = undef if $max_holds !~ /^\d+/;
332
332
Lines 339-346 elsif ($op eq "add-branch-cat") { Link Here
339
                    branchcode   => undef,
339
                    branchcode   => undef,
340
                    rules        => {
340
                    rules        => {
341
                        max_holds         => $max_holds,
341
                        max_holds         => $max_holds,
342
                        maxissueqty       => $maxissueqty,
342
                        patron_maxissueqty       => $patron_maxissueqty,
343
                        maxonsiteissueqty => $maxonsiteissueqty,
343
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
344
                    }
344
                    }
345
                }
345
                }
346
            );
346
            );
Lines 352-359 elsif ($op eq "add-branch-cat") { Link Here
352
                    itemtype     => undef,
352
                    itemtype     => undef,
353
                    rules        => {
353
                    rules        => {
354
                        max_holds         => $max_holds,
354
                        max_holds         => $max_holds,
355
                        maxissueqty       => $maxissueqty,
355
                        patron_maxissueqty       => $patron_maxissueqty,
356
                        maxonsiteissueqty => $maxonsiteissueqty,
356
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
357
                    }
357
                    }
358
                }
358
                }
359
            );
359
            );
Lines 366-373 elsif ($op eq "add-branch-cat") { Link Here
366
                branchcode   => $branch,
366
                branchcode   => $branch,
367
                rules        => {
367
                rules        => {
368
                    max_holds         => $max_holds,
368
                    max_holds         => $max_holds,
369
                    maxissueqty       => $maxissueqty,
369
                    patron_maxissueqty       => $patron_maxissueqty,
370
                    maxonsiteissueqty => $maxonsiteissueqty,
370
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
371
                }
371
                }
372
            }
372
            }
373
        );
373
        );
Lines 379-386 elsif ($op eq "add-branch-cat") { Link Here
379
                branchcode   => $branch,
379
                branchcode   => $branch,
380
                rules        => {
380
                rules        => {
381
                    max_holds         => $max_holds,
381
                    max_holds         => $max_holds,
382
                    maxissueqty       => $maxissueqty,
382
                    patron_maxissueqty       => $patron_maxissueqty,
383
                    maxonsiteissueqty => $maxonsiteissueqty,
383
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
384
                }
384
                }
385
            }
385
            }
386
        );
386
        );
(-)a/installer/data/mysql/atomicupdate/bug_18925.perl (-8 / +8 lines)
Lines 3-14 if( CheckVersion( $DBversion ) ) { Link Here
3
    if ( column_exists( 'branch_borrower_circ_rules', 'maxissueqty' ) ) {
3
    if ( column_exists( 'branch_borrower_circ_rules', 'maxissueqty' ) ) {
4
        $dbh->do("
4
        $dbh->do("
5
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
5
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
6
            SELECT categorycode, branchcode, NULL, 'maxissueqty', maxissueqty
6
            SELECT categorycode, branchcode, NULL, 'patron_maxissueqty', maxissueqty
7
            FROM branch_borrower_circ_rules
7
            FROM branch_borrower_circ_rules
8
        ");
8
        ");
9
        $dbh->do("
9
        $dbh->do("
10
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
10
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
11
            SELECT categorycode, branchcode, NULL, 'maxonsiteissueqty', maxonsiteissueqty
11
            SELECT categorycode, branchcode, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty
12
            FROM branch_borrower_circ_rules
12
            FROM branch_borrower_circ_rules
13
        ");
13
        ");
14
        $dbh->do("DROP TABLE branch_borrower_circ_rules");
14
        $dbh->do("DROP TABLE branch_borrower_circ_rules");
Lines 17-28 if( CheckVersion( $DBversion ) ) { Link Here
17
    if ( column_exists( 'default_borrower_circ_rules', 'maxissueqty' ) ) {
17
    if ( column_exists( 'default_borrower_circ_rules', 'maxissueqty' ) ) {
18
        $dbh->do("
18
        $dbh->do("
19
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
19
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
20
            SELECT categorycode, NULL, NULL, 'maxissueqty', maxissueqty
20
            SELECT categorycode, NULL, NULL, 'patron_maxissueqty', maxissueqty
21
            FROM default_borrower_circ_rules
21
            FROM default_borrower_circ_rules
22
        ");
22
        ");
23
        $dbh->do("
23
        $dbh->do("
24
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
24
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
25
            SELECT categorycode, NULL, NULL, 'maxonsiteissueqty', maxonsiteissueqty
25
            SELECT categorycode, NULL, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty
26
            FROM default_borrower_circ_rules
26
            FROM default_borrower_circ_rules
27
        ");
27
        ");
28
        $dbh->do("DROP TABLE default_borrower_circ_rules");
28
        $dbh->do("DROP TABLE default_borrower_circ_rules");
Lines 31-42 if( CheckVersion( $DBversion ) ) { Link Here
31
    if ( column_exists( 'default_circ_rules', 'maxissueqty' ) ) {
31
    if ( column_exists( 'default_circ_rules', 'maxissueqty' ) ) {
32
        $dbh->do("
32
        $dbh->do("
33
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
33
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
34
            SELECT NULL, NULL, NULL, 'maxissueqty', maxissueqty
34
            SELECT NULL, NULL, NULL, 'patron_maxissueqty', maxissueqty
35
            FROM default_circ_rules
35
            FROM default_circ_rules
36
        ");
36
        ");
37
        $dbh->do("
37
        $dbh->do("
38
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
38
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
39
            SELECT NULL, NULL, NULL, 'maxonsiteissueqty', maxonsiteissueqty
39
            SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty
40
            FROM default_circ_rules
40
            FROM default_circ_rules
41
        ");
41
        ");
42
        $dbh->do("ALTER TABLE default_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
42
        $dbh->do("ALTER TABLE default_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
Lines 45-56 if( CheckVersion( $DBversion ) ) { Link Here
45
    if ( column_exists( 'default_branch_circ_rules', 'maxissueqty' ) ) {
45
    if ( column_exists( 'default_branch_circ_rules', 'maxissueqty' ) ) {
46
        $dbh->do("
46
        $dbh->do("
47
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
47
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
48
            SELECT NULL, branchcode, NULL, 'maxissueqty', maxissueqty
48
            SELECT NULL, branchcode, NULL, 'patron_maxissueqty', maxissueqty
49
            FROM default_branch_circ_rules
49
            FROM default_branch_circ_rules
50
        ");
50
        ");
51
        $dbh->do("
51
        $dbh->do("
52
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
52
            INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
53
            SELECT NULL, NULL, NULL, 'maxonsiteissueqty', maxonsiteissueqty
53
            SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', maxonsiteissueqty
54
            FROM default_branch_circ_rules
54
            FROM default_branch_circ_rules
55
        ");
55
        ");
56
        $dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
56
        $dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-13 / +13 lines)
Lines 402-413 Link Here
402
                <tr>
402
                <tr>
403
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
403
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
404
                    <td>
404
                    <td>
405
                        [% SET maxissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxissueqty' ) %]
405
                        [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %]
406
                        <input type="text" name="maxissueqty" size="3" value="[% maxissueqty | html %]"/>
406
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
407
                    </td>
407
                    </td>
408
                    <td>
408
                    <td>
409
                        [% SET maxonsiteissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxonsiteissueqty' ) %]
409
                        [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxonsiteissueqty' ) %]
410
                        <input type="text" name="maxonsiteissueqty" size="3" value="[% maxonsiteissueqty | html %]"/>
410
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
411
                    </td>
411
                    </td>
412
                    <td>
412
                    <td>
413
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
413
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
Lines 525-535 Link Here
525
                    <th>&nbsp;</th>
525
                    <th>&nbsp;</th>
526
                </tr>
526
                </tr>
527
                [% FOREACH c IN categorycodes %]
527
                [% FOREACH c IN categorycodes %]
528
                    [% SET maxissueqty = CirculationRules.Get( branchcode, c, undef, 'maxissueqty' ) %]
528
                    [% SET patron_maxissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxissueqty' ) %]
529
                    [% SET maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'maxonsiteissueqty' ) %]
529
                    [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
530
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
530
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
531
531
532
                    [% IF maxissueqty || maxissueqty || max_holds %]
532
                    [% IF patron_maxissueqty || patron_maxonsiteissueqty || max_holds %]
533
                    <tr>
533
                    <tr>
534
                        <td>
534
                        <td>
535
                            [% IF c == '*'%]
535
                            [% IF c == '*'%]
Lines 539-553 Link Here
539
                            [% END %]
539
                            [% END %]
540
                        </td>
540
                        </td>
541
                        <td>
541
                        <td>
542
                            [% IF maxissueqty  %]
542
                            [% IF patron_maxissueqty  %]
543
                                [% maxissueqty | html %]
543
                                [% patron_maxissueqty | html %]
544
                            [% ELSE %]
544
                            [% ELSE %]
545
                                <span>Unlimited</span>
545
                                <span>Unlimited</span>
546
                            [% END %]
546
                            [% END %]
547
                        </td>
547
                        </td>
548
                        <td>
548
                        <td>
549
                            [% IF maxonsiteissueqty  %]
549
                            [% IF patron_maxonsiteissueqty  %]
550
                                [% maxonsiteissueqty | html %]
550
                                [% patron_maxonsiteissueqty | html %]
551
                            [% ELSE %]
551
                            [% ELSE %]
552
                                <span>Unlimited</span>
552
                                <span>Unlimited</span>
553
                            [% END %]
553
                            [% END %]
Lines 575-582 Link Here
575
                        [% END %]
575
                        [% END %]
576
                        </select>
576
                        </select>
577
                    </td>
577
                    </td>
578
                    <td><input name="maxissueqty" size="3" type="text" /></td>
578
                    <td><input name="patron_maxissueqty" size="3" type="text" /></td>
579
                    <td><input name="maxonsiteissueqty" size="3" type="text" /></td>
579
                    <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
580
                    <td><input name="max_holds" size="3" type="text" /></td>
580
                    <td><input name="max_holds" size="3" type="text" /></td>
581
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
581
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
582
                </tr>
582
                </tr>
(-)a/t/db_dependent/Circulation/Branch.t (-17 / +16 lines)
Lines 148-155 my $borrower_id1 = Koha::Patron->new({ Link Here
148
148
149
is_deeply(
149
is_deeply(
150
    GetBranchBorrowerCircRule(),
150
    GetBranchBorrowerCircRule(),
151
    { maxissueqty => undef, maxonsiteissueqty => undef },
151
    { patron_maxissueqty => undef, patron_maxonsiteissueqty => undef },
152
"Without parameter, GetBranchBorrower returns undef (unilimited) for maxissueqty and maxonsiteissueqty if no rules defined"
152
"Without parameter, GetBranchBorrower returns undef (unilimited) for patron_maxissueqty and patron_maxonsiteissueqty if no rules defined"
153
);
153
);
154
154
155
Koha::CirculationRules->set_rules(
155
Koha::CirculationRules->set_rules(
Lines 158-165 Koha::CirculationRules->set_rules( Link Here
158
        categorycode => $samplecat->{categorycode},
158
        categorycode => $samplecat->{categorycode},
159
        itemtype     => undef,
159
        itemtype     => undef,
160
        rules        => {
160
        rules        => {
161
            maxissueqty       => 5,
161
            patron_maxissueqty       => 5,
162
            maxonsiteissueqty => 6,
162
            patron_maxonsiteissueqty => 6,
163
        }
163
        }
164
    }
164
    }
165
);
165
);
Lines 176-183 Koha::CirculationRules->set_rules( Link Here
176
        categorycode => undef,
176
        categorycode => undef,
177
        itemtype     => undef,
177
        itemtype     => undef,
178
        rules        => {
178
        rules        => {
179
            maxissueqty       => 3,
179
            patron_maxissueqty       => 3,
180
            maxonsiteissueqty => 2,
180
            patron_maxonsiteissueqty => 2,
181
        }
181
        }
182
    }
182
    }
183
);
183
);
Lines 194-201 Koha::CirculationRules->set_rules( Link Here
194
        categorycode => undef,
194
        categorycode => undef,
195
        itemtype     => undef,
195
        itemtype     => undef,
196
        rules        => {
196
        rules        => {
197
            maxissueqty       => 4,
197
            patron_maxissueqty       => 4,
198
            maxonsiteissueqty => 5,
198
            patron_maxonsiteissueqty => 5,
199
        }
199
        }
200
    }
200
    }
201
);
201
);
Lines 222-247 $sth->execute( Link Here
222
#Test GetBranchBorrowerCircRule
222
#Test GetBranchBorrowerCircRule
223
is_deeply(
223
is_deeply(
224
    GetBranchBorrowerCircRule(),
224
    GetBranchBorrowerCircRule(),
225
    { maxissueqty => 4, maxonsiteissueqty => 5 },
225
    { patron_maxissueqty => 4, patron_maxonsiteissueqty => 5 },
226
"Without parameter, GetBranchBorrower returns the maxissueqty and maxonsiteissueqty of default_circ_rules"
226
"Without parameter, GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty of default_circ_rules"
227
);
227
);
228
is_deeply(
228
is_deeply(
229
    GetBranchBorrowerCircRule( $samplebranch2->{branchcode} ),
229
    GetBranchBorrowerCircRule( $samplebranch2->{branchcode} ),
230
    { maxissueqty => 3, maxonsiteissueqty => 2 },
230
    { patron_maxissueqty => 3, patron_maxonsiteissueqty => 2 },
231
"Without only the branchcode specified, GetBranchBorrower returns the maxissueqty and maxonsiteissueqty corresponding"
231
"Without only the branchcode specified, GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty corresponding"
232
);
232
);
233
is_deeply(
233
is_deeply(
234
    GetBranchBorrowerCircRule(
234
    GetBranchBorrowerCircRule(
235
        $samplebranch1->{branchcode},
235
        $samplebranch1->{branchcode},
236
        $samplecat->{categorycode}
236
        $samplecat->{categorycode}
237
    ),
237
    ),
238
    { maxissueqty => 5, maxonsiteissueqty => 6 },
238
    { patron_maxissueqty => 5, patron_maxonsiteissueqty => 6 },
239
    "GetBranchBorrower returns the maxissueqty and maxonsiteissueqty of the branch1 and the category1"
239
    "GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty of the branch1 and the category1"
240
);
240
);
241
is_deeply(
241
is_deeply(
242
    GetBranchBorrowerCircRule( -1, -1 ),
242
    GetBranchBorrowerCircRule( -1, -1 ),
243
    { maxissueqty => 4, maxonsiteissueqty => 5 },
243
    { patron_maxissueqty => 4, patron_maxonsiteissueqty => 5 },
244
"GetBranchBorrower with wrong parameters returns the maxissueqty and maxonsiteissueqty of default_circ_rules"
244
"GetBranchBorrower with wrong parameters returns the patron_maxissueqty and patron_maxonsiteissueqty of default_circ_rules"
245
);
245
);
246
246
247
#Test GetBranchItemRule
247
#Test GetBranchItemRule
248
- 

Return to bug 18925