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

(-)a/C4/Overdues.pm (+8 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
        if ($default_rule){
690
            warn "default rule";
691
        }
692
        return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
693
    }
687
    if ( defined $branchcodes->[0] && $branchcodes->[0] eq '' ) {
694
    if ( defined $branchcodes->[0] && $branchcodes->[0] eq '' ) {
688
        # If a default rule exists, all branches should be returned
695
        # If a default rule exists, all branches should be returned
689
        return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
696
        return Koha::Libraries->search({}, { order_by => 'branchname' })->get_column('branchcode');
Lines 766-771 sub GetOverduesForBranch { Link Here
766
sub GetOverdueMessageTransportTypes {
773
sub GetOverdueMessageTransportTypes {
767
    my ( $branchcode, $categorycode, $letternumber ) = @_;
774
    my ( $branchcode, $categorycode, $letternumber ) = @_;
768
    return unless $categorycode and $letternumber;
775
    return unless $categorycode and $letternumber;
776
    $branchcode = undef if ($branchcode eq '');
769
    my $rule = Koha::OverdueRules->search(
777
    my $rule = Koha::OverdueRules->search(
770
        {
778
        {
771
            branchcode   => $branchcode,
779
            branchcode   => $branchcode,
(-)a/t/db_dependent/Overdues.t (-3 / +12 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
$dbh->do(q|
37
    INSERT INTO branches ( branchcode, branchname ) VALUES
38
    ('CPL', 'foo'),
39
    ('MPL', 'bar')
40
|);
41
42
43
34
$dbh->do(q|
44
$dbh->do(q|
35
    INSERT INTO overduerules ( overduerules_id, branchcode, categorycode ) VALUES
45
    INSERT INTO overduerules ( overduerules_id, branchcode, categorycode ) VALUES
36
    (1, 'CPL', 'PT'),
46
    (1, 'CPL', 'PT'),
37
    (2, 'CPL', 'YA'),
47
    (2, 'CPL', 'YA'),
38
    (3, '', 'PT'),
48
    (3, NULL, 'PT'),
39
    (4, '', 'YA')
49
    (4, NULL, 'YA')
40
|);
50
|);
41
51
42
$dbh->do(q|INSERT INTO overduerules_transport_types (overduerules_id, letternumber, message_transport_type) VALUES
52
$dbh->do(q|INSERT INTO overduerules_transport_types (overduerules_id, letternumber, message_transport_type) VALUES
43
- 

Return to bug 18086