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

(-)a/C4/Circulation.pm (-11 / +11 lines)
Lines 515-521 sub TooMany { Link Here
515
515
516
    # Now count total loans against the limit for the branch
516
    # Now count total loans against the limit for the branch
517
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
517
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
518
    if (defined($branch_borrower_circ_rule->{maxissueqty})) {
518
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty})) {
519
        my @bind_params = ();
519
        my @bind_params = ();
520
        my $branch_count_query = q|
520
        my $branch_count_query = q|
521
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
521
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
Lines 535-542 sub TooMany { Link Here
535
            push @bind_params, $branch;
535
            push @bind_params, $branch;
536
        }
536
        }
537
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
537
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
538
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{maxissueqty};
538
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty};
539
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{maxonsiteissueqty};
539
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxonsiteissueqty};
540
540
541
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
541
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
542
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
542
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
Lines 567-573 sub TooMany { Link Here
567
        }
567
        }
568
    }
568
    }
569
569
570
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{maxissueqty}) ) {
570
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{patron_maxissueqty}) ) {
571
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
571
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
572
    }
572
    }
573
573
Lines 1591-1601 Retrieves circulation rule attributes that apply to the given Link Here
1591
branch and patron category, regardless of item type.  
1591
branch and patron category, regardless of item type.  
1592
The return value is a hashref containing the following key:
1592
The return value is a hashref containing the following key:
1593
1593
1594
maxissueqty - maximum number of loans that a
1594
patron_maxissueqty - maximum number of loans that a
1595
patron of the given category can have at the given
1595
patron of the given category can have at the given
1596
branch.  If the value is undef, no limit.
1596
branch.  If the value is undef, no limit.
1597
1597
1598
maxonsiteissueqty - maximum of on-site checkouts that a
1598
patron_maxonsiteissueqty - maximum of on-site checkouts that a
1599
patron of the given category can have at the given
1599
patron of the given category can have at the given
1600
branch.  If the value is undef, no limit.
1600
branch.  If the value is undef, no limit.
1601
1601
Lines 1608-1615 default branch and category Link Here
1608
If no rule has been found in the database, it will default to
1608
If no rule has been found in the database, it will default to
1609
the buillt in rule:
1609
the buillt in rule:
1610
1610
1611
maxissueqty - undef
1611
patron_maxissueqty - undef
1612
maxonsiteissueqty - undef
1612
patron_maxonsiteissueqty - undef
1613
1613
1614
C<$branchcode> and C<$categorycode> should contain the
1614
C<$branchcode> and C<$categorycode> should contain the
1615
literal branch code and patron category code, respectively - no
1615
literal branch code and patron category code, respectively - no
Lines 1646-1657 sub GetBranchBorrowerCircRule { Link Here
1646
1646
1647
    # Initialize default values
1647
    # Initialize default values
1648
    my $rules = {
1648
    my $rules = {
1649
        maxissueqty       => undef,
1649
        patron_maxissueqty       => undef,
1650
        maxonsiteissueqty => undef,
1650
        patron_maxonsiteissueqty => undef,
1651
    };
1651
    };
1652
1652
1653
    # Search for rules!
1653
    # Search for rules!
1654
    foreach my $rule_name (qw( maxissueqty maxonsiteissueqty )) {
1654
    foreach my $rule_name (qw( patron_maxissueqty patron_maxonsiteissueqty )) {
1655
        foreach my $params (@params) {
1655
        foreach my $params (@params) {
1656
            my $rule = Koha::CirculationRules->search(
1656
            my $rule = Koha::CirculationRules->search(
1657
                {
1657
                {
(-)a/admin/smart-rules.pl (-26 / +26 lines)
Lines 100-107 elsif ($op eq 'delete-branch-cat') { Link Here
100
            itemtype     => undef,
100
            itemtype     => undef,
101
            rules        => {
101
            rules        => {
102
                max_holds         => undef,
102
                max_holds         => undef,
103
                maxissueqty       => undef,
103
                patron_maxissueqty             => undef,
104
                maxonsiteissueqty => undef,
104
                patron_maxonsiteissueqty       => undef,
105
            }
105
            }
106
        }
106
        }
107
    );
107
    );
Lines 225-240 elsif ($op eq 'add') { Link Here
225
}
225
}
226
elsif ($op eq "set-branch-defaults") {
226
elsif ($op eq "set-branch-defaults") {
227
    my $categorycode  = $input->param('categorycode');
227
    my $categorycode  = $input->param('categorycode');
228
    my $maxissueqty   = $input->param('maxissueqty');
228
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
229
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
229
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
230
    my $holdallowed   = $input->param('holdallowed');
230
    my $holdallowed   = $input->param('holdallowed');
231
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
231
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
232
    my $returnbranch  = $input->param('returnbranch');
232
    my $returnbranch  = $input->param('returnbranch');
233
    my $max_holds = $input->param('max_holds');
233
    my $max_holds = $input->param('max_holds');
234
    $maxissueqty =~ s/\s//g;
234
    $patron_maxissueqty =~ s/\s//g;
235
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
235
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
236
    $maxonsiteissueqty =~ s/\s//g;
236
    $patron_maxonsiteissueqty =~ s/\s//g;
237
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
237
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
238
    $holdallowed =~ s/\s//g;
238
    $holdallowed =~ s/\s//g;
239
    $holdallowed = undef if $holdallowed !~ /^\d+/;
239
    $holdallowed = undef if $holdallowed !~ /^\d+/;
240
    $max_holds =~ s/\s//g;
240
    $max_holds =~ s/\s//g;
Lines 263-270 elsif ($op eq "set-branch-defaults") { Link Here
263
                itemtype     => undef,
263
                itemtype     => undef,
264
                branchcode   => undef,
264
                branchcode   => undef,
265
                rules        => {
265
                rules        => {
266
                    maxissueqty       => $maxissueqty,
266
                    patron_maxissueqty             => $patron_maxissueqty,
267
                    maxonsiteissueqty => $maxonsiteissueqty,
267
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
268
                }
268
                }
269
            }
269
            }
270
        );
270
        );
Lines 292-299 elsif ($op eq "set-branch-defaults") { Link Here
292
                itemtype     => undef,
292
                itemtype     => undef,
293
                branchcode   => $branch,
293
                branchcode   => $branch,
294
                rules        => {
294
                rules        => {
295
                    maxissueqty       => $maxissueqty,
295
                    patron_maxissueqty             => $patron_maxissueqty,
296
                    maxonsiteissueqty => $maxonsiteissueqty,
296
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
297
                }
297
                }
298
            }
298
            }
299
        );
299
        );
Lines 310-322 elsif ($op eq "set-branch-defaults") { Link Here
310
}
310
}
311
elsif ($op eq "add-branch-cat") {
311
elsif ($op eq "add-branch-cat") {
312
    my $categorycode  = $input->param('categorycode');
312
    my $categorycode  = $input->param('categorycode');
313
    my $maxissueqty   = $input->param('maxissueqty');
313
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
314
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
314
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
315
    my $max_holds = $input->param('max_holds');
315
    my $max_holds = $input->param('max_holds');
316
    $maxissueqty =~ s/\s//g;
316
    $patron_maxissueqty =~ s/\s//g;
317
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
317
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
318
    $maxonsiteissueqty =~ s/\s//g;
318
    $patron_maxonsiteissueqty =~ s/\s//g;
319
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
319
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
320
    $max_holds =~ s/\s//g;
320
    $max_holds =~ s/\s//g;
321
    $max_holds = undef if $max_holds !~ /^\d+/;
321
    $max_holds = undef if $max_holds !~ /^\d+/;
322
322
Lines 329-336 elsif ($op eq "add-branch-cat") { Link Here
329
                    branchcode   => undef,
329
                    branchcode   => undef,
330
                    rules        => {
330
                    rules        => {
331
                        max_holds         => $max_holds,
331
                        max_holds         => $max_holds,
332
                        maxissueqty       => $maxissueqty,
332
                        patron_maxissueqty       => $patron_maxissueqty,
333
                        maxonsiteissueqty => $maxonsiteissueqty,
333
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
334
                    }
334
                    }
335
                }
335
                }
336
            );
336
            );
Lines 342-349 elsif ($op eq "add-branch-cat") { Link Here
342
                    itemtype     => undef,
342
                    itemtype     => undef,
343
                    rules        => {
343
                    rules        => {
344
                        max_holds         => $max_holds,
344
                        max_holds         => $max_holds,
345
                        maxissueqty       => $maxissueqty,
345
                        patron_maxissueqty       => $patron_maxissueqty,
346
                        maxonsiteissueqty => $maxonsiteissueqty,
346
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
347
                    }
347
                    }
348
                }
348
                }
349
            );
349
            );
Lines 356-363 elsif ($op eq "add-branch-cat") { Link Here
356
                branchcode   => $branch,
356
                branchcode   => $branch,
357
                rules        => {
357
                rules        => {
358
                    max_holds         => $max_holds,
358
                    max_holds         => $max_holds,
359
                    maxissueqty       => $maxissueqty,
359
                    patron_maxissueqty       => $patron_maxissueqty,
360
                    maxonsiteissueqty => $maxonsiteissueqty,
360
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
361
                }
361
                }
362
            }
362
            }
363
        );
363
        );
Lines 369-376 elsif ($op eq "add-branch-cat") { Link Here
369
                branchcode   => $branch,
369
                branchcode   => $branch,
370
                rules        => {
370
                rules        => {
371
                    max_holds         => $max_holds,
371
                    max_holds         => $max_holds,
372
                    maxissueqty       => $maxissueqty,
372
                    patron_maxissueqty       => $patron_maxissueqty,
373
                    maxonsiteissueqty => $maxonsiteissueqty,
373
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
374
                }
374
                }
375
            }
375
            }
376
        );
376
        );
(-)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 372-383 Link Here
372
                <tr>
372
                <tr>
373
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
373
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
374
                    <td>
374
                    <td>
375
                        [% SET maxissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxissueqty' ) %]
375
                        [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %]
376
                        <input type="text" name="maxissueqty" size="3" value="[% maxissueqty %]"/>
376
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty %]"/>
377
                    </td>
377
                    </td>
378
                    <td>
378
                    <td>
379
                        [% SET maxonsiteissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxonsiteissueqty' ) %]
379
                        [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxonsiteissueqty' ) %]
380
                        <input type="text" name="maxonsiteissueqty" size="3" value="[% maxonsiteissueqty %]"/>
380
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty %]"/>
381
                    </td>
381
                    </td>
382
                    <td>
382
                    <td>
383
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
383
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
Lines 495-505 Link Here
495
                    <th>&nbsp;</th>
495
                    <th>&nbsp;</th>
496
                </tr>
496
                </tr>
497
                [% FOREACH c IN categorycodes %]
497
                [% FOREACH c IN categorycodes %]
498
                    [% SET maxissueqty = CirculationRules.Get( branchcode, c, undef, 'maxissueqty' ) %]
498
                    [% SET patron_maxissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxissueqty' ) %]
499
                    [% SET maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'maxonsiteissueqty' ) %]
499
                    [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
500
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
500
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
501
501
502
                    [% IF maxissueqty || maxissueqty || max_holds %]
502
                    [% IF patron_maxissueqty || patron_maxonsiteissueqty || max_holds %]
503
                    <tr>
503
                    <tr>
504
                        <td>
504
                        <td>
505
                            [% IF c == '*'%]
505
                            [% IF c == '*'%]
Lines 509-523 Link Here
509
                            [% END %]
509
                            [% END %]
510
                        </td>
510
                        </td>
511
                        <td>
511
                        <td>
512
                            [% IF maxissueqty  %]
512
                            [% IF patron_maxissueqty  %]
513
                                [% maxissueqty %]
513
                                [% patron_maxissueqty %]
514
                            [% ELSE %]
514
                            [% ELSE %]
515
                                Unlimited
515
                                Unlimited
516
                            [% END %]
516
                            [% END %]
517
                        </td>
517
                        </td>
518
                        <td>
518
                        <td>
519
                            [% IF maxonsiteissueqty  %]
519
                            [% IF patron_maxonsiteissueqty  %]
520
                                [% maxonsiteissueqty %]
520
                                [% patron_maxonsiteissueqty %]
521
                            [% ELSE %]
521
                            [% ELSE %]
522
                                Unlimited
522
                                Unlimited
523
                            [% END %]
523
                            [% END %]
Lines 544-551 Link Here
544
                        [% END %]
544
                        [% END %]
545
                        </select>
545
                        </select>
546
                    </td>
546
                    </td>
547
                    <td><input name="maxissueqty" size="3" /></td>
547
                    <td><input name="patron_maxissueqty" size="3" /></td>
548
                    <td><input name="maxonsiteissueqty" size="3" /></td>
548
                    <td><input name="patron_maxonsiteissueqty" size="3" /></td>
549
                    <td><input name="max_holds" size="3" /></td>
549
                    <td><input name="max_holds" size="3" /></td>
550
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
550
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
551
                </tr>
551
                </tr>
(-)a/t/db_dependent/Circulation/Branch.t (-17 / +16 lines)
Lines 147-154 my $borrower_id1 = C4::Members::AddMember( Link Here
147
147
148
is_deeply(
148
is_deeply(
149
    GetBranchBorrowerCircRule(),
149
    GetBranchBorrowerCircRule(),
150
    { maxissueqty => undef, maxonsiteissueqty => undef },
150
    { patron_maxissueqty => undef, patron_maxonsiteissueqty => undef },
151
"Without parameter, GetBranchBorrower returns undef (unilimited) for maxissueqty and maxonsiteissueqty if no rules defined"
151
"Without parameter, GetBranchBorrower returns undef (unilimited) for patron_maxissueqty and patron_maxonsiteissueqty if no rules defined"
152
);
152
);
153
153
154
Koha::CirculationRules->set_rules(
154
Koha::CirculationRules->set_rules(
Lines 157-164 Koha::CirculationRules->set_rules( Link Here
157
        categorycode => $samplecat->{categorycode},
157
        categorycode => $samplecat->{categorycode},
158
        itemtype     => undef,
158
        itemtype     => undef,
159
        rules        => {
159
        rules        => {
160
            maxissueqty       => 5,
160
            patron_maxissueqty       => 5,
161
            maxonsiteissueqty => 6,
161
            patron_maxonsiteissueqty => 6,
162
        }
162
        }
163
    }
163
    }
164
);
164
);
Lines 175-182 Koha::CirculationRules->set_rules( Link Here
175
        categorycode => undef,
175
        categorycode => undef,
176
        itemtype     => undef,
176
        itemtype     => undef,
177
        rules        => {
177
        rules        => {
178
            maxissueqty       => 3,
178
            patron_maxissueqty       => 3,
179
            maxonsiteissueqty => 2,
179
            patron_maxonsiteissueqty => 2,
180
        }
180
        }
181
    }
181
    }
182
);
182
);
Lines 193-200 Koha::CirculationRules->set_rules( Link Here
193
        categorycode => undef,
193
        categorycode => undef,
194
        itemtype     => undef,
194
        itemtype     => undef,
195
        rules        => {
195
        rules        => {
196
            maxissueqty       => 4,
196
            patron_maxissueqty       => 4,
197
            maxonsiteissueqty => 5,
197
            patron_maxonsiteissueqty => 5,
198
        }
198
        }
199
    }
199
    }
200
);
200
);
Lines 221-246 $sth->execute( Link Here
221
#Test GetBranchBorrowerCircRule
221
#Test GetBranchBorrowerCircRule
222
is_deeply(
222
is_deeply(
223
    GetBranchBorrowerCircRule(),
223
    GetBranchBorrowerCircRule(),
224
    { maxissueqty => 4, maxonsiteissueqty => 5 },
224
    { patron_maxissueqty => 4, patron_maxonsiteissueqty => 5 },
225
"Without parameter, GetBranchBorrower returns the maxissueqty and maxonsiteissueqty of default_circ_rules"
225
"Without parameter, GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty of default_circ_rules"
226
);
226
);
227
is_deeply(
227
is_deeply(
228
    GetBranchBorrowerCircRule( $samplebranch2->{branchcode} ),
228
    GetBranchBorrowerCircRule( $samplebranch2->{branchcode} ),
229
    { maxissueqty => 3, maxonsiteissueqty => 2 },
229
    { patron_maxissueqty => 3, patron_maxonsiteissueqty => 2 },
230
"Without only the branchcode specified, GetBranchBorrower returns the maxissueqty and maxonsiteissueqty corresponding"
230
"Without only the branchcode specified, GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty corresponding"
231
);
231
);
232
is_deeply(
232
is_deeply(
233
    GetBranchBorrowerCircRule(
233
    GetBranchBorrowerCircRule(
234
        $samplebranch1->{branchcode},
234
        $samplebranch1->{branchcode},
235
        $samplecat->{categorycode}
235
        $samplecat->{categorycode}
236
    ),
236
    ),
237
    { maxissueqty => 5, maxonsiteissueqty => 6 },
237
    { patron_maxissueqty => 5, patron_maxonsiteissueqty => 6 },
238
    "GetBranchBorrower returns the maxissueqty and maxonsiteissueqty of the branch1 and the category1"
238
    "GetBranchBorrower returns the patron_maxissueqty and patron_maxonsiteissueqty of the branch1 and the category1"
239
);
239
);
240
is_deeply(
240
is_deeply(
241
    GetBranchBorrowerCircRule( -1, -1 ),
241
    GetBranchBorrowerCircRule( -1, -1 ),
242
    { maxissueqty => 4, maxonsiteissueqty => 5 },
242
    { patron_maxissueqty => 4, patron_maxonsiteissueqty => 5 },
243
"GetBranchBorrower with wrong parameters returns the maxissueqty and maxonsiteissueqty of default_circ_rules"
243
"GetBranchBorrower with wrong parameters returns the patron_maxissueqty and patron_maxonsiteissueqty of default_circ_rules"
244
);
244
);
245
245
246
#Test GetBranchItemRule
246
#Test GetBranchItemRule
247
- 

Return to bug 18925