Bug 16782: Use uri filter instead of html
[koha.git] / admin / currency.pl
index 4d791db..1719498 100755 (executable)
@@ -25,8 +25,9 @@ use C4::Auth;
 use C4::Context;
 use C4::Output;
 
-use Koha::Acquisition::Currency;
+use Koha::Acquisition::Booksellers;
 use Koha::Acquisition::Currencies;
+use Koha::Acquisition::Orders;
 
 my $input         = CGI->new;
 my $searchfield   = $input->param('searchfield') || $input->param('description') || q{};
@@ -91,12 +92,12 @@ if ( $op eq 'add_form' ) {
 } elsif ( $op eq 'delete_confirm' ) {
     my $currency = Koha::Acquisition::Currencies->find($currency_code);
 
-    # TODO rewrite the following when Koha::Acquisition::Orders will use Koha::Objects
-    my $schema = Koha::Database->schema;
-    my $nb_of_orders = $schema->resultset('Aqorder')->search( { currency => $currency->currency } )->count;
+    my $nb_of_orders = Koha::Acquisition::Orders->search( { currency => $currency->currency } )->count;
+    my $nb_of_vendors = Koha::Acquisition::Booksellers->search( { -or => { listprice => $currency->currency, invoiceprice => $currency->currency } })->count;
     $template->param(
         currency     => $currency,
         nb_of_orders => $nb_of_orders,
+        nb_of_vendors => $nb_of_vendors,
     );
 } elsif ( $op eq 'delete_confirmed' ) {
     my $currency = Koha::Acquisition::Currencies->find($currency_code);