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

(-)a/Koha/REST/V1/Acquisitions/Vendors.pm (-5 / +5 lines)
Lines 171-177 sub delete { Link Here
171
    my $c = shift->openapi->valid_input or return;
171
    my $c = shift->openapi->valid_input or return;
172
172
173
    return try {
173
    return try {
174
        my $vendor             = Koha::Acquisition::Booksellers->find( $c->param('vendor_id') );
174
        my $vendor = Koha::Acquisition::Booksellers->find( $c->param('vendor_id') );
175
176
        return $c->render_resource_not_found("Vendor")
177
            unless $vendor;
178
175
        my $basket_count       = $vendor->baskets->count;
179
        my $basket_count       = $vendor->baskets->count;
176
        my $subscription_count = $vendor->subscriptions->count;
180
        my $subscription_count = $vendor->subscriptions->count;
177
        my $invoice_count      = $vendor->invoices->count;
181
        my $invoice_count      = $vendor->invoices->count;
Lines 182-190 sub delete { Link Here
182
            openapi => { error => "Vendor cannot be deleted with existing baskets, subscriptions or invoices" }
186
            openapi => { error => "Vendor cannot be deleted with existing baskets, subscriptions or invoices" }
183
        ) unless $safe_to_delete;
187
        ) unless $safe_to_delete;
184
188
185
        return $c->render_resource_not_found("Vendor")
186
            unless $vendor;
187
188
        $vendor->delete;
189
        $vendor->delete;
189
        return $c->render_resource_deleted;
190
        return $c->render_resource_deleted;
190
    } catch {
191
    } catch {
191
- 

Return to bug 38010