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 / +24 lines)
Lines 48-53 Link Here
48
            'biblio_id',
48
            'biblio_id',
49
            'library',
49
            'library',
50
            'status',
50
            'status',
51
            'additional_status',
51
            'updated',
52
            'updated',
52
            'illrequest_id',
53
            'illrequest_id',
53
            'action'
54
            'action'
Lines 157-162 Link Here
157
            }
158
            }
158
        };
159
        };
159
160
161
        // Render function for additional status
162
        var createAdditional = function(data, type, row) {
163
            return (
164
                row.hasOwnProperty('requested_partners') &&
165
                row.requested_partners &&
166
                row.requested_partners.length > 0
167
            ) ?
168
                "Requested from:<br>" +
169
                row.requested_partners.replace('; ','<br>') :
170
                '';
171
        };
172
160
        // Render function for creating a row's action link
173
        // Render function for creating a row's action link
161
        var createActionLink = function(data, type, row) {
174
        var createActionLink = function(data, type, row) {
162
            return '<a class="btn btn-default btn-sm" ' +
175
            return '<a class="btn btn-default btn-sm" ' +
Lines 184-189 Link Here
184
                name: _("Status"),
197
                name: _("Status"),
185
                func: createStatus
198
                func: createStatus
186
            },
199
            },
200
            additional_status: {
201
                name: _("Additional status"),
202
                func: createAdditional
203
            },
187
            biblio_id: {
204
            biblio_id: {
188
                name: _("Biblio ID")
205
                name: _("Biblio ID")
189
            },
206
            },
Lines 219-225 Link Here
219
        // Get our data from the API and process it prior to passing
236
        // Get our data from the API and process it prior to passing
220
        // it to datatables
237
        // it to datatables
221
        var ajax = $.ajax(
238
        var ajax = $.ajax(
222
            '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
239
            '/api/v1/illrequests?embed=requested_partners,metadata,patron,capabilities,library'
223
            ).done(function() {
240
            ).done(function() {
224
                var data = JSON.parse(ajax.responseText);
241
                var data = JSON.parse(ajax.responseText);
225
                // Make a copy, we'll be removing columns next and need
242
                // Make a copy, we'll be removing columns next and need
Lines 264-270 Link Here
264
                            'bSearchable': false
281
                            'bSearchable': false
265
                        },
282
                        },
266
                    ],
283
                    ],
267
                    'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
284
                    'aaSorting': [[ 7, 'desc' ]], // Default sort, updated descending
268
                    'processing': true, // Display a message when manipulating
285
                    'processing': true, // Display a message when manipulating
269
                    'iDisplayLength': 10, // 10 results per page
286
                    'iDisplayLength': 10, // 10 results per page
270
                    'sPaginationType': "full_numbers", // Pagination display
287
                    'sPaginationType': "full_numbers", // Pagination display
Lines 527-532 Link Here
527
                                <div class="status">
544
                                <div class="status">
528
                                    <span class="label status">Status:</span>
545
                                    <span class="label status">Status:</span>
529
                                    [% capabilities.$req_status.name %]
546
                                    [% capabilities.$req_status.name %]
547
                                    [% IF request.requested_partners.length > 0 %]
548
                                        ([% request.requested_partners %])
549
                                    [% END %]
550
530
                                </div>
551
                                </div>
531
                                <div class="updated">
552
                                <div class="updated">
532
                                    <span class="label updated">Last updated:</span>
553
                                    <span class="label updated">Last updated:</span>
Lines 592-597 Link Here
592
                                    <th>Biblio ID</th>
613
                                    <th>Biblio ID</th>
593
                                    <th>Library</th>
614
                                    <th>Library</th>
594
                                    <th>Status</th>
615
                                    <th>Status</th>
616
                                    <th>Additional status</th>
595
                                    <th>Updated on</th>
617
                                    <th>Updated on</th>
596
                                    <th>Request number</th>
618
                                    <th>Request number</th>
597
                                    <th class="actions"></th>
619
                                    <th class="actions"></th>
598
- 

Return to bug 20563