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

(-)a/C4/Letters.pm (-5 / +15 lines)
Lines 309-315 sub SendAlerts { Link Here
309
                Message => Encode::encode( "utf8", "" . $letter->{content} ),
309
                Message => Encode::encode( "utf8", "" . $letter->{content} ),
310
                'Content-Type' => 'text/plain; charset="utf8"',
310
                'Content-Type' => 'text/plain; charset="utf8"',
311
                );
311
                );
312
            sendmail(%mail) or carp $Mail::Sendmail::error;
312
            unless ( sendmail(%mail) ) {
313
                carp $Mail::Sendmail::error;
314
                return { error => $Mail::Sendmail::error };
315
            }
313
        }
316
        }
314
    }
317
    }
315
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
318
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
Lines 351-357 sub SendAlerts { Link Here
351
        push @email, $databookseller->{contemail}       if $databookseller->{contemail};
354
        push @email, $databookseller->{contemail}       if $databookseller->{contemail};
352
        unless (@email) {
355
        unless (@email) {
353
            warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
356
            warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
354
            return { error => "no_email" };
357
            return { error => "no_to_address" };
355
        }
358
        }
356
359
357
        my $userenv = C4::Context->userenv;
360
        my $userenv = C4::Context->userenv;
Lines 375-381 sub SendAlerts { Link Here
375
            Message        => Encode::encode( "utf8", "" . $letter->{content} ),
378
            Message        => Encode::encode( "utf8", "" . $letter->{content} ),
376
            'Content-Type' => 'text/plain; charset="utf8"',
379
            'Content-Type' => 'text/plain; charset="utf8"',
377
        );
380
        );
378
        sendmail(%mail) or carp $Mail::Sendmail::error;
381
382
        unless ( sendmail(%mail) ) {
383
            carp $Mail::Sendmail::error;
384
            return { error => $Mail::Sendmail::error };
385
        }
379
386
380
        logaction(
387
        logaction(
381
            "ACQUISITION",
388
            "ACQUISITION",
Lines 404-410 sub SendAlerts { Link Here
404
            want_librarian => 1,
411
            want_librarian => 1,
405
        ) or return;
412
        ) or return;
406
413
407
        return { error => "no_email" } unless $externalid->{'emailaddr'};
414
        return { error => "no_to_address" } unless $externalid->{'emailaddr'};
408
        my %mail = (
415
        my %mail = (
409
                To      =>     $externalid->{'emailaddr'},
416
                To      =>     $externalid->{'emailaddr'},
410
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
417
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
Lines 412-418 sub SendAlerts { Link Here
412
                Message => Encode::encode( "utf8", $letter->{'content'} ),
419
                Message => Encode::encode( "utf8", $letter->{'content'} ),
413
                'Content-Type' => 'text/plain; charset="utf8"',
420
                'Content-Type' => 'text/plain; charset="utf8"',
414
        );
421
        );
415
        sendmail(%mail) or carp $Mail::Sendmail::error;
422
        unless ( sendmail(%mail) ) {
423
            carp $Mail::Sendmail::error;
424
            return { error => $Mail::Sendmail::error };
425
        }
416
    }
426
    }
417
}
427
}
418
428
(-)a/C4/Serials.pm (-1 / +6 lines)
Lines 1182-1188 sub ModSerialStatus { Link Here
1182
# check if an alert must be sent... (= a letter is defined & status became "arrived"
1182
# check if an alert must be sent... (= a letter is defined & status became "arrived"
1183
        if ( $val->{letter} && $status == 2 && $oldstatus != 2 ) {
1183
        if ( $val->{letter} && $status == 2 && $oldstatus != 2 ) {
1184
            require C4::Letters;
1184
            require C4::Letters;
1185
            C4::Letters::SendAlerts( 'issue', $val->{subscriptionid}, $val->{letter} );
1185
            eval {
1186
                C4::Letters::SendAlerts( 'issue', $val->{subscriptionid}, $val->{letter} );
1187
            };
1188
            if ( $@ ) {
1189
                #FIXME Do something...
1190
            }
1186
        }
1191
        }
1187
    }
1192
    }
1188
    return;
1193
    return;
(-)a/acqui/lateorders.pl (-1 / +1 lines)
Lines 111-117 if ($op and $op eq "send_alert"){ Link Here
111
    };
111
    };
112
    if ( $@ ) {
112
    if ( $@ ) {
113
        $template->param(error_claim => $@);
113
        $template->param(error_claim => $@);
114
    } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) {
114
    } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_to_address" ) {
115
        $template->{VARS}->{'error_claim'} = "no_email";
115
        $template->{VARS}->{'error_claim'} = "no_email";
116
    } else {
116
    } else {
117
        $template->{VARS}->{'info_claim'} = 1;
117
        $template->{VARS}->{'info_claim'} = 1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt (-2 / +4 lines)
Lines 157-164 Link Here
157
    <h1>Claims</h1>
157
    <h1>Claims</h1>
158
158
159
    [% IF error_claim %]
159
    [% IF error_claim %]
160
        [% IF ( error_claim == "no_email" ) %]
160
        [% IF ( error_claim == "no_vendor_email" ) %]
161
            <div class="error">This vendor has no email</div>
161
            <div class="error">This vendor has no email.</div>
162
        [% ELSIF ( error_claim == "no_loggedin_user_email" ) %]
163
            <div class="error">No email is configured for this account.</div>
162
        [% ELSE %]
164
        [% ELSE %]
163
            <div class="error">[% error_claim %]</div>
165
            <div class="error">[% error_claim %]</div>
164
        [% END %]
166
        [% END %]
(-)a/members/memberentry.pl (-1 / +1 lines)
Lines 367-373 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
367
                };
367
                };
368
                if ( $@ ) {
368
                if ( $@ ) {
369
                    $template->param(error_alert => $@);
369
                    $template->param(error_alert => $@);
370
                } elsif ( ref($err) eq "HASH" && defined $err->{error} and $err->{error} eq "no_email" ) {
370
                } elsif ( ref($err) eq "HASH" && defined $err->{error} and $err->{error} eq "no_to_address" ) {
371
                    $template->{VARS}->{'error_alert'} = "no_email";
371
                    $template->{VARS}->{'error_alert'} = "no_email";
372
                } else {
372
                } else {
373
                    $template->{VARS}->{'info_alert'} = 1;
373
                    $template->{VARS}->{'info_alert'} = 1;
(-)a/serials/claims.pl (-3 / +6 lines)
Lines 70-77 if (@serialnums) { # i.e. they have been flagged to generate claims Link Here
70
    };
70
    };
71
    if ( $@ ) {
71
    if ( $@ ) {
72
        $template->param(error_claim => $@);
72
        $template->param(error_claim => $@);
73
    } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) {
73
    } elsif ( ref $err and exists $err->{error} ) {
74
        $template->{VARS}->{'error_claim'} = "no_email";
74
        if ( $err->{error} eq "no_to_address" ) {
75
            $template->{VARS}->{'error_claim'} = "no_vendor_email";
76
        } elsif ( $err->{error} =~ m|Bad or missing From address| ) {
77
            $template->{VARS}->{'error_claim'} = "no_loggedin_user_email";
78
        }
75
    } else {
79
    } else {
76
        $template->{VARS}->{'info_claim'} = 1;
80
        $template->{VARS}->{'info_claim'} = 1;
77
    }
81
    }
78
- 

Return to bug 5342