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

Return to bug 20563