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

(-)a/Koha/Library.pm (+26 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use Carp;
22
use Carp;
23
23
24
use C4::Context;
24
use Koha::Database;
25
use Koha::Database;
25
26
26
use base qw(Koha::Object);
27
use base qw(Koha::Object);
Lines 54-59 sub add_to_categories { Link Here
54
    }
55
    }
55
}
56
}
56
57
58
=head3 print_notice_email
59
60
Looks up the effective print notice destination email, based on PrintNoticesEmailField.
61
62
=cut
63
64
sub print_notice_email {
65
    my ( $self ) = @_;
66
67
    my $syspref = 'KohaAdminEmailAddress';
68
    my $branchfield = 'branchemail';
69
70
    if ( C4::Context->preference('PrintNoticesEmailField') eq 'replyto' ) {
71
        $syspref = 'ReplytoDefault';
72
        $branchfield = 'branchreplyto';
73
    } elsif ( C4::Context->preference('PrintNoticesEmailField') eq 'returnpath' ) {
74
        $syspref = 'ReturnpathDefault';
75
        $branchfield = 'branchreturnpath';
76
    }
77
78
    return $self->_result->get_column($branchfield) ||
79
        C4::Context->preference($syspref) ||
80
        C4::Context->preference('KohaAdminEmailAddress');
81
}
82
57
=head3 type
83
=head3 type
58
84
59
=cut
85
=cut
(-)a/installer/data/mysql/atomicupdate/bug_15647-add_syspref_PrintNoticesEmailField.sql (+1 lines)
Line 0 Link Here
1
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('PrintNoticesEmailField','email','email|replyto|returnpath','Send print notices to the email address in the given branch field/syspref.','Choice');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 373-378 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
373
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
373
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
374
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
374
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
375
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
375
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
376
('PrintNoticesEmailField','email','email|replyto|returnpath','Send print notices to the email address in the given branch field/syspref.','Choice'),
376
('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'),
377
('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'),
377
('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'),
378
('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'),
378
('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'),
379
('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+9 lines)
Lines 17-22 Administration: Link Here
17
             class: email
17
             class: email
18
           - "as the return path or bounce address for undeliverable mail messages. If you leave this empty, the From address will be used (often defaulting to the admin address)."
18
           - "as the return path or bounce address for undeliverable mail messages. If you leave this empty, the From address will be used (often defaulting to the admin address)."
19
        -
19
        -
20
           - Sent print notices to
21
           - pref: PrintNoticesEmailField
22
             default: email
23
             choices:
24
                 email: "the library's email or KohaAdminEmailAddress."
25
                 replyto: "the library's reply-to email or ReplytoDefault."
26
                 returnpath: "the library's return-path email or ReturnpathDefault."
27
           - This currently only applies to print overdue notices.
28
        -
20
            - Show
29
            - Show
21
            - pref: DebugLevel
30
            - pref: DebugLevel
22
              default: 0
31
              default: 0
(-)a/misc/cronjobs/overdue_notices.pl (-6 / +6 lines)
Lines 46-51 use C4::Log; Link Here
46
use Koha::Borrower::Debarments qw(AddUniqueDebarment);
46
use Koha::Borrower::Debarments qw(AddUniqueDebarment);
47
use Koha::DateUtils;
47
use Koha::DateUtils;
48
use Koha::Calendar;
48
use Koha::Calendar;
49
use Koha::Libraries;
49
50
50
=head1 NAME
51
=head1 NAME
51
52
Lines 439-447 foreach my $branchcode (@branches) { Link Here
439
        }
440
        }
440
    }
441
    }
441
442
442
    my $branch_details      = C4::Branch::GetBranchDetail($branchcode);
443
    my $library = Koha::Libraries->find($branchcode);
443
    my $admin_email_address = $branch_details->{'branchemail'}
444
    my $admin_email_address = $library->print_notice_email;
444
      || C4::Context->preference('KohaAdminEmailAddress');
445
445
    my @output_chunks;    # may be sent to mail or stdout or csv file.
446
    my @output_chunks;    # may be sent to mail or stdout or csv file.
446
447
447
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address;
448
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address;
Lines 680-686 END_SQL Link Here
680
                            branchcode      => $branchcode,
681
                            branchcode      => $branchcode,
681
                            items           => \@items,
682
                            items           => \@items,
682
                            substitute      => {    # this appears to be a hack to overcome incomplete features in this code.
683
                            substitute      => {    # this appears to be a hack to overcome incomplete features in this code.
683
                                                bib             => $branch_details->{'branchname'}, # maybe 'bib' is a typo for 'lib<rary>'?
684
                                                bib             => $library->branchname, # maybe 'bib' is a typo for 'lib<rary>'?
684
                                                'items.content' => $titles,
685
                                                'items.content' => $titles,
685
                                                'count'         => $itemcount,
686
                                                'count'         => $itemcount,
686
                                               },
687
                                               },
Lines 714-720 END_SQL Link Here
714
                              city           => $data->{'city'},
715
                              city           => $data->{'city'},
715
                              phone          => $data->{'phone'},
716
                              phone          => $data->{'phone'},
716
                              cardnumber     => $data->{'cardnumber'},
717
                              cardnumber     => $data->{'cardnumber'},
717
                              branchname     => $branch_details->{'branchname'},
718
                              branchname     => $library->branchname,
718
                              letternumber   => $i,
719
                              letternumber   => $i,
719
                              postcode       => $data->{'zipcode'},
720
                              postcode       => $data->{'zipcode'},
720
                              country        => $data->{'country'},
721
                              country        => $data->{'country'},
721
- 

Return to bug 15647