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

(-)a/Koha/Exceptions/Ill.pm (+16 lines)
Lines 25-30 use Exception::Class ( Link Here
25
    'Koha::Exceptions::Ill::InvalidBackendId' => {
25
    'Koha::Exceptions::Ill::InvalidBackendId' => {
26
        isa => 'Koha::Exceptions::Ill',
26
        isa => 'Koha::Exceptions::Ill',
27
        description => "Invalid backend name required",
27
        description => "Invalid backend name required",
28
    },
29
    'Koha::Exceptions::Ill::NoTargetEmail' => {
30
        isa => 'Koha::Exceptions::Ill',
31
        description => "ILL partner library has no email address configured",
32
    },
33
    'Koha::Exceptions::Ill::NoLibraryEmail' => {
34
        isa => 'Koha::Exceptions::Ill',
35
        description => "Invalid backend name required",
28
    }
36
    }
29
);
37
);
30
38
Lines 42-47 Generic Ill exception Link Here
42
50
43
Exception to be used when the required ILL backend is invalid.
51
Exception to be used when the required ILL backend is invalid.
44
52
53
=head2 Koha::Exceptions::Ill::NoTargetEmail
54
55
Exception to be used when the ILL partner has no email address set.
56
57
=head2 Koha::Exceptions::Ill::NoLibraryEmail
58
59
Exception to be used when the current library has no email address set.
60
45
=cut
61
=cut
46
62
47
1;
63
1;
(-)a/Koha/Illrequest.pm (-3 / +7 lines)
Lines 892-903 EOF Link Here
892
            $to =~ s/^\x00//;       # Strip leading NULLs
892
            $to =~ s/^\x00//;       # Strip leading NULLs
893
            $to =~ s/\x00/; /;      # Replace others with '; '
893
            $to =~ s/\x00/; /;      # Replace others with '; '
894
        }
894
        }
895
        die "No target email addresses found. Either select at least one partner or check your ILL partner library records." if ( !$to );
895
        Koha::Exceptions::Ill::NoTargetEmail->throw(
896
            "No target email addresses found. Either select at least one partner or check your ILL partner library records.")
897
          if ( !$to );
896
        # Create the from, replyto and sender headers
898
        # Create the from, replyto and sender headers
897
        my $from = $branch->branchemail;
899
        my $from = $branch->branchemail;
898
        my $replyto = $branch->branchreplyto || $from;
900
        my $replyto = $branch->branchreplyto || $from;
899
        die "Your branch has no email address. Please set it."
901
        Koha::Exceptions::Ill::NoLibraryEmail->throw(
900
            if ( !$from );
902
            "Your library has no usable email address. Please set it.")
903
          if ( !$from );
904
901
        # Create the email
905
        # Create the email
902
        my $message = Koha::Email->new;
906
        my $message = Koha::Email->new;
903
        my %mail = $message->create_message_headers(
907
        my %mail = $message->create_message_headers(
(-)a/ill/ill-requests.pl (-10 / +33 lines)
Lines 27-32 use Koha::AuthorisedValues; Link Here
27
use Koha::Illrequests;
27
use Koha::Illrequests;
28
use Koha::Libraries;
28
use Koha::Libraries;
29
29
30
use Try::Tiny;
31
30
our $cgi = CGI->new;
32
our $cgi = CGI->new;
31
my $illRequests = Koha::Illrequests->new;
33
my $illRequests = Koha::Illrequests->new;
32
34
Lines 182-198 if ( $backends_available ) { Link Here
182
        handle_commit_maybe($backend_result, $request);
184
        handle_commit_maybe($backend_result, $request);
183
185
184
    } elsif ( $op eq 'generic_confirm' ) {
186
    } elsif ( $op eq 'generic_confirm' ) {
185
        my $request = Koha::Illrequests->find($params->{illrequest_id});
187
        try {
186
        $params->{current_branchcode} = C4::Context->mybranch;
188
            my $request = Koha::Illrequests->find($params->{illrequest_id});
187
        my $backend_result = $request->generic_confirm($params);
189
            $params->{current_branchcode} = C4::Context->mybranch;
188
        $template->param(
190
            my $backend_result = $request->generic_confirm($params);
189
            whole => $backend_result,
191
            $template->param(
190
            request => $request,
192
                whole => $backend_result,
191
        );
193
                request => $request,
192
194
            );
193
        # handle special commit rules & update type
195
            $template->param( error => $params->{error} )
194
        handle_commit_maybe($backend_result, $request);
196
                if $params->{error};
195
197
198
            # handle special commit rules & update type
199
            handle_commit_maybe($backend_result, $request);
200
        }
201
        catch {
202
            my $error;
203
            if ( $_->isa( 'Koha::Exceptions::Ill::NoTargetEmail' ) ) {
204
                $error = 'no_target_email';
205
            }
206
            elsif ( $_->isa( 'Koha::Exceptions::Ill::NoLibraryEmail' ) ) {
207
                $error = 'no_library_email';
208
            }
209
            else {
210
                $error = 'unknown_error';
211
            }
212
            print $cgi->redirect(
213
                "/cgi-bin/koha/ill/ill-requests.pl?" .
214
                "method=generic_confirm&illrequest_id=" .
215
                $params->{illrequest_id} .
216
                "&error=$error" );
217
            exit;
218
        };
196
    } elsif ( $op eq 'illlist') {
219
    } elsif ( $op eq 'illlist') {
197
        # Display all current ILLs
220
        # Display all current ILLs
198
        my $requests = $illRequests->search();
221
        my $requests = $illRequests->search();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-1 / +12 lines)
Lines 421-426 Link Here
421
421
422
                [% ELSIF query_type == 'generic_confirm' %]
422
                [% ELSIF query_type == 'generic_confirm' %]
423
                    <h1>Place request with partner libraries</h1>
423
                    <h1>Place request with partner libraries</h1>
424
                  [% IF error %]
425
                      <div class="alert">
426
                    [% IF error == 'no_target_email' %]
427
                          No target email addresses found. Either select at least
428
                          one partner or check your ILL partner library records.
429
                    [% ELSIF error == 'no_library_email' %]
430
                          Your library has no usable email address. Please set it.
431
                    [% ELSIF error == 'unkown_error' %]
432
                          Unknown error processing your request. Contact your administrator.
433
                    [% END %]
434
                      </div>
435
                  [% END %]
424
                    <!-- Start of GENERIC_EMAIL case -->
436
                    <!-- Start of GENERIC_EMAIL case -->
425
                    [% IF whole.value.partners %]
437
                    [% IF whole.value.partners %]
426
                       [% ill_url = here_link _ "?method=illview&illrequest_id=" _ request.illrequest_id %]
438
                       [% ill_url = here_link _ "?method=illview&illrequest_id=" _ request.illrequest_id %]
427
- 

Return to bug 7317