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

(-)a/C4/Letters.pm (-4 / +10 lines)
Lines 1322-1329 sub _send_message_by_email { Link Here
1322
    my $cc_address;
1322
    my $cc_address;
1323
    my @guarantor_address;
1323
    my @guarantor_address;
1324
    my $count_guarantor_address;
1324
    my $count_guarantor_address;
1325
    if (C4::Context->preference('RedirectGuaranteeEmail') eq 'yes' && $patron) {
1325
    if (C4::Context->preference('RedirectGuaranteeEmail') && $patron) {
1326
        #Get guanrantor addresses
1326
        # Get guarantor addresses
1327
        my $guarantor_relationships = $patron->guarantor_relationships;
1327
        my $guarantor_relationships = $patron->guarantor_relationships;
1328
        my @guarantors              = $guarantor_relationships->guarantors->as_list;
1328
        my @guarantors              = $guarantor_relationships->guarantors->as_list;
1329
        foreach my $guarantor (@guarantors) {
1329
        foreach my $guarantor (@guarantors) {
Lines 1348-1354 sub _send_message_by_email { Link Here
1348
            $to_address = $patron->notice_email_address;
1348
            $to_address = $patron->notice_email_address;
1349
        }
1349
        }
1350
        if (!$to_address && !$count_guarantor_address) {
1350
        if (!$to_address && !$count_guarantor_address) {
1351
            warn "FAIL: No 'to_address', email address or guantors email address for borrowernumber ($message->{borrowernumber})";
1351
            warn "FAIL: No 'to_address', email address or guarantors email address for borrowernumber ($message->{borrowernumber})";
1352
            _set_message_status(
1352
            _set_message_status(
1353
                {
1353
                {
1354
                    message_id   => $message->{'message_id'},
1354
                    message_id   => $message->{'message_id'},
Lines 1364-1369 sub _send_message_by_email { Link Here
1364
    }
1364
    }
1365
1365
1366
    $cc_address = join( ',', @guarantor_address );
1366
    $cc_address = join( ',', @guarantor_address );
1367
    _update_message_cc_address( $message->{'message_id'}, $cc_address );
1367
    # Skip this message if we exceed domain limits in this run
1368
    # Skip this message if we exceed domain limits in this run
1368
    if( Koha::Notice::Util->exceeds_limit({ to => $to_address, limits => $domain_limits }) ) {
1369
    if( Koha::Notice::Util->exceeds_limit({ to => $to_address, limits => $domain_limits }) ) {
1369
        # Save the to_address if you delay the message so that we dont need to look it up again
1370
        # Save the to_address if you delay the message so that we dont need to look it up again
Lines 1623-1628 sub _update_message_from_address { Link Here
1623
    $dbh->do('UPDATE message_queue SET from_address = ? WHERE message_id = ?', undef, ($from_address, $message_id));
1624
    $dbh->do('UPDATE message_queue SET from_address = ? WHERE message_id = ?', undef, ($from_address, $message_id));
1624
}
1625
}
1625
1626
1627
sub _update_message_cc_address {
1628
    my ($message_id, $cc_address) = @_;
1629
    my $dbh = C4::Context->dbh();
1630
    $dbh->do('UPDATE message_queue SET cc_address = ? WHERE message_id = ?', undef, ($cc_address, $message_id));
1631
}
1632
1626
sub _set_message_status {
1633
sub _set_message_status {
1627
    my $params = shift or return;
1634
    my $params = shift or return;
1628
1635
1629
- 

Return to bug 12532