Lines 48-60
sub list_vendors {
Link Here
|
48 |
if $args->{$filter_param}; |
48 |
if $args->{$filter_param}; |
49 |
} |
49 |
} |
50 |
|
50 |
|
51 |
my @vendors; |
|
|
52 |
|
53 |
return try { |
51 |
return try { |
54 |
@vendors = Koha::Acquisition::Booksellers->search($filter); |
52 |
my $vendors = Koha::Acquisition::Booksellers->search($filter); |
55 |
@vendors = map { _to_api($_->TO_JSON) } @vendors; |
53 |
return $c->render( |
56 |
return $c->render( status => 200, |
54 |
status => 200, |
57 |
openapi => \@vendors ); |
55 |
openapi => $vendors->to_api |
|
|
56 |
); |
58 |
} |
57 |
} |
59 |
catch { |
58 |
catch { |
60 |
if ( $_->isa('DBIx::Class::Exception') ) { |
59 |
if ( $_->isa('DBIx::Class::Exception') ) { |
Lines 83-90
sub get_vendor {
Link Here
|
83 |
openapi => { error => "Vendor not found" } ); |
82 |
openapi => { error => "Vendor not found" } ); |
84 |
} |
83 |
} |
85 |
|
84 |
|
86 |
return $c->render( status => 200, |
85 |
return $c->render( |
87 |
openapi => _to_api($vendor->TO_JSON) ); |
86 |
status => 200, |
|
|
87 |
openapi => $vendor->to_api |
88 |
); |
88 |
} |
89 |
} |
89 |
|
90 |
|
90 |
=head3 add_vendor |
91 |
=head3 add_vendor |
Lines 100-107
sub add_vendor {
Link Here
|
100 |
|
101 |
|
101 |
return try { |
102 |
return try { |
102 |
$vendor->store; |
103 |
$vendor->store; |
103 |
return $c->render( status => 200, |
104 |
return $c->render( |
104 |
openapi => _to_api($vendor->TO_JSON) ); |
105 |
status => 200, |
|
|
106 |
openapi => $vendor->to_api |
107 |
); |
105 |
} |
108 |
} |
106 |
catch { |
109 |
catch { |
107 |
if ( $_->isa('DBIx::Class::Exception') ) { |
110 |
if ( $_->isa('DBIx::Class::Exception') ) { |
Lines 130-137
sub update_vendor {
Link Here
|
130 |
$vendor = Koha::Acquisition::Booksellers->find( $c->validation->param('vendor_id') ); |
133 |
$vendor = Koha::Acquisition::Booksellers->find( $c->validation->param('vendor_id') ); |
131 |
$vendor->set( _to_model( $c->validation->param('body') ) ); |
134 |
$vendor->set( _to_model( $c->validation->param('body') ) ); |
132 |
$vendor->store(); |
135 |
$vendor->store(); |
133 |
return $c->render( status => 200, |
136 |
return $c->render( |
134 |
openapi => _to_api($vendor->TO_JSON) ); |
137 |
status => 200, |
|
|
138 |
openapi => $vendor->to_api |
139 |
); |
135 |
} |
140 |
} |
136 |
catch { |
141 |
catch { |
137 |
if ( not defined $vendor ) { |
142 |
if ( not defined $vendor ) { |
138 |
- |
|
|