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

(-)a/Koha/Illrequest.pm (-1 / +31 lines)
Lines 1-6 Link Here
1
package Koha::Illrequest;
1
package Koha::Illrequest;
2
2
3
# Copyright PTFS Europe 2016
3
# Copyright PTFS Europe 2016,2018
4
#
4
#
5
# This file is part of Koha.
5
# This file is part of Koha.
6
#
6
#
Lines 920-925 EOF Link Here
920
        my $result = sendmail(%mail);
920
        my $result = sendmail(%mail);
921
        if ( $result ) {
921
        if ( $result ) {
922
            $self->status("GENREQ")->store;
922
            $self->status("GENREQ")->store;
923
            $self->_backend_capability(
924
                'set_requested_partners',
925
                {
926
                    request => $self,
927
                    to => $to
928
                }
929
            );
923
            return {
930
            return {
924
                error   => 0,
931
                error   => 0,
925
                status  => '',
932
                status  => '',
Lines 984-989 sub _censor { Link Here
984
    return $params;
991
    return $params;
985
}
992
}
986
993
994
=head3 requested_partners
995
996
    my $partners_string = $illRequest->requested_partners;
997
998
Return the string representing the email addresses of the parters to
999
whom a request has been sent
1000
1001
=cut
1002
1003
sub requested_partners {
1004
    my ( $self ) = @_;
1005
    return $self->_backend_capability(
1006
        'get_requested_partners',
1007
        { request => $self }
1008
    );
1009
}
1010
987
=head3 TO_JSON
1011
=head3 TO_JSON
988
1012
989
    $json = $illrequest->TO_JSON
1013
    $json = $illrequest->TO_JSON
Lines 1023-1028 sub TO_JSON { Link Here
1023
                $self->branchcode
1047
                $self->branchcode
1024
            )->TO_JSON;
1048
            )->TO_JSON;
1025
        }
1049
        }
1050
        # Augment the request response with requested partner details
1051
        # if appropriate
1052
        if ( $embed->{requested_partners} ) {
1053
            $object->{requested_partners} = $self->requested_partners;
1054
        }
1026
    }
1055
    }
1027
1056
1028
    return $object;
1057
    return $object;
Lines 1041-1046 sub _type { Link Here
1041
=head1 AUTHOR
1070
=head1 AUTHOR
1042
1071
1043
Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
1072
Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
1073
Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
1044
1074
1045
=cut
1075
=cut
1046
1076
(-)a/api/v1/swagger/paths/illrequests.json (-1 / +2 lines)
Lines 17-23 Link Here
17
                        "patron",
17
                        "patron",
18
                        "library",
18
                        "library",
19
                        "capabilities",
19
                        "capabilities",
20
                        "metadata"
20
                        "metadata",
21
                        "requested_partners"
21
                    ]
22
                    ]
22
                }
23
                }
23
            }, {
24
            }, {
(-)a/ill/ill-requests.pl (-2 / +2 lines)
Lines 200-209 if ( $backends_available ) { Link Here
200
        }
200
        }
201
        catch {
201
        catch {
202
            my $error;
202
            my $error;
203
            if ( $_->isa( 'Koha::Exceptions::Ill::NoTargetEmail' ) ) {
203
            if ( ref($_) eq 'Koha::Exceptions::Ill::NoTargetEmail' ) {
204
                $error = 'no_target_email';
204
                $error = 'no_target_email';
205
            }
205
            }
206
            elsif ( $_->isa( 'Koha::Exceptions::Ill::NoLibraryEmail' ) ) {
206
            elsif ( ref($_) eq 'Koha::Exceptions::Ill::NoLibraryEmail' ) {
207
                $error = 'no_library_email';
207
                $error = 'no_library_email';
208
            }
208
            }
209
            else {
209
            else {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-3 / +23 lines)
Lines 49-54 Link Here
49
            'biblio_id',
49
            'biblio_id',
50
            'library',
50
            'library',
51
            'status',
51
            'status',
52
            'additional_status',
52
            'updated',
53
            'updated',
53
            'illrequest_id',
54
            'illrequest_id',
54
            'action'
55
            'action'
Lines 158-163 Link Here
158
            }
159
            }
159
        };
160
        };
160
161
162
        // Render function for additional status
163
        var createAdditional = function(data, type, row) {
164
            return (
165
                row.hasOwnProperty('requested_partners') &&
166
                row.requested_partners &&
167
                row.requested_partners.length > 0
168
            ) ?
169
                "Requested from:<br>" +
170
                row.requested_partners.replace('; ','<br>') :
171
                '';
172
        };
173
161
        // Render function for creating a row's action link
174
        // Render function for creating a row's action link
162
        var createActionLink = function(data, type, row) {
175
        var createActionLink = function(data, type, row) {
163
            return '<a class="btn btn-default btn-sm" ' +
176
            return '<a class="btn btn-default btn-sm" ' +
Lines 185-190 Link Here
185
                name: _("Status"),
198
                name: _("Status"),
186
                func: createStatus
199
                func: createStatus
187
            },
200
            },
201
            additional_status: {
202
                name: _("Additional status"),
203
                func: createAdditional
204
            },
188
            biblio_id: {
205
            biblio_id: {
189
                name: _("Bibliograpic Record ID")
206
                name: _("Bibliograpic Record ID")
190
            },
207
            },
Lines 220-226 Link Here
220
        // Get our data from the API and process it prior to passing
237
        // Get our data from the API and process it prior to passing
221
        // it to datatables
238
        // it to datatables
222
        var ajax = $.ajax(
239
        var ajax = $.ajax(
223
            '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
240
            '/api/v1/illrequests?embed=requested_partners,metadata,patron,capabilities,library'
224
            ).done(function() {
241
            ).done(function() {
225
                var data = JSON.parse(ajax.responseText);
242
                var data = JSON.parse(ajax.responseText);
226
                // Make a copy, we'll be removing columns next and need
243
                // Make a copy, we'll be removing columns next and need
Lines 265-271 Link Here
265
                            'bSearchable': false
282
                            'bSearchable': false
266
                        },
283
                        },
267
                    ],
284
                    ],
268
                    'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
285
                    'aaSorting': [[ 7, 'desc' ]], // Default sort, updated descending
269
                    'processing': true, // Display a message when manipulating
286
                    'processing': true, // Display a message when manipulating
270
                    'iDisplayLength': 10, // 10 results per page
287
                    'iDisplayLength': 10, // 10 results per page
271
                    'sPaginationType': "full_numbers", // Pagination display
288
                    'sPaginationType': "full_numbers", // Pagination display
Lines 530-535 Link Here
530
                                <div class="status">
547
                                <div class="status">
531
                                    <span class="label status">Status:</span>
548
                                    <span class="label status">Status:</span>
532
                                    [% request.capabilities.$req_status.name | html %]
549
                                    [% request.capabilities.$req_status.name | html %]
550
                                    [% IF request.requested_partners.length > 0 %]
551
                                        ([% request.requested_partners %])
552
                                    [% END %]
533
                                </div>
553
                                </div>
534
                                <div class="updated">
554
                                <div class="updated">
535
                                    <span class="label updated">Last updated:</span>
555
                                    <span class="label updated">Last updated:</span>
Lines 607-612 Link Here
607
                                    <th>Bibliographic record ID</th>
627
                                    <th>Bibliographic record ID</th>
608
                                    <th>Library</th>
628
                                    <th>Library</th>
609
                                    <th>Status</th>
629
                                    <th>Status</th>
630
                                    <th>Additional status</th>
610
                                    <th>Updated on</th>
631
                                    <th>Updated on</th>
611
                                    <th>Request number</th>
632
                                    <th>Request number</th>
612
                                    <th class="actions"></th>
633
                                    <th class="actions"></th>
613
- 

Return to bug 20563