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

(-)a/C4/Circulation.pm (-11 / +11 lines)
Lines 505-511 sub TooMany { Link Here
505
505
506
    # Now count total loans against the limit for the branch
506
    # Now count total loans against the limit for the branch
507
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
507
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
508
    if (defined($branch_borrower_circ_rule->{maxissueqty})) {
508
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty})) {
509
        my @bind_params = ();
509
        my @bind_params = ();
510
        my $branch_count_query = q|
510
        my $branch_count_query = q|
511
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
511
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
Lines 525-532 sub TooMany { Link Here
525
            push @bind_params, $branch;
525
            push @bind_params, $branch;
526
        }
526
        }
527
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
527
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
528
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{maxissueqty};
528
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty};
529
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{maxonsiteissueqty};
529
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxonsiteissueqty};
530
530
531
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
531
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
532
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
532
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
Lines 557-563 sub TooMany { Link Here
557
        }
557
        }
558
    }
558
    }
559
559
560
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{maxissueqty}) ) {
560
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{patron_maxissueqty}) ) {
561
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
561
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
562
    }
562
    }
563
563
Lines 1588-1598 Retrieves circulation rule attributes that apply to the given Link Here
1588
branch and patron category, regardless of item type.  
1588
branch and patron category, regardless of item type.  
1589
The return value is a hashref containing the following key:
1589
The return value is a hashref containing the following key:
1590
1590
1591
maxissueqty - maximum number of loans that a
1591
patron_maxissueqty - maximum number of loans that a
1592
patron of the given category can have at the given
1592
patron of the given category can have at the given
1593
branch.  If the value is undef, no limit.
1593
branch.  If the value is undef, no limit.
1594
1594
1595
maxonsiteissueqty - maximum of on-site checkouts that a
1595
patron_maxonsiteissueqty - maximum of on-site checkouts that a
1596
patron of the given category can have at the given
1596
patron of the given category can have at the given
1597
branch.  If the value is undef, no limit.
1597
branch.  If the value is undef, no limit.
1598
1598
Lines 1605-1612 default branch and category Link Here
1605
If no rule has been found in the database, it will default to
1605
If no rule has been found in the database, it will default to
1606
the buillt in rule:
1606
the buillt in rule:
1607
1607
1608
maxissueqty - undef
1608
patron_maxissueqty - undef
1609
maxonsiteissueqty - undef
1609
patron_maxonsiteissueqty - undef
1610
1610
1611
C<$branchcode> and C<$categorycode> should contain the
1611
C<$branchcode> and C<$categorycode> should contain the
1612
literal branch code and patron category code, respectively - no
1612
literal branch code and patron category code, respectively - no
Lines 1643-1654 sub GetBranchBorrowerCircRule { Link Here
1643
1643
1644
    # Initialize default values
1644
    # Initialize default values
1645
    my $rules = {
1645
    my $rules = {
1646
        maxissueqty       => undef,
1646
        patron_maxissueqty       => undef,
1647
        maxonsiteissueqty => undef,
1647
        patron_maxonsiteissueqty => undef,
1648
    };
1648
    };
1649
1649
1650
    # Search for rules!
1650
    # Search for rules!
1651
    foreach my $rule_name (qw( maxissueqty maxonsiteissueqty )) {
1651
    foreach my $rule_name (qw( patron_maxissueqty patron_maxonsiteissueqty )) {
1652
        foreach my $params (@params) {
1652
        foreach my $params (@params) {
1653
            my $rule = Koha::CirculationRules->search(
1653
            my $rule = Koha::CirculationRules->search(
1654
                {
1654
                {
(-)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 237-252 elsif ($op eq 'add') { Link Here
237
}
237
}
238
elsif ($op eq "set-branch-defaults") {
238
elsif ($op eq "set-branch-defaults") {
239
    my $categorycode  = $input->param('categorycode');
239
    my $categorycode  = $input->param('categorycode');
240
    my $maxissueqty   = $input->param('maxissueqty');
240
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
241
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
241
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
242
    my $holdallowed   = $input->param('holdallowed');
242
    my $holdallowed   = $input->param('holdallowed');
243
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
243
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
244
    my $returnbranch  = $input->param('returnbranch');
244
    my $returnbranch  = $input->param('returnbranch');
245
    my $max_holds = $input->param('max_holds');
245
    my $max_holds = $input->param('max_holds');
246
    $maxissueqty =~ s/\s//g;
246
    $patron_maxissueqty =~ s/\s//g;
247
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
247
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
248
    $maxonsiteissueqty =~ s/\s//g;
248
    $patron_maxonsiteissueqty =~ s/\s//g;
249
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
249
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
250
    $holdallowed =~ s/\s//g;
250
    $holdallowed =~ s/\s//g;
251
    $holdallowed = undef if $holdallowed !~ /^\d+/;
251
    $holdallowed = undef if $holdallowed !~ /^\d+/;
252
    $max_holds =~ s/\s//g;
252
    $max_holds =~ s/\s//g;
Lines 275-282 elsif ($op eq "set-branch-defaults") { Link Here
275
                itemtype     => undef,
275
                itemtype     => undef,
276
                branchcode   => undef,
276
                branchcode   => undef,
277
                rules        => {
277
                rules        => {
278
                    maxissueqty       => $maxissueqty,
278
                    patron_maxissueqty             => $patron_maxissueqty,
279
                    maxonsiteissueqty => $maxonsiteissueqty,
279
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
280
                }
280
                }
281
            }
281
            }
282
        );
282
        );
Lines 304-311 elsif ($op eq "set-branch-defaults") { Link Here
304
                itemtype     => undef,
304
                itemtype     => undef,
305
                branchcode   => $branch,
305
                branchcode   => $branch,
306
                rules        => {
306
                rules        => {
307
                    maxissueqty       => $maxissueqty,
307
                    patron_maxissueqty             => $patron_maxissueqty,
308
                    maxonsiteissueqty => $maxonsiteissueqty,
308
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
309
                }
309
                }
310
            }
310
            }
311
        );
311
        );
Lines 322-334 elsif ($op eq "set-branch-defaults") { Link Here
322
}
322
}
323
elsif ($op eq "add-branch-cat") {
323
elsif ($op eq "add-branch-cat") {
324
    my $categorycode  = $input->param('categorycode');
324
    my $categorycode  = $input->param('categorycode');
325
    my $maxissueqty   = $input->param('maxissueqty');
325
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
326
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
326
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
327
    my $max_holds = $input->param('max_holds');
327
    my $max_holds = $input->param('max_holds');
328
    $maxissueqty =~ s/\s//g;
328
    $patron_maxissueqty =~ s/\s//g;
329
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
329
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
330
    $maxonsiteissueqty =~ s/\s//g;
330
    $patron_maxonsiteissueqty =~ s/\s//g;
331
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
331
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
332
    $max_holds =~ s/\s//g;
332
    $max_holds =~ s/\s//g;
333
    $max_holds = undef if $max_holds !~ /^\d+/;
333
    $max_holds = undef if $max_holds !~ /^\d+/;
334
334
Lines 341-348 elsif ($op eq "add-branch-cat") { Link Here
341
                    branchcode   => undef,
341
                    branchcode   => undef,
342
                    rules        => {
342
                    rules        => {
343
                        max_holds         => $max_holds,
343
                        max_holds         => $max_holds,
344
                        maxissueqty       => $maxissueqty,
344
                        patron_maxissueqty       => $patron_maxissueqty,
345
                        maxonsiteissueqty => $maxonsiteissueqty,
345
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
346
                    }
346
                    }
347
                }
347
                }
348
            );
348
            );
Lines 354-361 elsif ($op eq "add-branch-cat") { Link Here
354
                    itemtype     => undef,
354
                    itemtype     => undef,
355
                    rules        => {
355
                    rules        => {
356
                        max_holds         => $max_holds,
356
                        max_holds         => $max_holds,
357
                        maxissueqty       => $maxissueqty,
357
                        patron_maxissueqty       => $patron_maxissueqty,
358
                        maxonsiteissueqty => $maxonsiteissueqty,
358
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
359
                    }
359
                    }
360
                }
360
                }
361
            );
361
            );
Lines 368-375 elsif ($op eq "add-branch-cat") { Link Here
368
                branchcode   => $branch,
368
                branchcode   => $branch,
369
                rules        => {
369
                rules        => {
370
                    max_holds         => $max_holds,
370
                    max_holds         => $max_holds,
371
                    maxissueqty       => $maxissueqty,
371
                    patron_maxissueqty       => $patron_maxissueqty,
372
                    maxonsiteissueqty => $maxonsiteissueqty,
372
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
373
                }
373
                }
374
            }
374
            }
375
        );
375
        );
Lines 381-388 elsif ($op eq "add-branch-cat") { Link Here
381
                branchcode   => $branch,
381
                branchcode   => $branch,
382
                rules        => {
382
                rules        => {
383
                    max_holds         => $max_holds,
383
                    max_holds         => $max_holds,
384
                    maxissueqty       => $maxissueqty,
384
                    patron_maxissueqty       => $patron_maxissueqty,
385
                    maxonsiteissueqty => $maxonsiteissueqty,
385
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
386
                }
386
                }
387
            }
387
            }
388
        );
388
        );
(-)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 410-421 Link Here
410
                <tr>
410
                <tr>
411
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
411
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
412
                    <td>
412
                    <td>
413
                        [% SET maxissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxissueqty' ) %]
413
                        [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %]
414
                        <input type="text" name="maxissueqty" size="3" value="[% maxissueqty | html %]"/>
414
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
415
                    </td>
415
                    </td>
416
                    <td>
416
                    <td>
417
                        [% SET maxonsiteissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxonsiteissueqty' ) %]
417
                        [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxonsiteissueqty' ) %]
418
                        <input type="text" name="maxonsiteissueqty" size="3" value="[% maxonsiteissueqty | html %]"/>
418
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
419
                    </td>
419
                    </td>
420
                    <td>
420
                    <td>
421
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
421
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
Lines 533-543 Link Here
533
                    <th>&nbsp;</th>
533
                    <th>&nbsp;</th>
534
                </tr>
534
                </tr>
535
                [% FOREACH c IN categorycodes %]
535
                [% FOREACH c IN categorycodes %]
536
                    [% SET maxissueqty = CirculationRules.Get( branchcode, c, undef, 'maxissueqty' ) %]
536
                    [% SET patron_maxissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxissueqty' ) %]
537
                    [% SET maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'maxonsiteissueqty' ) %]
537
                    [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
538
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
538
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
539
539
540
                    [% IF maxissueqty || maxissueqty || max_holds %]
540
                    [% IF patron_maxissueqty || patron_maxonsiteissueqty || max_holds %]
541
                    <tr>
541
                    <tr>
542
                        <td>
542
                        <td>
543
                            [% IF c == '*'%]
543
                            [% IF c == '*'%]
Lines 547-561 Link Here
547
                            [% END %]
547
                            [% END %]
548
                        </td>
548
                        </td>
549
                        <td>
549
                        <td>
550
                            [% IF maxissueqty  %]
550
                            [% IF patron_maxissueqty  %]
551
                                [% maxissueqty | html %]
551
                                [% patron_maxissueqty | html %]
552
                            [% ELSE %]
552
                            [% ELSE %]
553
                                <span>Unlimited</span>
553
                                <span>Unlimited</span>
554
                            [% END %]
554
                            [% END %]
555
                        </td>
555
                        </td>
556
                        <td>
556
                        <td>
557
                            [% IF maxonsiteissueqty  %]
557
                            [% IF patron_maxonsiteissueqty  %]
558
                                [% maxonsiteissueqty | html %]
558
                                [% patron_maxonsiteissueqty | html %]
559
                            [% ELSE %]
559
                            [% ELSE %]
560
                                <span>Unlimited</span>
560
                                <span>Unlimited</span>
561
                            [% END %]
561
                            [% END %]
Lines 583-590 Link Here
583
                        [% END %]
583
                        [% END %]
584
                        </select>
584
                        </select>
585
                    </td>
585
                    </td>
586
                    <td><input name="maxissueqty" size="3" type="text" /></td>
586
                    <td><input name="patron_maxissueqty" size="3" type="text" /></td>
587
                    <td><input name="maxonsiteissueqty" size="3" type="text" /></td>
587
                    <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
588
                    <td><input name="max_holds" size="3" type="text" /></td>
588
                    <td><input name="max_holds" size="3" type="text" /></td>
589
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
589
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
590
                </tr>
590
                </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