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 1132-1137 sub _send_message_by_email { Link Here
1132
1149
1133
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1150
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1134
    my $to_address = $message->{'to_address'};
1151
    my $to_address = $message->{'to_address'};
1152
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1153
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
1135
    unless ($to_address) {
1154
    unless ($to_address) {
1136
        unless ($member) {
1155
        unless ($member) {
1137
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1156
            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 376-381 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
376
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
376
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
377
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
377
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
378
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
378
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
379
('SendAllEmailsTo','',NULL,'This email will replace the To address in every message sent by the system.  This is meant to help testing only.','Textarea'),
379
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
380
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
380
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
381
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
381
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
382
('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 (+1 lines)
Lines 10554-10559 foreach my $file ( sort readdir $dirh ) { Link Here
10554
    }
10554
    }
10555
}
10555
}
10556
10556
10557
10557
=head1 FUNCTIONS
10558
=head1 FUNCTIONS
10558
10559
10559
=head2 TableExists($table)
10560
=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 207-212 if ($to or $from or $email) { Link Here
207
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
207
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
208
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
208
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
209
}
209
}
210
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
211
$to = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
210
212
211
unless (scalar(@ARGV)) {
213
unless (scalar(@ARGV)) {
212
    print STDERR "ERROR: No reportID(s) specified\n";
214
    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