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

(-)a/C4/Circulation.pm (-11 / +11 lines)
Lines 502-508 sub TooMany { Link Here
502
502
503
    # Now count total loans against the limit for the branch
503
    # Now count total loans against the limit for the branch
504
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
504
    my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower);
505
    if (defined($branch_borrower_circ_rule->{maxissueqty})) {
505
    if (defined($branch_borrower_circ_rule->{patron_maxissueqty})) {
506
        my @bind_params = ();
506
        my @bind_params = ();
507
        my $branch_count_query = q|
507
        my $branch_count_query = q|
508
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
508
            SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts
Lines 522-529 sub TooMany { Link Here
522
            push @bind_params, $branch;
522
            push @bind_params, $branch;
523
        }
523
        }
524
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
524
        my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $branch_count_query, {}, @bind_params );
525
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{maxissueqty};
525
        my $max_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxissueqty};
526
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{maxonsiteissueqty};
526
        my $max_onsite_checkouts_allowed = $branch_borrower_circ_rule->{patron_maxonsiteissueqty};
527
527
528
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
528
        if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) {
529
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
529
            if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed )  {
Lines 554-560 sub TooMany { Link Here
554
        }
554
        }
555
    }
555
    }
556
556
557
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{maxissueqty}) ) {
557
    if ( not defined( $maxissueqty_rule ) and not defined($branch_borrower_circ_rule->{patron_maxissueqty}) ) {
558
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
558
        return { reason => 'NO_RULE_DEFINED', max_allowed => 0 };
559
    }
559
    }
560
560
Lines 1572-1582 Retrieves circulation rule attributes that apply to the given Link Here
1572
branch and patron category, regardless of item type.  
1572
branch and patron category, regardless of item type.  
1573
The return value is a hashref containing the following key:
1573
The return value is a hashref containing the following key:
1574
1574
1575
maxissueqty - maximum number of loans that a
1575
patron_maxissueqty - maximum number of loans that a
1576
patron of the given category can have at the given
1576
patron of the given category can have at the given
1577
branch.  If the value is undef, no limit.
1577
branch.  If the value is undef, no limit.
1578
1578
1579
maxonsiteissueqty - maximum of on-site checkouts that a
1579
patron_maxonsiteissueqty - maximum of on-site checkouts that a
1580
patron of the given category can have at the given
1580
patron of the given category can have at the given
1581
branch.  If the value is undef, no limit.
1581
branch.  If the value is undef, no limit.
1582
1582
Lines 1589-1596 default branch and category Link Here
1589
If no rule has been found in the database, it will default to
1589
If no rule has been found in the database, it will default to
1590
the buillt in rule:
1590
the buillt in rule:
1591
1591
1592
maxissueqty - undef
1592
patron_maxissueqty - undef
1593
maxonsiteissueqty - undef
1593
patron_maxonsiteissueqty - undef
1594
1594
1595
C<$branchcode> and C<$categorycode> should contain the
1595
C<$branchcode> and C<$categorycode> should contain the
1596
literal branch code and patron category code, respectively - no
1596
literal branch code and patron category code, respectively - no
Lines 1627-1638 sub GetBranchBorrowerCircRule { Link Here
1627
1627
1628
    # Initialize default values
1628
    # Initialize default values
1629
    my $rules = {
1629
    my $rules = {
1630
        maxissueqty       => undef,
1630
        patron_maxissueqty       => undef,
1631
        maxonsiteissueqty => undef,
1631
        patron_maxonsiteissueqty => undef,
1632
    };
1632
    };
1633
1633
1634
    # Search for rules!
1634
    # Search for rules!
1635
    foreach my $rule_name (qw( maxissueqty maxonsiteissueqty )) {
1635
    foreach my $rule_name (qw( patron_maxissueqty patron_maxonsiteissueqty )) {
1636
        foreach my $params (@params) {
1636
        foreach my $params (@params) {
1637
            my $rule = Koha::CirculationRules->search(
1637
            my $rule = Koha::CirculationRules->search(
1638
                {
1638
                {
(-)a/admin/smart-rules.pl (-26 / +27 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 217-232 elsif ($op eq 'add') { Link Here
217
}
217
}
218
elsif ($op eq "set-branch-defaults") {
218
elsif ($op eq "set-branch-defaults") {
219
    my $categorycode  = $input->param('categorycode');
219
    my $categorycode  = $input->param('categorycode');
220
    my $maxissueqty   = $input->param('maxissueqty');
220
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
221
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
221
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
222
    my $holdallowed   = $input->param('holdallowed');
222
    my $holdallowed   = $input->param('holdallowed');
223
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
223
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
224
    my $returnbranch  = $input->param('returnbranch');
224
    my $returnbranch  = $input->param('returnbranch');
225
    my $max_holds = $input->param('max_holds');
225
    my $max_holds = $input->param('max_holds');
226
    $maxissueqty =~ s/\s//g;
226
    $patron_maxissueqty =~ s/\s//g;
227
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
227
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
228
    $maxonsiteissueqty =~ s/\s//g;
228
    $patron_maxonsiteissueqty =~ s/\s//g;
229
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
229
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
230
    $holdallowed =~ s/\s//g;
230
    $holdallowed =~ s/\s//g;
231
    $holdallowed = undef if $holdallowed !~ /^\d+/;
231
    $holdallowed = undef if $holdallowed !~ /^\d+/;
232
    $max_holds =~ s/\s//g;
232
    $max_holds =~ s/\s//g;
Lines 255-262 elsif ($op eq "set-branch-defaults") { Link Here
255
                itemtype     => undef,
255
                itemtype     => undef,
256
                branchcode   => undef,
256
                branchcode   => undef,
257
                rules        => {
257
                rules        => {
258
                    maxissueqty       => $maxissueqty,
258
                    patron_maxissueqty             => $patron_maxissueqty,
259
                    maxonsiteissueqty => $maxonsiteissueqty,
259
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
260
                }
260
                }
261
            }
261
            }
262
        );
262
        );
Lines 284-291 elsif ($op eq "set-branch-defaults") { Link Here
284
                itemtype     => undef,
284
                itemtype     => undef,
285
                branchcode   => $branch,
285
                branchcode   => $branch,
286
                rules        => {
286
                rules        => {
287
                    maxissueqty       => $maxissueqty,
287
                    patron_maxissueqty             => $patron_maxissueqty,
288
                    maxonsiteissueqty => $maxonsiteissueqty,
288
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
289
                }
289
                }
290
            }
290
            }
291
        );
291
        );
Lines 302-313 elsif ($op eq "set-branch-defaults") { Link Here
302
}
302
}
303
elsif ($op eq "add-branch-cat") {
303
elsif ($op eq "add-branch-cat") {
304
    my $categorycode  = $input->param('categorycode');
304
    my $categorycode  = $input->param('categorycode');
305
    my $maxissueqty   = $input->param('maxissueqty');
305
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
306
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
306
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
307
    $maxissueqty =~ s/\s//g;
307
    my $max_holds = $input->param('max_holds');
308
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
308
    $patron_maxissueqty =~ s/\s//g;
309
    $maxonsiteissueqty =~ s/\s//g;
309
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
310
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
310
    $patron_maxonsiteissueqty =~ s/\s//g;
311
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
311
    $max_holds =~ s/\s//g;
312
    $max_holds =~ s/\s//g;
312
    $max_holds = '' if $max_holds !~ /^\d+/;
313
    $max_holds = '' if $max_holds !~ /^\d+/;
313
314
Lines 320-327 elsif ($op eq "add-branch-cat") { Link Here
320
                    branchcode   => undef,
321
                    branchcode   => undef,
321
                    rules        => {
322
                    rules        => {
322
                        max_holds         => $max_holds,
323
                        max_holds         => $max_holds,
323
                        maxissueqty       => $maxissueqty,
324
                        patron_maxissueqty       => $patron_maxissueqty,
324
                        maxonsiteissueqty => $maxonsiteissueqty,
325
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
325
                    }
326
                    }
326
                }
327
                }
327
            );
328
            );
Lines 333-340 elsif ($op eq "add-branch-cat") { Link Here
333
                    itemtype     => undef,
334
                    itemtype     => undef,
334
                    rules        => {
335
                    rules        => {
335
                        max_holds         => $max_holds,
336
                        max_holds         => $max_holds,
336
                        maxissueqty       => $maxissueqty,
337
                        patron_maxissueqty       => $patron_maxissueqty,
337
                        maxonsiteissueqty => $maxonsiteissueqty,
338
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
338
                    }
339
                    }
339
                }
340
                }
340
            );
341
            );
Lines 347-354 elsif ($op eq "add-branch-cat") { Link Here
347
                branchcode   => $branch,
348
                branchcode   => $branch,
348
                rules        => {
349
                rules        => {
349
                    max_holds         => $max_holds,
350
                    max_holds         => $max_holds,
350
                    maxissueqty       => $maxissueqty,
351
                    patron_maxissueqty       => $patron_maxissueqty,
351
                    maxonsiteissueqty => $maxonsiteissueqty,
352
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
352
                }
353
                }
353
            }
354
            }
354
        );
355
        );
Lines 360-367 elsif ($op eq "add-branch-cat") { Link Here
360
                branchcode   => $branch,
361
                branchcode   => $branch,
361
                rules        => {
362
                rules        => {
362
                    max_holds         => $max_holds,
363
                    max_holds         => $max_holds,
363
                    maxissueqty       => $maxissueqty,
364
                    patron_maxissueqty       => $patron_maxissueqty,
364
                    maxonsiteissueqty => $maxonsiteissueqty,
365
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
365
                }
366
                }
366
            }
367
            }
367
        );
368
        );
(-)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 / +14 lines)
Lines 370-381 Link Here
370
                <tr>
370
                <tr>
371
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
371
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
372
                    <td>
372
                    <td>
373
                        [% SET maxissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxissueqty' ) %]
373
                        [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %]
374
                        <input type="text" name="maxissueqty" size="3" value="[% maxissueqty %]"/>
374
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty %]"/>
375
                    </td>
375
                    </td>
376
                    <td>
376
                    <td>
377
                        [% SET maxonsiteissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxonsiteissueqty' ) %]
377
                        [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxonsiteissueqty' ) %]
378
                        <input type="text" name="maxonsiteissueqty" size="3" value="[% maxonsiteissueqty %]"/>
378
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty %]"/>
379
                    </td>
379
                    </td>
380
                    <td>
380
                    <td>
381
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
381
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
Lines 492-502 Link Here
492
                    <th>&nbsp;</th>
492
                    <th>&nbsp;</th>
493
                </tr>
493
                </tr>
494
                [% FOREACH c IN categorycodes %]
494
                [% FOREACH c IN categorycodes %]
495
                    [% SET maxissueqty = CirculationRules.Get( branchcode, c, undef, 'maxissueqty' ) %]
495
                    [% SET patron_maxissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxissueqty' ) %]
496
                    [% SET maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'maxonsiteissueqty' ) %]
496
                    [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
497
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
497
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
498
498
499
                    [% IF maxissueqty || maxissueqty || max_holds %]
499
                    [% IF patron_maxissueqty || patron_maxonsiteissueqty || max_holds %]
500
                    <tr>
500
                    <tr>
501
                        <td>
501
                        <td>
502
                            [% IF c == '*'%]
502
                            [% IF c == '*'%]
Lines 506-520 Link Here
506
                            [% END %]
506
                            [% END %]
507
                        </td>
507
                        </td>
508
                        <td>
508
                        <td>
509
                            [% IF maxissueqty  %]
509
                            [% IF patron_maxissueqty  %]
510
                                [% maxissueqty %]
510
                                [% patron_maxissueqty %]
511
                            [% ELSE %]
511
                            [% ELSE %]
512
                                Unlimited
512
                                Unlimited
513
                            [% END %]
513
                            [% END %]
514
                        </td>
514
                        </td>
515
                        <td>
515
                        <td>
516
                            [% IF maxonsiteissueqty  %]
516
                            [% IF patron_maxonsiteissueqty  %]
517
                                [% maxonsiteissueqty %]
517
                                [% patron_maxonsiteissueqty %]
518
                            [% ELSE %]
518
                            [% ELSE %]
519
                                Unlimited
519
                                Unlimited
520
                            [% END %]
520
                            [% END %]
Lines 541-548 Link Here
541
                        [% END %]
541
                        [% END %]
542
                        </select>
542
                        </select>
543
                    </td>
543
                    </td>
544
                    <td><input name="maxissueqty" size="3" /></td>
544
                    <td><input name="patron_maxissueqty" size="3" /></td>
545
                    <td><input name="maxonsiteissueqty" size="3" /></td>
545
                    <td><input name="patron_maxonsiteissueqty" size="3" /></td>
546
                    <td><input name="max_holds" size="3" /></td>
546
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
547
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
547
                </tr>
548
                </tr>
548
            </table>
549
            </table>
(-)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