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 96-103 elsif ($op eq 'delete-branch-cat') { Link Here
96
            itemtype     => undef,
96
            itemtype     => undef,
97
            rules        => {
97
            rules        => {
98
                max_holds         => undef,
98
                max_holds         => undef,
99
                maxissueqty       => undef,
99
                patron_maxissueqty             => undef,
100
                maxonsiteissueqty => undef,
100
                patron_maxonsiteissueqty       => undef,
101
            }
101
            }
102
        }
102
        }
103
    );
103
    );
Lines 223-238 elsif ($op eq 'add') { Link Here
223
}
223
}
224
elsif ($op eq "set-branch-defaults") {
224
elsif ($op eq "set-branch-defaults") {
225
    my $categorycode  = $input->param('categorycode');
225
    my $categorycode  = $input->param('categorycode');
226
    my $maxissueqty   = $input->param('maxissueqty');
226
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
227
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
227
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
228
    my $holdallowed   = $input->param('holdallowed');
228
    my $holdallowed   = $input->param('holdallowed');
229
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
229
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
230
    my $returnbranch  = $input->param('returnbranch');
230
    my $returnbranch  = $input->param('returnbranch');
231
    my $max_holds = $input->param('max_holds');
231
    my $max_holds = $input->param('max_holds');
232
    $maxissueqty =~ s/\s//g;
232
    $patron_maxissueqty =~ s/\s//g;
233
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
233
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
234
    $maxonsiteissueqty =~ s/\s//g;
234
    $patron_maxonsiteissueqty =~ s/\s//g;
235
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
235
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
236
    $holdallowed =~ s/\s//g;
236
    $holdallowed =~ s/\s//g;
237
    $holdallowed = undef if $holdallowed !~ /^\d+/;
237
    $holdallowed = undef if $holdallowed !~ /^\d+/;
238
    $max_holds =~ s/\s//g;
238
    $max_holds =~ s/\s//g;
Lines 261-268 elsif ($op eq "set-branch-defaults") { Link Here
261
                itemtype     => undef,
261
                itemtype     => undef,
262
                branchcode   => undef,
262
                branchcode   => undef,
263
                rules        => {
263
                rules        => {
264
                    maxissueqty       => $maxissueqty,
264
                    patron_maxissueqty             => $patron_maxissueqty,
265
                    maxonsiteissueqty => $maxonsiteissueqty,
265
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
266
                }
266
                }
267
            }
267
            }
268
        );
268
        );
Lines 290-297 elsif ($op eq "set-branch-defaults") { Link Here
290
                itemtype     => undef,
290
                itemtype     => undef,
291
                branchcode   => $branch,
291
                branchcode   => $branch,
292
                rules        => {
292
                rules        => {
293
                    maxissueqty       => $maxissueqty,
293
                    patron_maxissueqty             => $patron_maxissueqty,
294
                    maxonsiteissueqty => $maxonsiteissueqty,
294
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
295
                }
295
                }
296
            }
296
            }
297
        );
297
        );
Lines 308-320 elsif ($op eq "set-branch-defaults") { Link Here
308
}
308
}
309
elsif ($op eq "add-branch-cat") {
309
elsif ($op eq "add-branch-cat") {
310
    my $categorycode  = $input->param('categorycode');
310
    my $categorycode  = $input->param('categorycode');
311
    my $maxissueqty   = $input->param('maxissueqty');
311
    my $patron_maxissueqty   = $input->param('patron_maxissueqty');
312
    my $maxonsiteissueqty = $input->param('maxonsiteissueqty');
312
    my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
313
    my $max_holds = $input->param('max_holds');
313
    my $max_holds = $input->param('max_holds');
314
    $maxissueqty =~ s/\s//g;
314
    $patron_maxissueqty =~ s/\s//g;
315
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
315
    $patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/;
316
    $maxonsiteissueqty =~ s/\s//g;
316
    $patron_maxonsiteissueqty =~ s/\s//g;
317
    $maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/;
317
    $patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/;
318
    $max_holds =~ s/\s//g;
318
    $max_holds =~ s/\s//g;
319
    $max_holds = undef if $max_holds !~ /^\d+/;
319
    $max_holds = undef if $max_holds !~ /^\d+/;
320
320
Lines 327-334 elsif ($op eq "add-branch-cat") { Link Here
327
                    branchcode   => undef,
327
                    branchcode   => undef,
328
                    rules        => {
328
                    rules        => {
329
                        max_holds         => $max_holds,
329
                        max_holds         => $max_holds,
330
                        maxissueqty       => $maxissueqty,
330
                        patron_maxissueqty       => $patron_maxissueqty,
331
                        maxonsiteissueqty => $maxonsiteissueqty,
331
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
332
                    }
332
                    }
333
                }
333
                }
334
            );
334
            );
Lines 340-347 elsif ($op eq "add-branch-cat") { Link Here
340
                    itemtype     => undef,
340
                    itemtype     => undef,
341
                    rules        => {
341
                    rules        => {
342
                        max_holds         => $max_holds,
342
                        max_holds         => $max_holds,
343
                        maxissueqty       => $maxissueqty,
343
                        patron_maxissueqty       => $patron_maxissueqty,
344
                        maxonsiteissueqty => $maxonsiteissueqty,
344
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
345
                    }
345
                    }
346
                }
346
                }
347
            );
347
            );
Lines 354-361 elsif ($op eq "add-branch-cat") { Link Here
354
                branchcode   => $branch,
354
                branchcode   => $branch,
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 367-374 elsif ($op eq "add-branch-cat") { Link Here
367
                branchcode   => $branch,
367
                branchcode   => $branch,
368
                rules        => {
368
                rules        => {
369
                    max_holds         => $max_holds,
369
                    max_holds         => $max_holds,
370
                    maxissueqty       => $maxissueqty,
370
                    patron_maxissueqty       => $patron_maxissueqty,
371
                    maxonsiteissueqty => $maxonsiteissueqty,
371
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
372
                }
372
                }
373
            }
373
            }
374
        );
374
        );
(-)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 391-402 Link Here
391
                <tr>
391
                <tr>
392
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
392
                    <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td>
393
                    <td>
393
                    <td>
394
                        [% SET maxissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxissueqty' ) %]
394
                        [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %]
395
                        <input type="text" name="maxissueqty" size="3" value="[% maxissueqty | html %]"/>
395
                        <input type="text" name="patron_maxissueqty" size="3" value="[% patron_maxissueqty | html %]"/>
396
                    </td>
396
                    </td>
397
                    <td>
397
                    <td>
398
                        [% SET maxonsiteissueqty  = CirculationRules.Get( branchcode, undef, undef, 'maxonsiteissueqty' ) %]
398
                        [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxonsiteissueqty' ) %]
399
                        <input type="text" name="maxonsiteissueqty" size="3" value="[% maxonsiteissueqty | html %]"/>
399
                        <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/>
400
                    </td>
400
                    </td>
401
                    <td>
401
                    <td>
402
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
402
                        [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %]
Lines 514-524 Link Here
514
                    <th>&nbsp;</th>
514
                    <th>&nbsp;</th>
515
                </tr>
515
                </tr>
516
                [% FOREACH c IN categorycodes %]
516
                [% FOREACH c IN categorycodes %]
517
                    [% SET maxissueqty = CirculationRules.Get( branchcode, c, undef, 'maxissueqty' ) %]
517
                    [% SET patron_maxissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxissueqty' ) %]
518
                    [% SET maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'maxonsiteissueqty' ) %]
518
                    [% SET patron_maxonsiteissueqty = CirculationRules.Get( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
519
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
519
                    [% SET max_holds = CirculationRules.Get( branchcode, c, undef, 'max_holds' ) %]
520
520
521
                    [% IF maxissueqty || maxissueqty || max_holds %]
521
                    [% IF patron_maxissueqty || patron_maxonsiteissueqty || max_holds %]
522
                    <tr>
522
                    <tr>
523
                        <td>
523
                        <td>
524
                            [% IF c == '*'%]
524
                            [% IF c == '*'%]
Lines 528-542 Link Here
528
                            [% END %]
528
                            [% END %]
529
                        </td>
529
                        </td>
530
                        <td>
530
                        <td>
531
                            [% IF maxissueqty  %]
531
                            [% IF patron_maxissueqty  %]
532
                                [% maxissueqty | html %]
532
                                [% patron_maxissueqty | html %]
533
                            [% ELSE %]
533
                            [% ELSE %]
534
                                <span>Unlimited</span>
534
                                <span>Unlimited</span>
535
                            [% END %]
535
                            [% END %]
536
                        </td>
536
                        </td>
537
                        <td>
537
                        <td>
538
                            [% IF maxonsiteissueqty  %]
538
                            [% IF patron_maxonsiteissueqty  %]
539
                                [% maxonsiteissueqty | html %]
539
                                [% patron_maxonsiteissueqty | html %]
540
                            [% ELSE %]
540
                            [% ELSE %]
541
                                <span>Unlimited</span>
541
                                <span>Unlimited</span>
542
                            [% END %]
542
                            [% END %]
Lines 564-571 Link Here
564
                        [% END %]
564
                        [% END %]
565
                        </select>
565
                        </select>
566
                    </td>
566
                    </td>
567
                    <td><input name="maxissueqty" size="3" /></td>
567
                    <td><input name="patron_maxissueqty" size="3" /></td>
568
                    <td><input name="maxonsiteissueqty" size="3" /></td>
568
                    <td><input name="patron_maxonsiteissueqty" size="3" /></td>
569
                    <td><input name="max_holds" size="3" /></td>
569
                    <td><input name="max_holds" size="3" /></td>
570
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
570
                    <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
571
                </tr>
571
                </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