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

(-)a/C4/Overdues.pm (+5 lines)
Lines 684-689 sub GetBranchcodesWithOverdueRules { Link Here
684
        WHERE delay1 IS NOT NULL
684
        WHERE delay1 IS NOT NULL
685
        ORDER BY branchcode
685
        ORDER BY branchcode
686
    |);
686
    |);
687
    unless ( $branchcodes->[0] ) {
688
        my $default_rule = Koha::OverdueRules->search({ branchcode => undef }, {})->next;
689
        return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
690
    }
687
    if ( defined $branchcodes->[0] && $branchcodes->[0] eq '' ) {
691
    if ( defined $branchcodes->[0] && $branchcodes->[0] eq '' ) {
688
        # If a default rule exists, all branches should be returned
692
        # If a default rule exists, all branches should be returned
689
        return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
693
        return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
Lines 766-771 sub GetOverduesForBranch { Link Here
766
sub GetOverdueMessageTransportTypes {
770
sub GetOverdueMessageTransportTypes {
767
    my ( $branchcode, $categorycode, $letternumber ) = @_;
771
    my ( $branchcode, $categorycode, $letternumber ) = @_;
768
    return unless $categorycode and $letternumber;
772
    return unless $categorycode and $letternumber;
773
    $branchcode = undef if ($branchcode eq '');
769
    my $rule = Koha::OverdueRules->search(
774
    my $rule = Koha::OverdueRules->search(
770
        {
775
        {
771
            branchcode   => $branchcode,
776
            branchcode   => $branchcode,
(-)a/t/db_dependent/Overdues.t (-3 / +20 lines)
Lines 26-42 $dbh->do(q|DELETE FROM message_queue|); Link Here
26
$dbh->do(q|DELETE FROM message_transport_types|);
26
$dbh->do(q|DELETE FROM message_transport_types|);
27
$dbh->do(q|DELETE FROM overduerules|);
27
$dbh->do(q|DELETE FROM overduerules|);
28
$dbh->do(q|DELETE FROM overduerules_transport_types|);
28
$dbh->do(q|DELETE FROM overduerules_transport_types|);
29
$dbh->do(q|DELETE FROM branches|);
30
29
31
30
$dbh->do(q|
32
$dbh->do(q|
31
    INSERT INTO message_transport_types( message_transport_type ) VALUES ('email'), ('phone'), ('print'), ('sms')
33
    INSERT INTO message_transport_types( message_transport_type ) VALUES ('email'), ('phone'), ('print'), ('sms')
32
|);
34
|);
33
35
36
$builder->build({
37
    source => 'Branch',
38
    value => {
39
        branchcode => 'CPL'
40
    }
41
});
42
43
$builder->build({
44
    source => 'Branch',
45
    value => {
46
        branchcode => 'MPL'
47
    }
48
});
49
50
51
34
$dbh->do(q|
52
$dbh->do(q|
35
    INSERT INTO overduerules ( overduerules_id, branchcode, categorycode ) VALUES
53
    INSERT INTO overduerules ( overduerules_id, branchcode, categorycode ) VALUES
36
    (1, 'CPL', 'PT'),
54
    (1, 'CPL', 'PT'),
37
    (2, 'CPL', 'YA'),
55
    (2, 'CPL', 'YA'),
38
    (3, '', 'PT'),
56
    (3, NULL, 'PT'),
39
    (4, '', 'YA')
57
    (4, NULL, 'YA')
40
|);
58
|);
41
59
42
$dbh->do(q|INSERT INTO overduerules_transport_types (overduerules_id, letternumber, message_transport_type) VALUES
60
$dbh->do(q|INSERT INTO overduerules_transport_types (overduerules_id, letternumber, message_transport_type) VALUES
43
- 

Return to bug 18086