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 483-488 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
483
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
483
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
484
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
484
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
485
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
485
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
486
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
486
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
487
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
487
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
488
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
488
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
489
('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 514-519 my $borrowernumber = AddMember( Link Here
514
);
514
);
515
my $alert_id = C4::Letters::addalert($borrowernumber, 'issue', $subscriptionid);
515
my $alert_id = C4::Letters::addalert($borrowernumber, 'issue', $subscriptionid);
516
516
517
t::lib::Mocks::mock_preference( 'SendAllEmailsTo', '' );
517
518
518
my $err2;
519
my $err2;
519
warning_is {
520
warning_is {
Lines 523-528 $err2 = SendAlerts( 'issue', $serial->{serialid}, 'RLIST' ) } Link Here
523
is($err2, 1, "Successfully sent serial notification");
524
is($err2, 1, "Successfully sent serial notification");
524
is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notification");
525
is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notification");
525
is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully');
526
is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully');
527
528
t::lib::Mocks::mock_preference( 'SendAllEmailsTo', 'robert.tables@mail.com' );
529
530
my $err3;
531
warning_is {
532
$err3 = SendAlerts( 'issue', $serial->{serialid}, 'RLIST' ) }
533
    "Fake sendmail",
534
    "SendAlerts is using the mocked sendmail routine";
535
is($mail{'To'}, 'robert.tables@mail.com', "mailto address overwritten by SendAllMailsTo preference");
526
}
536
}
527
537
528
subtest 'GetPreparedLetter' => sub {
538
subtest 'GetPreparedLetter' => sub {
529
- 

Return to bug 8000