Bug 19661: Use Koha::Acquisition::Funds instead of C4::Budgets
authorMatthias Meusburger <matthias.meusburger@biblibre.com>
Wed, 17 Jan 2018 10:49:14 +0000 (11:49 +0100)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 22 Mar 2019 19:40:36 +0000 (19:40 +0000)
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Koha/REST/V1/Acquisitions/Funds.pm

index a36d3c6..2ba300d 100644 (file)
@@ -19,7 +19,7 @@ use Modern::Perl;
 
 use Mojo::Base 'Mojolicious::Controller';
 
-use C4::Budgets;
+use Koha::Acquisition::Funds;
 use JSON qw(to_json);
 
 use Try::Tiny;
@@ -50,10 +50,10 @@ sub list_funds {
     }
 
     return try {
-        my $funds = GetBudgets($filter);
-        my @fundsArray = map { _to_api($_) } @$funds;
+        my @funds = Koha::Acquisition::Funds->search($filter);
+        @funds = map { _to_api($_->TO_JSON) } @funds;
         return $c->render( status  => 200,
-                           openapi =>  \@fundsArray);
+                           openapi =>  \@funds);
     }
     catch {
         if ( $_->isa('DBIx::Class::Exception') ) {