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 1159-1164 sub _type { Link Here
1159
=head1 AUTHOR
1183
=head1 AUTHOR
1160
1184
1161
Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
1185
Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
1186
Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
1162
1187
1163
=cut
1188
=cut
1164
1189
(-)a/Koha/REST/V1/Illrequests.pm (+3 lines)
Lines 162-167 sub list { Link Here
162
        if ($embed{status_alias}) {
162
        if ($embed{status_alias}) {
163
            $to_push->{status_alias} = $req->statusalias;
163
            $to_push->{status_alias} = $req->statusalias;
164
        }
164
        }
165
        if ($embed{requested_partners}) {
166
            $to_push->{requested_partners} = $req->requested_partners;
167
        }
165
        push @output, $to_push;
168
        push @output, $to_push;
166
    }
169
    }
167
170
(-)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 252-261 if ( $backends_available ) { Link Here
252
        }
252
        }
253
        catch {
253
        catch {
254
            my $error;
254
            my $error;
255
            if ( $_->isa( 'Koha::Exceptions::Ill::NoTargetEmail' ) ) {
255
            if ( ref($_) eq 'Koha::Exceptions::Ill::NoTargetEmail' ) {}
256
                $error = 'no_target_email';
256
                $error = 'no_target_email';
257
            }
257
            }
258
            elsif ( $_->isa( 'Koha::Exceptions::Ill::NoLibraryEmail' ) ) {
258
            elsif ( ref($_) eq 'Koha::Exceptions::Ill::NoLibraryEmail' ) {}
259
                $error = 'no_library_email';
259
                $error = 'no_library_email';
260
            }
260
            }
261
            else {
261
            else {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-6 / +17 lines)
Lines 355-360 Link Here
355
                                            [% request.statusalias.lib | html %]
355
                                            [% request.statusalias.lib | html %]
356
                                        [% ELSE %]
356
                                        [% ELSE %]
357
                                            [% request.capabilities.$req_status.name | html%]
357
                                            [% request.capabilities.$req_status.name | html%]
358
                                            [% IF request.requested_partners.length > 0 %]
359
                                                ([% request.requested_partners | html %])
360
                                            [% END %]
358
                                        [% END %]
361
                                        [% END %]
359
                                    </li>
362
                                    </li>
360
                                    <li class="updated">
363
                                    <li class="updated">
Lines 585-591 Link Here
585
                        var uniques = {};
588
                        var uniques = {};
586
                        tableData.forEach(function(row) {
589
                        tableData.forEach(function(row) {
587
                            var resolvedName = getStatusName(
590
                            var resolvedName = getStatusName(
588
                                oData[0].capabilities[row.status].name
591
                                oData[0].capabilities[row.status].name,
592
                                row
589
                            );
593
                            );
590
                            uniques[resolvedName] = 1
594
                            uniques[resolvedName] = 1
591
                        });
595
                        });
Lines 766-786 Link Here
766
                        var status_name = meta.settings.oInit.originalData[0].capabilities[
770
                        var status_name = meta.settings.oInit.originalData[0].capabilities[
767
                            row.status
771
                            row.status
768
                        ].name;
772
                        ].name;
769
                        return getStatusName(status_name);
773
                        return getStatusName(status_name, row);
770
                    } else {
774
                    } else {
771
                        return '';
775
                        return '';
772
                    }
776
                    }
773
                }
777
                }
774
            };
778
            };
775
779
776
            var getStatusName = function(origName) {
780
            var getStatusName = function(origName, row) {
777
                switch( origName ) {
781
                switch( origName ) {
778
                    case "New request":
782
                    case "New request":
779
                        return _("New request");
783
                        return _("New request");
780
                    case "Requested":
784
                    case "Requested":
781
                        return _("Requested");
785
                        return _("Requested");
782
                    case "Requested from partners":
786
                    case "Requested from partners":
783
                        return _("Requested from partners");
787
                        var statStr = _("Requested from partners");
788
                        if (
789
                            row.hasOwnProperty('requested_partners') &&
790
                            row.requested_partners &&
791
                            row.requested_partners.length > 0
792
                        ) {
793
                            statStr += ' (' + row.requested_partners + ')';
794
                        }
795
                        return statStr;
784
                    case "Request reverted":
796
                    case "Request reverted":
785
                        return _("Request reverted");
797
                        return _("Request reverted");
786
                    case "Queued request":
798
                    case "Queued request":
Lines 878-884 Link Here
878
            // Get our data from the API and process it prior to passing
890
            // Get our data from the API and process it prior to passing
879
            // it to datatables
891
            // it to datatables
880
            var ajax = $.ajax(
892
            var ajax = $.ajax(
881
                '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
893
                '/api/v1/illrequests?embed=metadata,patron,capabilities,library,comments,status_alias,requested_partners'
882
                ).done(function() {
894
                ).done(function() {
883
                    var data = JSON.parse(ajax.responseText);
895
                    var data = JSON.parse(ajax.responseText);
884
                    // Make a copy, we'll be removing columns next and need
896
                    // Make a copy, we'll be removing columns next and need
885
- 

Return to bug 20563