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

(-)a/C4/Letters.pm (-4 / +23 lines)
Lines 414-420 sub SendAlerts { Link Here
414
        my $alerts = getalert( '', 'issue', $subscriptionid );
414
        my $alerts = getalert( '', 'issue', $subscriptionid );
415
        foreach (@$alerts) {
415
        foreach (@$alerts) {
416
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
416
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
417
            my $email = $borinfo->{email} or next;
417
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
418
            my $email = $sendAllEmailsTo;
419
            if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation.  This could be improved.
420
                $email = $borinfo->{email} or next;
421
            }
418
422
419
#                    warn "sending issues...";
423
#                    warn "sending issues...";
420
            my $userenv = C4::Context->userenv;
424
            my $userenv = C4::Context->userenv;
Lines 528-537 sub SendAlerts { Link Here
528
        # Remove the order tag
532
        # Remove the order tag
529
        $letter->{content} =~ s/<order>(.*?)<\/order>/$1/gxms;
533
        $letter->{content} =~ s/<order>(.*?)<\/order>/$1/gxms;
530
534
535
        # SendAllEmailsTo system preference to override for testing
536
        my $emailsTo = join( ',', @email);
537
        my $emailsCC = join( ',', @cc);
538
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
539
        # some validation.  This could be improved.
540
        if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ) {
541
            $emailsTo = $sendAllEmailsTo;
542
            $emailsCC = '';
543
        }
544
531
        # ... then send mail
545
        # ... then send mail
532
        my %mail = (
546
        my %mail = (
533
            To => join( ',', @email),
547
            To             => $emailsTo,
534
            Cc             => join( ',', @cc),
548
            Cc             => $emailsCC,
535
            From           => $userenv->{emailaddress},
549
            From           => $userenv->{emailaddress},
536
            Subject        => Encode::encode( "UTF-8", "" . $letter->{title} ),
550
            Subject        => Encode::encode( "UTF-8", "" . $letter->{title} ),
537
            Message => $letter->{'is_html'}
551
            Message => $letter->{'is_html'}
Lines 583-591 sub SendAlerts { Link Here
583
        ) or return;
597
        ) or return;
584
        return { error => "no_email" } unless $externalid->{'emailaddr'};
598
        return { error => "no_email" } unless $externalid->{'emailaddr'};
585
        my $email = Koha::Email->new();
599
        my $email = Koha::Email->new();
600
        my $emailaddr = $externalid->{'emailaddr'};
601
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
602
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
586
        my %mail  = $email->create_message_headers(
603
        my %mail  = $email->create_message_headers(
587
            {
604
            {
588
                to      => $externalid->{'emailaddr'},
605
                to      => $emailaddr,
589
                from    => $branchdetails->{'branchemail'},
606
                from    => $branchdetails->{'branchemail'},
590
                replyto => $branchdetails->{'branchreplyto'},
607
                replyto => $branchdetails->{'branchreplyto'},
591
                sender  => $branchdetails->{'branchreturnpath'},
608
                sender  => $branchdetails->{'branchreturnpath'},
Lines 1171-1176 sub _send_message_by_email { Link Here
1171
1188
1172
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1189
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1173
    my $to_address = $message->{'to_address'};
1190
    my $to_address = $message->{'to_address'};
1191
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1192
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
1174
    unless ($to_address) {
1193
    unless ($to_address) {
1175
        unless ($member) {
1194
        unless ($member) {
1176
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1195
            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 410-415 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
410
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
410
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
411
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
411
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
412
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
412
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
413
('SendAllEmailsTo','',NULL,'This email will replace the To address in every message sent by the system.  This is meant to help testing only.','Textarea'),
413
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
414
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
414
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
415
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
415
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
416
('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 11686-11691 foreach my $file ( sort readdir $dirh ) { Link Here
11686
    }
11686
    }
11687
}
11687
}
11688
11688
11689
11689
=head1 FUNCTIONS
11690
=head1 FUNCTIONS
11690
11691
11691
=head2 TableExists($table)
11692
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+5 lines)
Lines 71-76 Administration: Link Here
71
                  yes: "logged in library's"
71
                  yes: "logged in library's"
72
                  no: "all libraries"
72
                  no: "all libraries"
73
            - rules by default.
73
            - rules by default.
74
        -
75
            - Redirect all emails from Koha to
76
            - pref: SendAllEmailsTo
77
              class: email
78
            - instead of their intended user.
74
    Login options:
79
    Login options:
75
        -
80
        -
76
            - Automatically log out users after
81
            - Automatically log out users after
(-)a/misc/cronjobs/runreport.pl (+2 lines)
Lines 211-216 if ($to or $from or $email) { Link Here
211
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
211
    $from or $from = C4::Context->preference('KohaAdminEmailAddress');
212
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
212
    $to   or $to   = C4::Context->preference('KohaAdminEmailAddress');
213
}
213
}
214
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
215
$to = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
214
216
215
unless (scalar(@ARGV)) {
217
unless (scalar(@ARGV)) {
216
    print STDERR "ERROR: No reportID(s) specified\n";
218
    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