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

(-)a/Koha/Illrequest.pm (-1 / +26 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 1042-1047 EOF Link Here
1042
        my $result = sendmail(%mail);
1042
        my $result = sendmail(%mail);
1043
        if ( $result ) {
1043
        if ( $result ) {
1044
            $self->status("GENREQ")->store;
1044
            $self->status("GENREQ")->store;
1045
            $self->_backend_capability(
1046
                'set_requested_partners',
1047
                {
1048
                    request => $self,
1049
                    to => $to
1050
                }
1051
            );
1045
            return {
1052
            return {
1046
                error   => 0,
1053
                error   => 0,
1047
                status  => '',
1054
                status  => '',
Lines 1125-1130 sub store { Link Here
1125
    return $ret;
1132
    return $ret;
1126
}
1133
}
1127
1134
1135
=head3 requested_partners
1136
1137
    my $partners_string = $illRequest->requested_partners;
1138
1139
Return the string representing the email addresses of the partners to
1140
whom a request has been sent
1141
1142
=cut
1143
1144
sub requested_partners {
1145
    my ( $self ) = @_;
1146
    return $self->_backend_capability(
1147
        'get_requested_partners',
1148
        { request => $self }
1149
    );
1150
}
1151
1128
=head3 TO_JSON
1152
=head3 TO_JSON
1129
1153
1130
    $json = $illrequest->TO_JSON
1154
    $json = $illrequest->TO_JSON
Lines 1160-1165 sub _type { Link Here
1160
=head1 AUTHOR
1184
=head1 AUTHOR
1161
1185
1162
Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
1186
Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
1187
Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
1163
1188
1164
=cut
1189
=cut
1165
1190
(-)a/Koha/REST/V1/Illrequests.pm (+3 lines)
Lines 160-165 sub list { Link Here
160
        if ($embed{status_alias}) {
160
        if ($embed{status_alias}) {
161
            $to_push->{status_alias} = $req->statusalias;
161
            $to_push->{status_alias} = $req->statusalias;
162
        }
162
        }
163
        if ($embed{requested_partners}) {
164
            $to_push->{requested_partners} = $req->requested_partners;
165
        }
163
        push @output, $to_push;
166
        push @output, $to_push;
164
    }
167
    }
165
168
(-)a/api/v1/swagger/paths/illrequests.json (-1 / +2 lines)
Lines 18-24 Link Here
18
                        "patron",
18
                        "patron",
19
                        "library",
19
                        "library",
20
                        "capabilities",
20
                        "capabilities",
21
                        "metadata"
21
                        "metadata",
22
                        "requested_partners"
22
                    ]
23
                    ]
23
                }
24
                }
24
            }, {
25
            }, {
(-)a/ill/ill-requests.pl (-2 / +2 lines)
Lines 251-260 if ( $backends_available ) { Link Here
251
        }
251
        }
252
        catch {
252
        catch {
253
            my $error;
253
            my $error;
254
            if ( $_->isa( 'Koha::Exceptions::Ill::NoTargetEmail' ) ) {
254
            if ( ref($_) eq 'Koha::Exceptions::Ill::NoTargetEmail' ) {
255
                $error = 'no_target_email';
255
                $error = 'no_target_email';
256
            }
256
            }
257
            elsif ( $_->isa( 'Koha::Exceptions::Ill::NoLibraryEmail' ) ) {
257
            elsif ( ref($_) eq 'Koha::Exceptions::Ill::NoLibraryEmail' ) {
258
                $error = 'no_library_email';
258
                $error = 'no_library_email';
259
            }
259
            }
260
            else {
260
            else {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-6 / +17 lines)
Lines 353-358 Link Here
353
                                        [% request.statusalias.lib | html %]
353
                                        [% request.statusalias.lib | html %]
354
                                    [% ELSE %]
354
                                    [% ELSE %]
355
                                        [% request.capabilities.$req_status.name | html%]
355
                                        [% request.capabilities.$req_status.name | html%]
356
                                        [% IF request.requested_partners.length > 0 %]
357
                                            ([% request.requested_partners | html %])
358
                                        [% END %]
356
                                    [% END %]
359
                                    [% END %]
357
                                </div>
360
                                </div>
358
                                <div class="updated">
361
                                <div class="updated">
Lines 580-586 Link Here
580
                        var uniques = {};
583
                        var uniques = {};
581
                        tableData.forEach(function(row) {
584
                        tableData.forEach(function(row) {
582
                            var resolvedName = getStatusName(
585
                            var resolvedName = getStatusName(
583
                                oData[0].capabilities[row.status].name
586
                                oData[0].capabilities[row.status].name,
587
                                row
584
                            );
588
                            );
585
                            uniques[resolvedName] = 1
589
                            uniques[resolvedName] = 1
586
                        });
590
                        });
Lines 761-781 Link Here
761
                        var status_name = meta.settings.oInit.originalData[0].capabilities[
765
                        var status_name = meta.settings.oInit.originalData[0].capabilities[
762
                            row.status
766
                            row.status
763
                        ].name;
767
                        ].name;
764
                        return getStatusName(status_name);
768
                        return getStatusName(status_name, row);
765
                    } else {
769
                    } else {
766
                        return '';
770
                        return '';
767
                    }
771
                    }
768
                }
772
                }
769
            };
773
            };
770
774
771
            var getStatusName = function(origName) {
775
            var getStatusName = function(origName, row) {
772
                switch( origName ) {
776
                switch( origName ) {
773
                    case "New request":
777
                    case "New request":
774
                        return _("New request");
778
                        return _("New request");
775
                    case "Requested":
779
                    case "Requested":
776
                        return _("Requested");
780
                        return _("Requested");
777
                    case "Requested from partners":
781
                    case "Requested from partners":
778
                        return _("Requested from partners");
782
                        var statStr = _("Requested from partners");
783
                        if (
784
                            row.hasOwnProperty('requested_partners') &&
785
                            row.requested_partners &&
786
                            row.requested_partners.length > 0
787
                        ) {
788
                            statStr += ' (' + row.requested_partners + ')';
789
                        }
790
                        return statStr;
779
                    case "Request reverted":
791
                    case "Request reverted":
780
                        return _("Request reverted");
792
                        return _("Request reverted");
781
                    case "Queued request":
793
                    case "Queued request":
Lines 873-879 Link Here
873
            // Get our data from the API and process it prior to passing
885
            // Get our data from the API and process it prior to passing
874
            // it to datatables
886
            // it to datatables
875
            var ajax = $.ajax(
887
            var ajax = $.ajax(
876
                '/api/v1/illrequests?embed=metadata,patron,capabilities,library,comments,status_alias'
888
                '/api/v1/illrequests?embed=metadata,patron,capabilities,library,comments,status_alias,requested_partners'
877
                ).done(function() {
889
                ).done(function() {
878
                    var data = JSON.parse(ajax.responseText);
890
                    var data = JSON.parse(ajax.responseText);
879
                    // Make a copy, we'll be removing columns next and need
891
                    // Make a copy, we'll be removing columns next and need
880
- 

Return to bug 20563