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

(-)a/Koha/Email.pm (+6 lines)
Lines 18-23 Link Here
18
package Koha::Email;
18
package Koha::Email;
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Email::Valid;
21
22
22
use base qw(Class::Accessor);
23
use base qw(Class::Accessor);
23
use C4::Context;
24
use C4::Context;
Lines 49-54 sub create_message_headers { Link Here
49
        From    => $params->{from},
50
        From    => $params->{from},
50
        charset => $params->{charset}
51
        charset => $params->{charset}
51
    );
52
    );
53
54
    if (C4::Context->preference('SendAllEmailsTo') && Email::Valid->address(C4::Context->preference('SendAllEmailsTo'))) {
55
        $mail{'To'} = C4::Context->preference('SendAllEmailsTo');
56
    }
57
52
    if ( C4::Context->preference('ReplytoDefault') ) {
58
    if ( C4::Context->preference('ReplytoDefault') ) {
53
        $params->{replyto} ||= C4::Context->preference('ReplytoDefault');
59
        $params->{replyto} ||= C4::Context->preference('ReplytoDefault');
54
    }
60
    }
(-)a/installer/data/mysql/atomicupdate/Bug8000-SendAllEmailsTo.syspref.sql (+2 lines)
Line 0 Link Here
1
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
2
VALUES ('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free');
(-)a/installer/data/mysql/sysprefs.sql (-1 / +2 lines)
Lines 1-4 Link Here
1
INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
1
INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),` ) VALUES
2
('AcqCreateItem','ordering','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'),
2
('AcqCreateItem','ordering','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'),
3
('AcqEnableFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to invoice records.','YesNo'),
3
('AcqEnableFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to invoice records.','YesNo'),
4
('AcqItemSetSubfieldsWhenReceiptIsCancelled','', '','Upon cancelling a receipt, update the items subfields if they were created when placing an order (e.g. o=5|a="bar foo")', 'Free'),
4
('AcqItemSetSubfieldsWhenReceiptIsCancelled','', '','Upon cancelling a receipt, update the items subfields if they were created when placing an order (e.g. o=5|a="bar foo")', 'Free'),
Lines 490-495 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
490
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
490
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
491
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
491
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
492
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
492
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
493
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
493
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
494
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
494
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
495
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
495
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
496
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+5 lines)
Lines 16-21 Administration: Link Here
16
              class: email
16
              class: email
17
            - "If you leave this empty, the From address will be used (often defaulting to the admin address)."
17
            - "If you leave this empty, the From address will be used (often defaulting to the admin address)."
18
        -
18
        -
19
            - "Email to redirect all messages to: "
20
            - pref: SendAllEmailsTo
21
              class: email
22
            - "(Leave this field empty to send messages to their normal recipient)"
23
        -
19
            - "How much debugging information to show in the browser when an internal error occurs: "
24
            - "How much debugging information to show in the browser when an internal error occurs: "
20
            - pref: DebugLevel
25
            - pref: DebugLevel
21
              default: 0
26
              default: 0
(-)a/t/db_dependent/Letters.t (-2 / +11 lines)
Lines 18-24 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 77;
21
use Test::More tests => 79;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
24
Lines 515-520 my $borrowernumber = AddMember( Link Here
515
);
515
);
516
my $alert_id = C4::Letters::addalert($borrowernumber, 'issue', $subscriptionid);
516
my $alert_id = C4::Letters::addalert($borrowernumber, 'issue', $subscriptionid);
517
517
518
t::lib::Mocks::mock_preference( 'SendAllEmailsTo', '' );
518
519
519
my $err2;
520
my $err2;
520
warning_is {
521
warning_is {
Lines 524-529 $err2 = SendAlerts( 'issue', $serial->{serialid}, 'RLIST' ) } Link Here
524
is($err2, 1, "Successfully sent serial notification");
525
is($err2, 1, "Successfully sent serial notification");
525
is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notification");
526
is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notification");
526
is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully');
527
is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully');
528
529
t::lib::Mocks::mock_preference( 'SendAllEmailsTo', 'robert.tables@mail.com' );
530
531
my $err3;
532
warning_is {
533
$err3 = SendAlerts( 'issue', $serial->{serialid}, 'RLIST' ) }
534
    "Fake sendmail",
535
    "SendAlerts is using the mocked sendmail routine";
536
is($mail{'To'}, 'robert.tables@mail.com', "mailto address overwritten by SendAllMailsTo preference");
527
}
537
}
528
538
529
subtest 'GetPreparedLetter' => sub {
539
subtest 'GetPreparedLetter' => sub {
530
- 

Return to bug 8000