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

(-)a/C4/Letters.pm (-4 / +15 lines)
Lines 372-377 sub findrelatedto { Link Here
372
372
373
    send an alert to all borrowers having put an alert on a given subject.
373
    send an alert to all borrowers having put an alert on a given subject.
374
374
375
    Returns undef or { error => 'message } on failure.
376
    Returns true on success.
377
375
=cut
378
=cut
376
379
377
sub SendAlerts {
380
sub SendAlerts {
Lines 441-447 sub SendAlerts { Link Here
441
                                    : 'text/plain; charset="utf-8"',
444
                                    : 'text/plain; charset="utf-8"',
442
                }
445
                }
443
            );
446
            );
444
            sendmail(%mail) or carp $Mail::Sendmail::error;
447
            unless( sendmail(%mail) ) {
448
                carp $Mail::Sendmail::error;
449
                return { error => $Mail::Sendmail::error };
450
            }
445
        }
451
        }
446
    }
452
    }
447
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
453
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
Lines 469-475 sub SendAlerts { Link Here
469
475
470
        if (!@$externalid){
476
        if (!@$externalid){
471
            carp "No Order seleted";
477
            carp "No Order seleted";
472
            return { error => "no_order_seleted" };
478
            return { error => "no_order_selected" };
473
        }
479
        }
474
480
475
        $strsth .= join( ",", @$externalid ) . ")";
481
        $strsth .= join( ",", @$externalid ) . ")";
Lines 555-561 sub SendAlerts { Link Here
555
                . " Content="
561
                . " Content="
556
                . $letter->{content}
562
                . $letter->{content}
557
        ) if C4::Context->preference("LetterLog");
563
        ) if C4::Context->preference("LetterLog");
558
        1;
559
    }
564
    }
560
   # send an "account details" notice to a newly created user
565
   # send an "account details" notice to a newly created user
561
    elsif ( $type eq 'members' ) {
566
    elsif ( $type eq 'members' ) {
Lines 589-596 sub SendAlerts { Link Here
589
                                : 'text/plain; charset="utf-8"',
594
                                : 'text/plain; charset="utf-8"',
590
            }
595
            }
591
        );
596
        );
592
        sendmail(%mail) or carp $Mail::Sendmail::error;
597
        unless( sendmail(%mail) ) {
598
            carp $Mail::Sendmail::error;
599
            return { error => $Mail::Sendmail::error };
600
        }
593
    }
601
    }
602
603
    # If we come here, return an OK status
604
    return 1;
594
}
605
}
595
606
596
=head2 GetPreparedLetter( %params )
607
=head2 GetPreparedLetter( %params )
(-)a/t/db_dependent/Letters.t (-2 / +1 lines)
Lines 467-473 warning_is { Link Here
467
$err2 = SendAlerts( 'issue', $serial->{serialid}, 'RLIST' ) }
467
$err2 = SendAlerts( 'issue', $serial->{serialid}, 'RLIST' ) }
468
    "Fake sendmail",
468
    "Fake sendmail",
469
    "SendAlerts is using the mocked sendmail routine";
469
    "SendAlerts is using the mocked sendmail routine";
470
is($err2, "", "Successfully sent serial notification");
470
is($err2, 1, "Successfully sent serial notification");
471
is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notification");
471
is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notification");
472
is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully');
472
is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully');
473
}
473
}
474
- 

Return to bug 17441