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

(-)a/Koha/REST/V1/Acquisitions/Vendors.pm (-3 / +3 lines)
Lines 73-79 sub get { Link Here
73
    return try {
73
    return try {
74
        return $c->render(
74
        return $c->render(
75
            status  => 200,
75
            status  => 200,
76
            openapi => $vendor->to_api
76
            openapi => $c->objects->to_api($vendor),
77
        );
77
        );
78
    }
78
    }
79
    catch {
79
    catch {
Lines 97-103 sub add { Link Here
97
        $c->res->headers->location($c->req->url->to_string . '/' . $vendor->id );
97
        $c->res->headers->location($c->req->url->to_string . '/' . $vendor->id );
98
        return $c->render(
98
        return $c->render(
99
            status  => 201,
99
            status  => 201,
100
            openapi => $vendor->to_api
100
            openapi => $c->objects->to_api($vendor),
101
        );
101
        );
102
    }
102
    }
103
    catch {
103
    catch {
Lines 122-128 sub update { Link Here
122
        $vendor->store();
122
        $vendor->store();
123
        return $c->render(
123
        return $c->render(
124
            status  => 200,
124
            status  => 200,
125
            openapi => $vendor->to_api
125
            openapi => $c->objects->to_api($vendor),
126
        );
126
        );
127
    }
127
    }
128
    catch {
128
    catch {
(-)a/Koha/REST/V1/AdvancedEditorMacro.pm (-6 / +6 lines)
Lines 84-90 sub get { Link Here
84
        });
84
        });
85
    }
85
    }
86
86
87
    return $c->render( status => 200, openapi => $macro->to_api );
87
    return $c->render( status => 200, openapi => $c->objects->to_api($macro) );
88
}
88
}
89
89
90
=head3 get_shared
90
=head3 get_shared
Lines 108-114 sub get_shared { Link Here
108
            error => "This macro is not shared, you must access it via advanced_editor/macros"
108
            error => "This macro is not shared, you must access it via advanced_editor/macros"
109
        });
109
        });
110
    }
110
    }
111
    return $c->render( status => 200, openapi => $macro->to_api );
111
    return $c->render( status => 200, openapi => $c->objects->to_api($macro) );
112
}
112
}
113
113
114
=head3 add
114
=head3 add
Lines 133-139 sub add { Link Here
133
        $c->res->headers->location( $c->req->url->to_string . '/' . $macro->id );
133
        $c->res->headers->location( $c->req->url->to_string . '/' . $macro->id );
134
        return $c->render(
134
        return $c->render(
135
            status  => 201,
135
            status  => 201,
136
            openapi => $macro->to_api
136
            openapi => $c->objects->to_api($macro),
137
        );
137
        );
138
    }
138
    }
139
    catch {
139
    catch {
Lines 162-168 sub add_shared { Link Here
162
        $c->res->headers->location( $c->req->url->to_string . '/' . $macro->id );
162
        $c->res->headers->location( $c->req->url->to_string . '/' . $macro->id );
163
        return $c->render(
163
        return $c->render(
164
            status  => 201,
164
            status  => 201,
165
            openapi => $macro->to_api
165
            openapi => $c->objects->to_api($macro),
166
        );
166
        );
167
    }
167
    }
168
    catch {
168
    catch {
Lines 202-208 sub update { Link Here
202
    return try {
202
    return try {
203
        $macro->set_from_api( $body );
203
        $macro->set_from_api( $body );
204
        $macro->store->discard_changes;
204
        $macro->store->discard_changes;
205
        return $c->render( status => 200, openapi => $macro->to_api );
205
        return $c->render( status => 200, openapi => $c->objects->to_api($macro), );
206
    }
206
    }
207
    catch {
207
    catch {
208
        $c->unhandled_exception($_);
208
        $c->unhandled_exception($_);
Lines 235-241 sub update_shared { Link Here
235
    return try {
235
    return try {
236
        $macro->set_from_api( $body );
236
        $macro->set_from_api( $body );
237
        $macro->store->discard_changes;
237
        $macro->store->discard_changes;
238
        return $c->render( status => 200, openapi => $macro->to_api );
238
        return $c->render( status => 200, openapi => $c->objects->to_api($macro), );
239
    }
239
    }
240
    catch {
240
    catch {
241
        $c->unhandled_exception($_);
241
        $c->unhandled_exception($_);
(-)a/Koha/REST/V1/Auth/Identity/Provider/Domains.pm (-2 / +2 lines)
Lines 129-135 sub add { Link Here
129
                $c->res->headers->location( $c->req->url->to_string . '/' . $domain->id );
129
                $c->res->headers->location( $c->req->url->to_string . '/' . $domain->id );
130
                return $c->render(
130
                return $c->render(
131
                    status  => 201,
131
                    status  => 201,
132
                    openapi => $domain->to_api
132
                    openapi => $c->objects->to_api($domain),
133
                );
133
                );
134
            }
134
            }
135
        );
135
        );
Lines 184-190 sub update { Link Here
184
184
185
                return $c->render(
185
                return $c->render(
186
                    status  => 200,
186
                    status  => 200,
187
                    openapi => $domain->to_api
187
                    openapi => $c->objects->to_api($domain),
188
                );
188
                );
189
            }
189
            }
190
        );
190
        );
(-)a/Koha/REST/V1/Auth/Identity/Providers.pm (-2 / +2 lines)
Lines 115-121 sub add { Link Here
115
                $c->res->headers->location( $c->req->url->to_string . '/' . $provider->identity_provider_id );
115
                $c->res->headers->location( $c->req->url->to_string . '/' . $provider->identity_provider_id );
116
                return $c->render(
116
                return $c->render(
117
                    status  => 201,
117
                    status  => 201,
118
                    openapi => $provider->to_api
118
                    openapi => $c->objects->to_api($provider),
119
                );
119
                );
120
            }
120
            }
121
        );
121
        );
Lines 178-184 sub update { Link Here
178
178
179
                return $c->render(
179
                return $c->render(
180
                    status  => 200,
180
                    status  => 200,
181
                    openapi => $provider->to_api
181
                    openapi => $c->objects->to_api($provider),
182
                );
182
                );
183
            }
183
            }
184
        );
184
        );
(-)a/Koha/REST/V1/Authorities.pm (-2 / +2 lines)
Lines 55-61 sub get { Link Here
55
        if ( $c->req->headers->accept =~ m/application\/json/ ) {
55
        if ( $c->req->headers->accept =~ m/application\/json/ ) {
56
            return $c->render(
56
            return $c->render(
57
                status => 200,
57
                status => 200,
58
                json   => $authority->to_api
58
                json   => $c->objects->to_api($authority),
59
            );
59
            );
60
        }
60
        }
61
        else {
61
        else {
Lines 269-275 sub list { Link Here
269
        if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) {
269
        if ( $c->req->headers->accept =~ m/application\/json(;.*)?$/ ) {
270
            return $c->render(
270
            return $c->render(
271
                status => 200,
271
                status => 200,
272
                json   => $authorities->to_api
272
                json   => $c->objects->to_api($authorities),
273
            );
273
            );
274
        }
274
        }
275
        elsif (
275
        elsif (
(-)a/Koha/REST/V1/BackgroundJobs.pm (-1 / +1 lines)
Lines 89-95 sub get { Link Here
89
89
90
        return $c->render(
90
        return $c->render(
91
            status  => 200,
91
            status  => 200,
92
            openapi => $job->to_api
92
            openapi => $c->objects->to_api($job),
93
        );
93
        );
94
    }
94
    }
95
    catch {
95
    catch {
(-)a/Koha/REST/V1/Biblios.pm (-4 / +4 lines)
Lines 70-76 sub get { Link Here
70
        if ( $c->req->headers->accept =~ m/application\/json/ ) {
70
        if ( $c->req->headers->accept =~ m/application\/json/ ) {
71
            return $c->render(
71
            return $c->render(
72
                status => 200,
72
                status => 200,
73
                json   => $biblio->to_api
73
                json   => $c->objects->to_api($biblio),
74
            );
74
            );
75
        }
75
        }
76
        else {
76
        else {
Lines 411-417 sub add_item { Link Here
411
411
412
        $c->render(
412
        $c->render(
413
            status  => 201,
413
            status  => 201,
414
            openapi => $item->to_api
414
            openapi => $c->objects->to_api($item),
415
        );
415
        );
416
    }
416
    }
417
    catch {
417
    catch {
Lines 466-473 sub update_item { Link Here
466
        $item->store->discard_changes;
466
        $item->store->discard_changes;
467
467
468
        $c->render(
468
        $c->render(
469
            status => 200,
469
            status  => 200,
470
            openapi => $item->to_api
470
            openapi => $c->objects->to_api($item),
471
        );
471
        );
472
    }
472
    }
473
    catch {
473
    catch {
(-)a/Koha/REST/V1/Biblios/ItemGroups.pm (-8 / +4 lines)
Lines 46-60 sub list { Link Here
46
    my $biblio = Koha::Biblios->find( $c->param('biblio_id') );
46
    my $biblio = Koha::Biblios->find( $c->param('biblio_id') );
47
47
48
    return try {
48
    return try {
49
#my $item_groups_set = Koha::Biblio::ItemGroups->new;
50
        my $item_groups_set = $biblio->item_groups;
51
        my $item_groups     = $c->objects->search( $item_groups_set );
52
        return $c->render(
49
        return $c->render(
53
            status  => 200,
50
            status  => 200,
54
            openapi => $item_groups
51
            openapi => $c->objects->search( $biblio->item_groups ),
55
        );
52
        );
56
    }
53
    } catch {
57
    catch {
58
        $c->unhandled_exception($_);
54
        $c->unhandled_exception($_);
59
    };
55
    };
60
}
56
}
Lines 122-128 sub add { Link Here
122
118
123
        return $c->render(
119
        return $c->render(
124
            status  => 201,
120
            status  => 201,
125
            openapi => $item_group->to_api
121
            openapi => $c->objects->to_api($item_group),
126
        );
122
        );
127
    }
123
    }
128
    catch {
124
    catch {
Lines 172-178 sub update { Link Here
172
168
173
        return $c->render(
169
        return $c->render(
174
            status  => 200,
170
            status  => 200,
175
            openapi => $item_group->to_api
171
            openapi => $c->objects->to_api($item_group),
176
        );
172
        );
177
    }
173
    }
178
    catch {
174
    catch {
(-)a/Koha/REST/V1/Biblios/ItemGroups/Items.pm (-3 / +1 lines)
Lines 71-81 sub add { Link Here
71
71
72
        $c->res->headers->location( $c->req->url->to_string . '/' . $item_id );
72
        $c->res->headers->location( $c->req->url->to_string . '/' . $item_id );
73
73
74
        my $embed = $c->stash('koha.embed');
75
76
        return $c->render(
74
        return $c->render(
77
            status  => 201,
75
            status  => 201,
78
            openapi => $item_group->to_api({ embed => $embed })
76
            openapi => $c->objects->to_api($item_group),
79
        );
77
        );
80
    }
78
    }
81
    catch {
79
    catch {
(-)a/Koha/REST/V1/CashRegisters/Cashups.pm (-2 / +1 lines)
Lines 78-87 sub get { Link Here
78
            );
78
            );
79
        }
79
        }
80
80
81
        my $embed = $c->stash('koha.embed');
82
        return $c->render(
81
        return $c->render(
83
            status  => 200,
82
            status  => 200,
84
            openapi => $cashup->to_api( { embed => $embed } )
83
            openapi => $c->objects->to_api($cashup),
85
        );
84
        );
86
    }
85
    }
87
    catch {
86
    catch {
(-)a/Koha/REST/V1/Checkouts.pm (-3 / +3 lines)
Lines 93-99 sub get { Link Here
93
    return try {
93
    return try {
94
        return $c->render(
94
        return $c->render(
95
            status  => 200,
95
            status  => 200,
96
            openapi => $checkout->to_api
96
            openapi => $c->objects->to_api($checkout),
97
        );
97
        );
98
    }
98
    }
99
    catch {
99
    catch {
Lines 269-275 sub add { Link Here
269
                $c->req->url->to_string . '/' . $checkout->id );
269
                $c->req->url->to_string . '/' . $checkout->id );
270
            return $c->render(
270
            return $c->render(
271
                status  => 201,
271
                status  => 201,
272
                openapi => $checkout->to_api
272
                openapi => $c->objects->to_api($checkout),
273
            );
273
            );
274
        }
274
        }
275
        else {
275
        else {
Lines 363-369 sub renew { Link Here
363
        $c->res->headers->location( $c->req->url->to_string );
363
        $c->res->headers->location( $c->req->url->to_string );
364
        return $c->render(
364
        return $c->render(
365
            status  => 201,
365
            status  => 201,
366
            openapi => $checkout->to_api
366
            openapi => $c->objects->to_api($checkout),
367
        );
367
        );
368
    }
368
    }
369
    catch {
369
    catch {
(-)a/Koha/REST/V1/Cities.pm (-3 / +3 lines)
Lines 58-64 sub get { Link Here
58
                            openapi => { error => "City not found" } );
58
                            openapi => { error => "City not found" } );
59
        }
59
        }
60
60
61
        return $c->render( status => 200, openapi => $city->to_api );
61
        return $c->render( status => 200, openapi => $c->objects->to_api($city), );
62
    }
62
    }
63
    catch {
63
    catch {
64
        $c->unhandled_exception($_);
64
        $c->unhandled_exception($_);
Lines 78-84 sub add { Link Here
78
        $c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid );
78
        $c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid );
79
        return $c->render(
79
        return $c->render(
80
            status  => 201,
80
            status  => 201,
81
            openapi => $city->to_api
81
            openapi => $c->objects->to_api($city),
82
        );
82
        );
83
    }
83
    }
84
    catch {
84
    catch {
Lines 103-109 sub update { Link Here
103
    return try {
103
    return try {
104
        $city->set_from_api( $c->req->json );
104
        $city->set_from_api( $c->req->json );
105
        $city->store();
105
        $city->store();
106
        return $c->render( status => 200, openapi => $city->to_api );
106
        return $c->render( status => 200, openapi => $c->objects->to_api($city), );
107
    }
107
    }
108
    catch {
108
    catch {
109
        $c->unhandled_exception($_);
109
        $c->unhandled_exception($_);
(-)a/Koha/REST/V1/Clubs/Holds.pm (-1 / +1 lines)
Lines 117-123 sub add { Link Here
117
117
118
        return $c->render(
118
        return $c->render(
119
            status  => 201,
119
            status  => 201,
120
            openapi => $club_hold->to_api
120
            openapi => $c->objects->to_api($club_hold),
121
        );
121
        );
122
    }
122
    }
123
    catch {
123
    catch {
(-)a/Koha/REST/V1/Config/SMTP/Servers.pm (-5 / +3 lines)
Lines 70-80 sub get { Link Here
70
            );
70
            );
71
        }
71
        }
72
72
73
        my $embed = $c->stash('koha.embed');
74
75
        return $c->render(
73
        return $c->render(
76
            status  => 200,
74
            status  => 200,
77
            openapi => $smtp_server->to_api({ embed => $embed })
75
            openapi => $c->objects->to_api($smtp_server),
78
        );
76
        );
79
    }
77
    }
80
    catch {
78
    catch {
Lines 100-106 sub add { Link Here
100
98
101
        return $c->render(
99
        return $c->render(
102
            status  => 201,
100
            status  => 201,
103
            openapi => $smtp_server->to_api
101
            openapi => $c->objects->to_api($smtp_server),
104
        );
102
        );
105
    }
103
    }
106
    catch {
104
    catch {
Lines 144-150 sub update { Link Here
144
142
145
        return $c->render(
143
        return $c->render(
146
            status  => 200,
144
            status  => 200,
147
            openapi => $smtp_server->to_api
145
            openapi => $c->objects->to_api($smtp_server),
148
        );
146
        );
149
    }
147
    }
150
    catch {
148
    catch {
(-)a/Koha/REST/V1/ERM/Agreements.pm (-2 / +2 lines)
Lines 112-118 sub add { Link Here
112
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
112
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
113
                return $c->render(
113
                return $c->render(
114
                    status  => 201,
114
                    status  => 201,
115
                    openapi => $agreement->to_api
115
                    openapi => $c->objects->to_api($agreement),
116
                );
116
                );
117
            }
117
            }
118
        );
118
        );
Lines 200-206 sub update { Link Here
200
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
200
                $c->res->headers->location($c->req->url->to_string . '/' . $agreement->agreement_id);
201
                return $c->render(
201
                return $c->render(
202
                    status  => 200,
202
                    status  => 200,
203
                    openapi => $agreement->to_api
203
                    openapi => $c->objects->to_api($agreement),
204
                );
204
                );
205
            }
205
            }
206
        );
206
        );
(-)a/Koha/REST/V1/ERM/EHoldings/Packages/Local.pm (-2 / +2 lines)
Lines 100-106 sub add { Link Here
100
                $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
100
                $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
101
                return $c->render(
101
                return $c->render(
102
                    status  => 201,
102
                    status  => 201,
103
                    openapi => $package->to_api
103
                    openapi => $c->objects->to_api($package),
104
                );
104
                );
105
            }
105
            }
106
        );
106
        );
Lines 179-185 sub update { Link Here
179
                $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
179
                $c->res->headers->location($c->req->url->to_string . '/' . $package->package_id);
180
                return $c->render(
180
                return $c->render(
181
                    status  => 200,
181
                    status  => 200,
182
                    openapi => $package->to_api
182
                    openapi => $c->objects->to_api($package),
183
                );
183
                );
184
            }
184
            }
185
        );
185
        );
(-)a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm (-2 / +2 lines)
Lines 100-106 sub add { Link Here
100
                $c->res->headers->location($c->req->url->to_string . '/' . $title->title_id);
100
                $c->res->headers->location($c->req->url->to_string . '/' . $title->title_id);
101
                return $c->render(
101
                return $c->render(
102
                    status  => 201,
102
                    status  => 201,
103
                    openapi => $title->to_api
103
                    openapi => $c->objects->to_api($title),
104
                );
104
                );
105
            }
105
            }
106
        );
106
        );
Lines 175-181 sub update { Link Here
175
                $c->res->headers->location($c->req->url->to_string . '/' . $title->title_id);
175
                $c->res->headers->location($c->req->url->to_string . '/' . $title->title_id);
176
                return $c->render(
176
                return $c->render(
177
                    status  => 200,
177
                    status  => 200,
178
                    openapi => $title->to_api
178
                    openapi => $c->objects->to_api($title),
179
                );
179
                );
180
            }
180
            }
181
        );
181
        );
(-)a/Koha/REST/V1/ERM/EUsage/DefaultUsageReports.pm (-1 / +1 lines)
Lines 69-75 sub add { Link Here
69
                    $c->req->url->to_string . '/' . $default_report->erm_default_usage_report_id );
69
                    $c->req->url->to_string . '/' . $default_report->erm_default_usage_report_id );
70
                return $c->render(
70
                return $c->render(
71
                    status  => 201,
71
                    status  => 201,
72
                    openapi => $default_report->to_api
72
                    openapi => $c->objects->to_api($default_report),
73
                );
73
                );
74
            }
74
            }
75
        );
75
        );
(-)a/Koha/REST/V1/ERM/EUsage/UsageDataProviders.pm (-2 / +2 lines)
Lines 161-167 sub add { Link Here
161
                    $c->req->url->to_string . '/' . $usage_data_provider->erm_usage_data_provider_id );
161
                    $c->req->url->to_string . '/' . $usage_data_provider->erm_usage_data_provider_id );
162
                return $c->render(
162
                return $c->render(
163
                    status  => 201,
163
                    status  => 201,
164
                    openapi => $usage_data_provider->to_api
164
                    openapi => $c->objects->to_api($usage_data_provider),
165
                );
165
                );
166
            }
166
            }
167
        );
167
        );
Lines 227-233 sub update { Link Here
227
                    $c->req->url->to_string . '/' . $usage_data_provider->erm_usage_data_provider_id );
227
                    $c->req->url->to_string . '/' . $usage_data_provider->erm_usage_data_provider_id );
228
                return $c->render(
228
                return $c->render(
229
                    status  => 200,
229
                    status  => 200,
230
                    openapi => $usage_data_provider->to_api
230
                    openapi => $c->objects->to_api($usage_data_provider),
231
                );
231
                );
232
            }
232
            }
233
        );
233
        );
(-)a/Koha/REST/V1/ERM/Licenses.pm (-2 / +2 lines)
Lines 99-105 sub add { Link Here
99
                $c->res->headers->location($c->req->url->to_string . '/' . $license->license_id);
99
                $c->res->headers->location($c->req->url->to_string . '/' . $license->license_id);
100
                return $c->render(
100
                return $c->render(
101
                    status  => 201,
101
                    status  => 201,
102
                    openapi => $license->to_api
102
                    openapi => $c->objects->to_api($license),
103
                );
103
                );
104
            }
104
            }
105
        );
105
        );
Lines 181-187 sub update { Link Here
181
                $c->res->headers->location($c->req->url->to_string . '/' . $license->license_id);
181
                $c->res->headers->location($c->req->url->to_string . '/' . $license->license_id);
182
                return $c->render(
182
                return $c->render(
183
                    status  => 200,
183
                    status  => 200,
184
                    openapi => $license->to_api
184
                    openapi => $c->objects->to_api($license),
185
                );
185
                );
186
            }
186
            }
187
        );
187
        );
(-)a/Koha/REST/V1/Holds.pm (-2 / +2 lines)
Lines 213-219 sub add { Link Here
213
213
214
        return $c->render(
214
        return $c->render(
215
            status  => 201,
215
            status  => 201,
216
            openapi => $hold->to_api
216
            openapi => $c->objects->to_api($hold),
217
        );
217
        );
218
    }
218
    }
219
    catch {
219
    catch {
Lines 291-297 sub edit { Link Here
291
291
292
        return $c->render(
292
        return $c->render(
293
            status  => 200,
293
            status  => 200,
294
            openapi => $hold->to_api
294
            openapi => $c->objects->to_api($hold),
295
        );
295
        );
296
    }
296
    }
297
    catch {
297
    catch {
(-)a/Koha/REST/V1/Illrequests.pm (-1 / +1 lines)
Lines 98-104 sub add { Link Here
98
                $c->res->headers->location($c->req->url->to_string . '/' . $new_req->illrequest_id);
98
                $c->res->headers->location($c->req->url->to_string . '/' . $new_req->illrequest_id);
99
                return $c->render(
99
                return $c->render(
100
                    status  => 201,
100
                    status  => 201,
101
                    openapi => $new_req->to_api
101
                    openapi => $c->objects->to_api($new_req),
102
                );
102
                );
103
            }
103
            }
104
        );
104
        );
(-)a/Koha/REST/V1/ImportBatchProfiles.pm (-2 / +2 lines)
Lines 70-76 sub add { Link Here
70
        my $profile = Koha::ImportBatchProfile->new_from_api( $body )->store;
70
        my $profile = Koha::ImportBatchProfile->new_from_api( $body )->store;
71
        return $c->render(
71
        return $c->render(
72
            status  => 201,
72
            status  => 201,
73
            openapi => $profile->to_api
73
            openapi => $c->objects->to_api($profile),
74
        );
74
        );
75
    }
75
    }
76
    catch {
76
    catch {
Lines 100-106 sub edit { Link Here
100
100
101
        return $c->render(
101
        return $c->render(
102
            status  => 200,
102
            status  => 200,
103
            openapi => $profile->to_api
103
            openapi => $c->objects->to_api($profile),
104
        );
104
        );
105
    }
105
    }
106
    catch {
106
    catch {
(-)a/Koha/REST/V1/Libraries.pm (-2 / +2 lines)
Lines 96-102 sub add { Link Here
96
96
97
        return $c->render(
97
        return $c->render(
98
            status  => 201,
98
            status  => 201,
99
            openapi => $library->to_api
99
            openapi => $c->objects->to_api($library),
100
        );
100
        );
101
    }
101
    }
102
    catch {
102
    catch {
Lines 135-141 sub update { Link Here
135
        $library->store();
135
        $library->store();
136
        return $c->render(
136
        return $c->render(
137
            status  => 200,
137
            status  => 200,
138
            openapi => $library->to_api
138
            openapi => $c->objects->to_api($library),
139
        );
139
        );
140
    }
140
    }
141
    catch {
141
    catch {
(-)a/Koha/REST/V1/Patrons/Account.pm (-4 / +4 lines)
Lines 62-72 sub get { Link Here
62
                balance            => $account->balance,
62
                balance            => $account->balance,
63
                outstanding_debits => {
63
                outstanding_debits => {
64
                    total => $debits->total_outstanding,
64
                    total => $debits->total_outstanding,
65
                    lines => $debits->to_api
65
                    lines => $c->objects->to_api($debits),
66
                },
66
                },
67
                outstanding_credits => {
67
                outstanding_credits => {
68
                    total => $credits->total_outstanding,
68
                    total => $credits->total_outstanding,
69
                    lines => $credits->to_api
69
                    lines => $c->objects->to_api($credits),
70
                }
70
                }
71
            }
71
            }
72
        );
72
        );
Lines 182-188 sub add_credit { Link Here
182
182
183
        return $c->render(
183
        return $c->render(
184
            status  => 201,
184
            status  => 201,
185
            openapi => $credit->to_api
185
            openapi => $c->objects->to_api($credit),
186
        );
186
        );
187
    }
187
    }
188
    catch {
188
    catch {
Lines 255-261 sub add_debit { Link Here
255
255
256
        return $c->render(
256
        return $c->render(
257
            status  => 201,
257
            status  => 201,
258
            openapi => $debit->to_api
258
            openapi => $c->objects->to_api($debit),
259
        );
259
        );
260
    }
260
    }
261
    catch {
261
    catch {
(-)a/Koha/REST/V1/Patrons/Attributes.pm (-3 / +3 lines)
Lines 99-105 sub add { Link Here
99
        $c->res->headers->location( $c->req->url->to_string . '/' . $attribute->id );
99
        $c->res->headers->location( $c->req->url->to_string . '/' . $attribute->id );
100
        return $c->render(
100
        return $c->render(
101
            status  => 201,
101
            status  => 201,
102
            openapi => $attribute->to_api
102
            openapi => $c->objects->to_api($attribute),
103
        );
103
        );
104
    }
104
    }
105
    catch {
105
    catch {
Lines 175-181 sub overwrite { Link Here
175
175
176
        return $c->render(
176
        return $c->render(
177
            status  => 200,
177
            status  => 200,
178
            openapi => $attributes->to_api
178
            openapi => $c->objects->to_api($attributes),
179
        );
179
        );
180
    }
180
    }
181
    catch {
181
    catch {
Lines 256-262 sub update { Link Here
256
256
257
        return $c->render(
257
        return $c->render(
258
            status  => 200,
258
            status  => 200,
259
            openapi => $attribute->to_api
259
            openapi => $c->objects->to_api($attribute),
260
        );
260
        );
261
    }
261
    }
262
    catch {
262
    catch {
(-)a/Koha/REST/V1/Preservation/Processings.pm (-2 / +2 lines)
Lines 96-102 sub add { Link Here
96
                $c->res->headers->location( $c->req->url->to_string . '/' . $processing->processing_id );
96
                $c->res->headers->location( $c->req->url->to_string . '/' . $processing->processing_id );
97
                return $c->render(
97
                return $c->render(
98
                    status  => 201,
98
                    status  => 201,
99
                    openapi => $processing->to_api
99
                    openapi => $c->objects->to_api($processing),
100
                );
100
                );
101
            }
101
            }
102
        );
102
        );
Lines 165-171 sub update { Link Here
165
                $c->res->headers->location( $c->req->url->to_string . '/' . $processing->processing_id );
165
                $c->res->headers->location( $c->req->url->to_string . '/' . $processing->processing_id );
166
                return $c->render(
166
                return $c->render(
167
                    status  => 200,
167
                    status  => 200,
168
                    openapi => $processing->to_api
168
                    openapi => $c->objects->to_api($processing),
169
                );
169
                );
170
            }
170
            }
171
        );
171
        );
(-)a/Koha/REST/V1/Preservation/Trains.pm (-2 / +2 lines)
Lines 96-102 sub add { Link Here
96
                $c->res->headers->location( $c->req->url->to_string . '/' . $train->train_id );
96
                $c->res->headers->location( $c->req->url->to_string . '/' . $train->train_id );
97
                return $c->render(
97
                return $c->render(
98
                    status  => 201,
98
                    status  => 201,
99
                    openapi => $train->to_api
99
                    openapi => $c->objects->to_api($train),
100
                );
100
                );
101
            }
101
            }
102
        );
102
        );
Lines 162-168 sub update { Link Here
162
                $c->res->headers->location( $c->req->url->to_string . '/' . $train->train_id );
162
                $c->res->headers->location( $c->req->url->to_string . '/' . $train->train_id );
163
                return $c->render(
163
                return $c->render(
164
                    status  => 200,
164
                    status  => 200,
165
                    openapi => $train->to_api
165
                    openapi => $c->objects->to_api($train),
166
                );
166
                );
167
            }
167
            }
168
        );
168
        );
(-)a/Koha/REST/V1/Quotes.pm (-3 / +3 lines)
Lines 60-66 sub get { Link Here
60
            );
60
            );
61
        }
61
        }
62
62
63
        return $c->render( status => 200, openapi => $quote->to_api );
63
        return $c->render( status => 200, openapi => $c->objects->to_api($quote), );
64
    }
64
    }
65
    catch {
65
    catch {
66
        $c->unhandled_exception($_);
66
        $c->unhandled_exception($_);
Lines 80-86 sub add { Link Here
80
        $c->res->headers->location( $c->req->url->to_string . '/' . $quote->id );
80
        $c->res->headers->location( $c->req->url->to_string . '/' . $quote->id );
81
        return $c->render(
81
        return $c->render(
82
            status  => 201,
82
            status  => 201,
83
            openapi => $quote->to_api
83
            openapi => $c->objects->to_api($quote),
84
        );
84
        );
85
    }
85
    }
86
    catch {
86
    catch {
Lines 105-111 sub update { Link Here
105
    return try {
105
    return try {
106
        $quote->set_from_api( $c->req->json );
106
        $quote->set_from_api( $c->req->json );
107
        $quote->store();
107
        $quote->store();
108
        return $c->render( status => 200, openapi => $quote->to_api );
108
        return $c->render( status => 200, openapi => $c->objects->to_api($quote), );
109
    }
109
    }
110
    catch {
110
    catch {
111
        $c->unhandled_exception($_);
111
        $c->unhandled_exception($_);
(-)a/Koha/REST/V1/ReturnClaims.pm (-3 / +3 lines)
Lines 69-75 sub claim_returned { Link Here
69
        $c->res->headers->location($c->req->url->to_string . '/' . $claim->id );
69
        $c->res->headers->location($c->req->url->to_string . '/' . $claim->id );
70
        return $c->render(
70
        return $c->render(
71
            status  => 201,
71
            status  => 201,
72
            openapi => $claim->to_api
72
            openapi => $c->objects->to_api($claim),
73
        );
73
        );
74
    }
74
    }
75
    catch {
75
    catch {
Lines 128-134 sub update_notes { Link Here
128
128
129
        return $c->render(
129
        return $c->render(
130
            status  => 200,
130
            status  => 200,
131
            openapi => $claim->to_api
131
            openapi => $c->objects->to_api($claim),
132
        );
132
        );
133
    }
133
    }
134
    catch {
134
    catch {
Lines 174-180 sub resolve_claim { Link Here
174
174
175
        return $c->render(
175
        return $c->render(
176
            status  => 200,
176
            status  => 200,
177
            openapi => $claim->to_api
177
            openapi => $c->objects->to_api($claim),
178
        );
178
        );
179
    }
179
    }
180
    catch {
180
    catch {
(-)a/Koha/REST/V1/SearchFilter.pm (-3 / +3 lines)
Lines 64-70 sub get { Link Here
64
                           openapi => { error => "Search filter not found" } );
64
                           openapi => { error => "Search filter not found" } );
65
    }
65
    }
66
66
67
    return $c->render( status => 200, openapi => $filter->to_api );
67
    return $c->render( status => 200, openapi => $c->objects->to_api($filter), );
68
}
68
}
69
69
70
=head3 add
70
=head3 add
Lines 82-88 sub add { Link Here
82
        $c->res->headers->location( $c->req->url->to_string . '/' . $filter->id );
82
        $c->res->headers->location( $c->req->url->to_string . '/' . $filter->id );
83
        return $c->render(
83
        return $c->render(
84
            status  => 201,
84
            status  => 201,
85
            openapi => $filter->to_api
85
            openapi => $c->objects->to_api($filter),
86
        );
86
        );
87
    }
87
    }
88
    catch {
88
    catch {
Lines 115-121 sub update { Link Here
115
    return try {
115
    return try {
116
        $filter->set_from_api( $c->req->json );
116
        $filter->set_from_api( $c->req->json );
117
        $filter->store->discard_changes;
117
        $filter->store->discard_changes;
118
        return $c->render( status => 200, openapi => $filter->to_api );
118
        return $c->render( status => 200, openapi => $c->objects->to_api($filter), );
119
    }
119
    }
120
    catch {
120
    catch {
121
        $c->unhandled_exception($_);
121
        $c->unhandled_exception($_);
(-)a/Koha/REST/V1/Suggestions.pm (-2 / +2 lines)
Lines 149-155 sub add { Link Here
149
149
150
        return $c->render(
150
        return $c->render(
151
            status  => 201,
151
            status  => 201,
152
            openapi => $suggestion->to_api
152
            openapi => $c->objects->to_api($suggestion),
153
        );
153
        );
154
    }
154
    }
155
    catch {
155
    catch {
Lines 182-188 sub update { Link Here
182
182
183
        return $c->render(
183
        return $c->render(
184
            status  => 200,
184
            status  => 200,
185
            openapi => $suggestion->to_api
185
            openapi => $c->objects->to_api($suggestion),
186
        );
186
        );
187
    }
187
    }
188
    catch {
188
    catch {
(-)a/Koha/REST/V1/Tickets.pm (-4 / +4 lines)
Lines 63-69 sub get { Link Here
63
            );
63
            );
64
        }
64
        }
65
65
66
        return $c->render( status => 200, openapi => $ticket->to_api );
66
        return $c->render( status => 200, openapi => $c->objects->to_api($ticket), );
67
    }
67
    }
68
    catch {
68
    catch {
69
        $c->unhandled_exception($_);
69
        $c->unhandled_exception($_);
Lines 92-98 sub add { Link Here
92
            $c->req->url->to_string . '/' . $ticket->id );
92
            $c->req->url->to_string . '/' . $ticket->id );
93
        return $c->render(
93
        return $c->render(
94
            status  => 201,
94
            status  => 201,
95
            openapi => $ticket->to_api
95
            openapi => $c->objects->to_api($ticket),
96
        );
96
        );
97
    }
97
    }
98
    catch {
98
    catch {
Lines 119-125 sub update { Link Here
119
    return try {
119
    return try {
120
        $ticket->set_from_api( $c->req->json );
120
        $ticket->set_from_api( $c->req->json );
121
        $ticket->store();
121
        $ticket->store();
122
        return $c->render( status => 200, openapi => $ticket->to_api );
122
        return $c->render( status => 200, openapi => $c->objects->to_api($ticket), );
123
    }
123
    }
124
    catch {
124
    catch {
125
        $c->unhandled_exception($_);
125
        $c->unhandled_exception($_);
Lines 249-255 sub add_update { Link Here
249
            $c->req->url->to_string . '/' . $update->id );
249
            $c->req->url->to_string . '/' . $update->id );
250
        return $c->render(
250
        return $c->render(
251
            status  => 201,
251
            status  => 201,
252
            openapi => $update->to_api
252
            openapi => $c->objects->to_api($update),
253
        );
253
        );
254
    }
254
    }
255
    catch {
255
    catch {
(-)a/Koha/REST/V1/TransferLimits.pm (-3 / +2 lines)
Lines 76-82 sub add { Link Here
76
76
77
        return $c->render(
77
        return $c->render(
78
            status  => 201,
78
            status  => 201,
79
            openapi => $transfer_limit->to_api
79
            openapi => $c->objects->to_api($transfer_limit),
80
        );
80
        );
81
    }
81
    }
82
    catch {
82
    catch {
Lines 187-193 sub batch_add { Link Here
187
187
188
                my $transfer_limit = Koha::Item::Transfer::Limit->new_from_api($limit_params);
188
                my $transfer_limit = Koha::Item::Transfer::Limit->new_from_api($limit_params);
189
                $transfer_limit->store;
189
                $transfer_limit->store;
190
                push( @results, $transfer_limit->to_api() );
190
                push( @results, $c->objects->to_api($transfer_limit) );
191
            }
191
            }
192
        }
192
        }
193
193
194
- 

Return to bug 36483