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 92-99 elsif ($op eq 'delete-branch-cat') { Link Here
92
            itemtype     => undef,
92
            itemtype     => undef,
93
            rules        => {
93
            rules        => {
94
                max_holds         => undef,
94
                max_holds         => undef,
95
                maxissueqty       => undef,
95
                patron_maxissueqty             => undef,
96
                maxonsiteissueqty => undef,
96
                patron_maxonsiteissueqty       => undef,
97
            }
97
            }
98
        }
98
        }
99
    );
99
    );
Lines 219-234 elsif ($op eq 'add') { Link Here
219
}
219
}
220
elsif ($op eq "set-branch-defaults") {
220
elsif ($op eq "set-branch-defaults") {
221
    my $categorycode  = $input->param('categorycode');
221
    my $categorycode  = $input->param('categorycode');
222
    my $maxissueqty   = $input->param('maxissueqty');
222
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
223
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
223
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
224
    my $holdallowed   = $input->param('holdallowed');
224
    my $holdallowed   = $input->param('holdallowed');
225
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
225
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
226
    my $returnbranch  = $input->param('returnbranch');
226
    my $returnbranch  = $input->param('returnbranch');
227
    my $max_holds = $input->param('max_holds');
227
    my $max_holds = $input->param('max_holds');
228
    $maxissueqty =~ s/\s//g;
228
    $patron_maxissueqty =~ s/\s//g;
229
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
229
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
230
    $maxonsiteissueqty =~ s/\s//g;
230
    $patron_maxonsiteissueqty =~ s/\s//g;
231
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
231
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
232
    $holdallowed =~ s/\s//g;
232
    $holdallowed =~ s/\s//g;
233
    $holdallowed = undef if $holdallowed !~ /^\d+/;
233
    $holdallowed = undef if $holdallowed !~ /^\d+/;
234
    $max_holds =~ s/\s//g;
234
    $max_holds =~ s/\s//g;
Lines 257-264 elsif ($op eq "set-branch-defaults") { Link Here
257
                itemtype     => undef,
257
                itemtype     => undef,
258
                branchcode   => undef,
258
                branchcode   => undef,
259
                rules        => {
259
                rules        => {
260
                    maxissueqty       => $maxissueqty,
260
                    patron_maxissueqty             => $patron_maxissueqty,
261
                    maxonsiteissueqty => $maxonsiteissueqty,
261
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
262
                }
262
                }
263
            }
263
            }
264
        );
264
        );
Lines 286-293 elsif ($op eq "set-branch-defaults") { Link Here
286
                itemtype     => undef,
286
                itemtype     => undef,
287
                branchcode   => $branch,
287
                branchcode   => $branch,
288
                rules        => {
288
                rules        => {
289
                    maxissueqty       => $maxissueqty,
289
                    patron_maxissueqty             => $patron_maxissueqty,
290
                    maxonsiteissueqty => $maxonsiteissueqty,
290
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
291
                }
291
                }
292
            }
292
            }
293
        );
293
        );
Lines 304-316 elsif ($op eq "set-branch-defaults") { Link Here
304
}
304
}
305
elsif ($op eq "add-branch-cat") {
305
elsif ($op eq "add-branch-cat") {
306
    my $categorycode  = $input->param('categorycode');
306
    my $categorycode  = $input->param('categorycode');
307
    my $maxissueqty   = $input->param('maxissueqty');
307
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
308
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
308
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
309
    my $max_holds = $input->param('max_holds');
309
    my $max_holds = $input->param('max_holds');
310
    $maxissueqty =~ s/\s//g;
310
    $patron_maxissueqty =~ s/\s//g;
311
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
311
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
312
    $maxonsiteissueqty =~ s/\s//g;
312
    $patron_maxonsiteissueqty =~ s/\s//g;
313
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
313
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
314
    $max_holds =~ s/\s//g;
314
    $max_holds =~ s/\s//g;
315
    $max_holds = undef if $max_holds !~ /^\d+/;
315
    $max_holds = undef if $max_holds !~ /^\d+/;
316
316
Lines 323-330 elsif ($op eq "add-branch-cat") { Link Here
323
                    branchcode   => undef,
323
                    branchcode   => undef,
324
                    rules        => {
324
                    rules        => {
325
                        max_holds         => $max_holds,
325
                        max_holds         => $max_holds,
326
                        maxissueqty       => $maxissueqty,
326
                        patron_maxissueqty       => $patron_maxissueqty,
327
                        maxonsiteissueqty => $maxonsiteissueqty,
327
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
328
                    }
328
                    }
329
                }
329
                }
330
            );
330
            );
Lines 336-343 elsif ($op eq "add-branch-cat") { Link Here
336
                    itemtype     => undef,
336
                    itemtype     => undef,
337
                    rules        => {
337
                    rules        => {
338
                        max_holds         => $max_holds,
338
                        max_holds         => $max_holds,
339
                        maxissueqty       => $maxissueqty,
339
                        patron_maxissueqty       => $patron_maxissueqty,
340
                        maxonsiteissueqty => $maxonsiteissueqty,
340
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
341
                    }
341
                    }
342
                }
342
                }
343
            );
343
            );
Lines 350-357 elsif ($op eq "add-branch-cat") { Link Here
350
                branchcode   => $branch,
350
                branchcode   => $branch,
351
                rules        => {
351
                rules        => {
352
                    max_holds         => $max_holds,
352
                    max_holds         => $max_holds,
353
                    maxissueqty       => $maxissueqty,
353
                    patron_maxissueqty       => $patron_maxissueqty,
354
                    maxonsiteissueqty => $maxonsiteissueqty,
354
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
355
                }
355
                }
356
            }
356
            }
357
        );
357
        );
Lines 363-370 elsif ($op eq "add-branch-cat") { Link Here
363
                branchcode   => $branch,
363
                branchcode   => $branch,
364
                rules        => {
364
                rules        => {
365
                    max_holds         => $max_holds,
365
                    max_holds         => $max_holds,
366
                    maxissueqty       => $maxissueqty,
366
                    patron_maxissueqty       => $patron_maxissueqty,
367
                    maxonsiteissueqty => $maxonsiteissueqty,
367
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
368
                }
368
                }
369
            }
369
            }
370
        );
370
        );
(-)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 390-401 Link Here
390
                <tr>
390
                <tr>
391
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
391
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
392
                    <td>
392
                    <td>
393
                        [% SET maxissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxissueqty' ) %]
393
                        [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %]
394
                        <input type="text" name="maxissueqty" size="3" value="[% maxissueqty %]"/>
394
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty %]"/>
395
                    </td>
395
                    </td>
396
                    <td>
396
                    <td>
397
                        [% SET maxonsiteissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxonsiteissueqty' ) %]
397
                        [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxonsiteissueqty' ) %]
398
                        <input type="text" name="maxonsiteissueqty" size="3" value="[% maxonsiteissueqty %]"/>
398
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty %]"/>
399
                    </td>
399
                    </td>
400
                    <td>
400
                    <td>
401
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
401
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
Lines 513-523 Link Here
513
                    <th>&nbsp;</th>
513
                    <th>&nbsp;</th>
514
                </tr>
514
                </tr>
515
                [% FOREACH c IN categorycodes %]
515
                [% FOREACH c IN categorycodes %]
516
                    [% SET maxissueqty = CirculationRules.Get( branchcode, c, undef, 'maxissueqty' ) %]
516
                    [% SET patron_maxissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxissueqty' ) %]
517
                    [% SET maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'maxonsiteissueqty' ) %]
517
                    [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
518
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
518
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
519
519
520
                    [% IF maxissueqty || maxissueqty || max_holds %]
520
                    [% IF patron_maxissueqty || patron_maxonsiteissueqty || max_holds %]
521
                    <tr>
521
                    <tr>
522
                        <td>
522
                        <td>
523
                            [% IF c == '*'%]
523
                            [% IF c == '*'%]
Lines 527-541 Link Here
527
                            [% END %]
527
                            [% END %]
528
                        </td>
528
                        </td>
529
                        <td>
529
                        <td>
530
                            [% IF maxissueqty  %]
530
                            [% IF patron_maxissueqty  %]
531
                                [% maxissueqty %]
531
                                [% patron_maxissueqty %]
532
                            [% ELSE %]
532
                            [% ELSE %]
533
                                <span>Unlimited</span>
533
                                <span>Unlimited</span>
534
                            [% END %]
534
                            [% END %]
535
                        </td>
535
                        </td>
536
                        <td>
536
                        <td>
537
                            [% IF maxonsiteissueqty  %]
537
                            [% IF patron_maxonsiteissueqty  %]
538
                                [% maxonsiteissueqty %]
538
                                [% patron_maxonsiteissueqty %]
539
                            [% ELSE %]
539
                            [% ELSE %]
540
                                <span>Unlimited</span>
540
                                <span>Unlimited</span>
541
                            [% END %]
541
                            [% END %]
Lines 563-570 Link Here
563
                        [% END %]
563
                        [% END %]
564
                        </select>
564
                        </select>
565
                    </td>
565
                    </td>
566
                    <td><input name="maxissueqty" size="3" /></td>
566
                    <td><input name="patron_maxissueqty" size="3" /></td>
567
                    <td><input name="maxonsiteissueqty" size="3" /></td>
567
                    <td><input name="patron_maxonsiteissueqty" size="3" /></td>
568
                    <td><input name="max_holds" size="3" /></td>
568
                    <td><input name="max_holds" size="3" /></td>
569
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
569
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
570
                </tr>
570
                </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