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

(-)a/C4/Letters.pm (-4 / +23 lines)
Lines 403-409 sub SendAlerts { Link Here
403
        my $alerts = getalert( '', 'issue', $externalid );
403
        my $alerts = getalert( '', 'issue', $externalid );
404
        foreach (@$alerts) {
404
        foreach (@$alerts) {
405
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
405
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
406
            my $email = $borinfo->{email} or next;
406
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
407
            my $email = $sendAllEmailsTo;
408
            if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation.  This could be improved.
409
                $email = $borinfo->{email} or next;
410
            }
407
411
408
#                    warn "sending issues...";
412
#                    warn "sending issues...";
409
            my $userenv = C4::Context->userenv;
413
            my $userenv = C4::Context->userenv;
Lines 515-524 sub SendAlerts { Link Here
515
        # Remove the order tag
519
        # Remove the order tag
516
        $letter->{content} =~ s/<order>(.*?)<\/order>/$1/gxms;
520
        $letter->{content} =~ s/<order>(.*?)<\/order>/$1/gxms;
517
521
522
        # SendAllEmailsTo system preference to override for testing
523
        my $emailsTo = join( ',', @email);
524
        my $emailsCC = join( ',', @cc);
525
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
526
        # some validation.  This could be improved.
527
        if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ) {
528
            $emailsTo = $sendAllEmailsTo;
529
            $emailsCC = '';
530
        }
531
518
        # ... then send mail
532
        # ... then send mail
519
        my %mail = (
533
        my %mail = (
520
            To => join( ',', @email),
534
            To             => $emailsTo,
521
            Cc             => join( ',', @cc),
535
            Cc             => $emailsCC,
522
            From           => $userenv->{emailaddress},
536
            From           => $userenv->{emailaddress},
523
            Subject        => Encode::encode( "UTF-8", "" . $letter->{title} ),
537
            Subject        => Encode::encode( "UTF-8", "" . $letter->{title} ),
524
            Message => $letter->{'is_html'}
538
            Message => $letter->{'is_html'}
Lines 568-576 sub SendAlerts { Link Here
568
        ) or return;
582
        ) or return;
569
        return { error => "no_email" } unless $externalid->{'emailaddr'};
583
        return { error => "no_email" } unless $externalid->{'emailaddr'};
570
        my $email = Koha::Email->new();
584
        my $email = Koha::Email->new();
585
        my $emailaddr = $externalid->{'emailaddr'};
586
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
587
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
571
        my %mail  = $email->create_message_headers(
588
        my %mail  = $email->create_message_headers(
572
            {
589
            {
573
                to      => $externalid->{'emailaddr'},
590
                to      => $emailaddr,
574
                from    => $branchdetails->{'branchemail'},
591
                from    => $branchdetails->{'branchemail'},
575
                replyto => $branchdetails->{'branchreplyto'},
592
                replyto => $branchdetails->{'branchreplyto'},
576
                sender  => $branchdetails->{'branchreturnpath'},
593
                sender  => $branchdetails->{'branchreturnpath'},
Lines 1128-1133 sub _send_message_by_email { Link Here
1128
1145
1129
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1146
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1130
    my $to_address = $message->{'to_address'};
1147
    my $to_address = $message->{'to_address'};
1148
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1149
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
1131
    unless ($to_address) {
1150
    unless ($to_address) {
1132
        unless ($member) {
1151
        unless ($member) {
1133
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1152
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
(-)a/basket/sendbasket.pl (+2 lines)
Lines 45-51 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
45
);
45
);
46
46
47
my $bib_list     = $query->param('bib_list');
47
my $bib_list     = $query->param('bib_list');
48
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
48
my $email_add    = $query->param('email_add');
49
my $email_add    = $query->param('email_add');
50
$email_add = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
49
my $email_sender = $query->param('email_sender');
51
my $email_sender = $query->param('email_sender');
50
52
51
my $dbh          = C4::Context->dbh;
53
my $dbh          = C4::Context->dbh;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 371-376 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
371
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
371
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
372
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
372
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
373
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
373
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
374
('SendAllEmailsTo','',NULL,'This email will replace the To address in every message sent by the system.  This is meant to help testing only.','Textarea'),
374
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
375
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
375
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
376
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
376
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
377
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 9971-9976 if ( CheckVersion($DBversion) ) { Link Here
9971
    SetVersion($DBversion);
9971
    SetVersion($DBversion);
9972
}
9972
}
9973
9973
9974
$DBversion = "3.19.00.XXX";
9975
if ( CheckVersion($DBversion) ) {
9976
    $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')");
9977
    print "Upgrade to $DBversion done (Bug 8000 - system preferences to override the destination of every email sent by the system.)\n";
9978
    SetVersion ($DBversion);
9979
}
9980
9974
9981
9975
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
9982
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
9976
# SEE bug 13068
9983
# SEE bug 13068
Lines 9985-9990 while ( my $file = readdir $dirh ) { Link Here
9985
    my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
9992
    my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
9986
}
9993
}
9987
9994
9995
9988
=head1 FUNCTIONS
9996
=head1 FUNCTIONS
9989
9997
9990
=head2 TableExists($table)
9998
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+5 lines)
Lines 50-55 Administration: Link Here
50
                  yes: Allow
50
                  yes: Allow
51
                  no: "Don't allow"
51
                  no: "Don't allow"
52
            - staff and patrons to create and view saved lists of books.
52
            - staff and patrons to create and view saved lists of books.
53
        -
54
            - Redirect all emails from Koha to
55
            - pref: SendAllEmailsTo
56
              class: email
57
            - instead of their intended user.
53
    Login options:
58
    Login options:
54
        -
59
        -
55
            - Automatically log out users after
60
            - Automatically log out users after
(-)a/misc/cronjobs/runreport.pl (+2 lines)
Lines 204-209 if ($to or $from or $email) { Link Here
204
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
204
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
205
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
205
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
206
}
206
}
207
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
208
$to = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
207
209
208
unless (scalar(@ARGV)) {
210
unless (scalar(@ARGV)) {
209
    print STDERR "ERROR: No reportID(s) specified\n";
211
    print STDERR "ERROR: No reportID(s) specified\n";
(-)a/opac/opac-sendbasket.pl (+2 lines)
Lines 48-54 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
48
);
48
);
49
49
50
my $bib_list     = $query->param('bib_list');
50
my $bib_list     = $query->param('bib_list');
51
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
51
my $email_add    = $query->param('email_add');
52
my $email_add    = $query->param('email_add');
53
$email_add = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
52
my $email_sender = $query->param('email_sender');
54
my $email_sender = $query->param('email_sender');
53
55
54
my $dbh          = C4::Context->dbh;
56
my $dbh          = C4::Context->dbh;
(-)a/opac/opac-sendshelf.pl (+2 lines)
Lines 48-54 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
48
);
48
);
49
49
50
my $shelfid = $query->param('shelfid');
50
my $shelfid = $query->param('shelfid');
51
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
51
my $email   = $query->param('email');
52
my $email   = $query->param('email');
53
$email = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
52
54
53
my $dbh          = C4::Context->dbh;
55
my $dbh          = C4::Context->dbh;
54
56
(-)a/virtualshelves/sendshelf.pl (-1 / +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
54
- 

Return to bug 8000