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

(-)a/C4/Letters.pm (-4 / +23 lines)
Lines 404-410 sub SendAlerts { Link Here
404
        my $alerts = getalert( '', 'issue', $externalid );
404
        my $alerts = getalert( '', 'issue', $externalid );
405
        foreach (@$alerts) {
405
        foreach (@$alerts) {
406
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
406
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
407
            my $email = $borinfo->{email} or next;
407
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
408
            my $email = $sendAllEmailsTo;
409
            if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation.  This could be improved.
410
                $email = $borinfo->{email} or next;
411
            }
408
412
409
#                    warn "sending issues...";
413
#                    warn "sending issues...";
410
            my $userenv = C4::Context->userenv;
414
            my $userenv = C4::Context->userenv;
Lines 516-525 sub SendAlerts { Link Here
516
        # Remove the order tag
520
        # Remove the order tag
517
        $letter->{content} =~ s/<order>(.*?)<\/order>/$1/gxms;
521
        $letter->{content} =~ s/<order>(.*?)<\/order>/$1/gxms;
518
522
523
        # SendAllEmailsTo system preference to override for testing
524
        my $emailsTo = join( ',', @email);
525
        my $emailsCC = join( ',', @cc);
526
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
527
        # some validation.  This could be improved.
528
        if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ) {
529
            $emailsTo = $sendAllEmailsTo;
530
            $emailsCC = '';
531
        }
532
519
        # ... then send mail
533
        # ... then send mail
520
        my %mail = (
534
        my %mail = (
521
            To => join( ',', @email),
535
            To             => $emailsTo,
522
            Cc             => join( ',', @cc),
536
            Cc             => $emailsCC,
523
            From           => $userenv->{emailaddress},
537
            From           => $userenv->{emailaddress},
524
            Subject        => Encode::encode( "UTF-8", "" . $letter->{title} ),
538
            Subject        => Encode::encode( "UTF-8", "" . $letter->{title} ),
525
            Message => $letter->{'is_html'}
539
            Message => $letter->{'is_html'}
Lines 569-577 sub SendAlerts { Link Here
569
        ) or return;
583
        ) or return;
570
        return { error => "no_email" } unless $externalid->{'emailaddr'};
584
        return { error => "no_email" } unless $externalid->{'emailaddr'};
571
        my $email = Koha::Email->new();
585
        my $email = Koha::Email->new();
586
        my $emailaddr = $externalid->{'emailaddr'};
587
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
588
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
572
        my %mail  = $email->create_message_headers(
589
        my %mail  = $email->create_message_headers(
573
            {
590
            {
574
                to      => $externalid->{'emailaddr'},
591
                to      => $emailaddr,
575
                from    => $branchdetails->{'branchemail'},
592
                from    => $branchdetails->{'branchemail'},
576
                replyto => $branchdetails->{'branchreplyto'},
593
                replyto => $branchdetails->{'branchreplyto'},
577
                sender  => $branchdetails->{'branchreturnpath'},
594
                sender  => $branchdetails->{'branchreturnpath'},
Lines 1133-1138 sub _send_message_by_email { Link Here
1133
1150
1134
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1151
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1135
    my $to_address = $message->{'to_address'};
1152
    my $to_address = $message->{'to_address'};
1153
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1154
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
1136
    unless ($to_address) {
1155
    unless ($to_address) {
1137
        unless ($member) {
1156
        unless ($member) {
1138
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1157
            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
51
50
my $dbh          = C4::Context->dbh;
52
my $dbh          = C4::Context->dbh;
51
53
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 375-380 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
375
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
375
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
376
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
376
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
377
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
377
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
378
('SendAllEmailsTo','',NULL,'This email will replace the To address in every message sent by the system.  This is meant to help testing only.','Textarea'),
378
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
379
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
379
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
380
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
380
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
381
('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 10612-10617 foreach my $file ( sort readdir $dirh ) { Link Here
10612
    }
10612
    }
10613
}
10613
}
10614
10614
10615
10615
=head1 FUNCTIONS
10616
=head1 FUNCTIONS
10616
10617
10617
=head2 TableExists($table)
10618
=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 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
53
52
my $dbh          = C4::Context->dbh;
54
my $dbh          = C4::Context->dbh;
53
55
(-)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 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