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

(-)a/C4/Letters.pm (-3 / +16 lines)
Lines 284-290 sub SendAlerts { Link Here
284
        foreach (@$alerts) {
284
        foreach (@$alerts) {
285
285
286
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
286
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
287
            my $email = $borinfo->{email} or next;
287
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
288
            my $email = $sendAllEmailsTo;
289
            if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation.  This could be improved.
290
                $email = $borinfo->{email} or next;
291
            }
288
292
289
            # 		warn "sending issues...";
293
            # 		warn "sending issues...";
290
            my $userenv = C4::Context->userenv;
294
            my $userenv = C4::Context->userenv;
Lines 368-376 sub SendAlerts { Link Here
368
            want_librarian => 1,
372
            want_librarian => 1,
369
        ) or return;
373
        ) or return;
370
374
375
        my $allemails = join( ',', @email);
376
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
377
        $allemails = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
371
        # ... then send mail
378
        # ... then send mail
372
        my %mail = (
379
        my %mail = (
373
            To => join( ',', @email),
380
            To             => $allemails,
374
            From           => $userenv->{emailaddress},
381
            From           => $userenv->{emailaddress},
375
            Subject        => Encode::encode( "utf8", "" . $letter->{title} ),
382
            Subject        => Encode::encode( "utf8", "" . $letter->{title} ),
376
            Message        => Encode::encode( "utf8", "" . $letter->{content} ),
383
            Message        => Encode::encode( "utf8", "" . $letter->{content} ),
Lines 406-413 sub SendAlerts { Link Here
406
        ) or return;
413
        ) or return;
407
414
408
        return { error => "no_email" } unless $externalid->{'emailaddr'};
415
        return { error => "no_email" } unless $externalid->{'emailaddr'};
416
        my $emailaddr = $externalid->{'emailaddr'};
417
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
418
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
419
        # ... then send mail
409
        my %mail = (
420
        my %mail = (
410
                To      =>     $externalid->{'emailaddr'},
421
                To      => $emailaddr,
411
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
422
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
412
                Subject => Encode::encode( "utf8", $letter->{'title'} ),
423
                Subject => Encode::encode( "utf8", $letter->{'title'} ),
413
                Message => Encode::encode( "utf8", $letter->{'content'} ),
424
                Message => Encode::encode( "utf8", $letter->{'content'} ),
Lines 926-931 sub _send_message_by_email { Link Here
926
937
927
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
938
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
928
    my $to_address = $message->{'to_address'};
939
    my $to_address = $message->{'to_address'};
940
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
941
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
929
    unless ($to_address) {
942
    unless ($to_address) {
930
        unless ($member) {
943
        unless ($member) {
931
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
944
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
(-)a/basket/sendbasket.pl (+2 lines)
Lines 44-50 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
44
);
44
);
45
45
46
my $bib_list     = $query->param('bib_list');
46
my $bib_list     = $query->param('bib_list');
47
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
47
my $email_add    = $query->param('email_add');
48
my $email_add    = $query->param('email_add');
49
$email_add = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
48
my $email_sender = $query->param('email_sender');
50
my $email_sender = $query->param('email_sender');
49
51
50
my $dbh          = C4::Context->dbh;
52
my $dbh          = C4::Context->dbh;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 336-341 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
336
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
336
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
337
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
337
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
338
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
338
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
339
('SendAllEmailsTo','',NULL,'This email will replace the To address in every message sent by the system.  This is meant to help testing only.','Textarea'),
339
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
340
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
340
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
341
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
341
('SessionStorage','mysql','mysql|Pg|tmp','Use database or a temporary file for storing session data','Choice'),
342
('SessionStorage','mysql','mysql|Pg|tmp','Use database or a temporary file for storing session data','Choice'),
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 8012-8017 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
8012
    SetVersion($DBversion);
8012
    SetVersion($DBversion);
8013
}
8013
}
8014
8014
8015
$DBversion = "3.15.00.XXX";
8016
if ( CheckVersion($DBversion) ) {
8017
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SendAllEmailsTo','',NULL,'This email will replace the To address in every message sent by the system.  This is meant to help testing and validation only.','Textarea')");
8018
    print "Upgrade to $DBversion done (Bug 8000 - system preferences to override the destination of every email sent by the system.)\n";
8019
    SetVersion ($DBversion);
8020
}
8021
8015
=head1 FUNCTIONS
8022
=head1 FUNCTIONS
8016
8023
8017
=head2 TableExists($table)
8024
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+5 lines)
Lines 40-45 Administration: Link Here
40
                  yes: Allow
40
                  yes: Allow
41
                  no: "Don't allow"
41
                  no: "Don't allow"
42
            - staff and patrons to create and view saved lists of books.
42
            - staff and patrons to create and view saved lists of books.
43
        -
44
            - Redirect all emails from Koha to
45
            - pref: SendAllEmailsTo
46
              class: email
47
            - instead of their intended user.
43
    Login options:
48
    Login options:
44
        -
49
        -
45
            - Automatically log out users after
50
            - Automatically log out users after
(-)a/misc/cronjobs/runreport.pl (+2 lines)
Lines 179-184 if ($to or $from or $email) { Link Here
179
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
179
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
180
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
180
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
181
}
181
}
182
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
183
$to = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
182
184
183
unless (scalar(@ARGV)) {
185
unless (scalar(@ARGV)) {
184
    print STDERR "ERROR: No reportID(s) specified\n";
186
    print STDERR "ERROR: No reportID(s) specified\n";
(-)a/opac/opac-sendbasket.pl (+2 lines)
Lines 47-53 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
47
);
47
);
48
48
49
my $bib_list     = $query->param('bib_list');
49
my $bib_list     = $query->param('bib_list');
50
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
50
my $email_add    = $query->param('email_add');
51
my $email_add    = $query->param('email_add');
52
$email_add = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
51
my $email_sender = $query->param('email_sender');
53
my $email_sender = $query->param('email_sender');
52
54
53
my $dbh          = C4::Context->dbh;
55
my $dbh          = C4::Context->dbh;
(-)a/opac/opac-sendshelf.pl (+2 lines)
Lines 47-53 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
47
);
47
);
48
48
49
my $shelfid = $query->param('shelfid');
49
my $shelfid = $query->param('shelfid');
50
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
50
my $email   = $query->param('email');
51
my $email   = $query->param('email');
52
$email = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
51
53
52
my $dbh          = C4::Context->dbh;
54
my $dbh          = C4::Context->dbh;
53
55
(-)a/virtualshelves/sendshelf.pl (-1 / +2 lines)
Lines 46-52 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
46
);
46
);
47
47
48
my $shelfid = $query->param('shelfid');
48
my $shelfid = $query->param('shelfid');
49
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
49
my $email   = $query->param('email');
50
my $email   = $query->param('email');
51
$email = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
50
52
51
my $dbh          = C4::Context->dbh;
53
my $dbh          = C4::Context->dbh;
52
54
53
- 

Return to bug 8000