@@ -, +, @@ --- Koha/Acquisition/Bookseller.pm | 2 -- admin/currency.pl | 3 +++ koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt | 11 +++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) --- a/Koha/Acquisition/Bookseller.pm +++ a/Koha/Acquisition/Bookseller.pm @@ -31,8 +31,6 @@ sub fetch { sub search { my ( $class, $params ) = @_; - croak "Cannot search on other fields than aqbooksellers.name" if $params and grep { $_ !~ /^name$/ } keys %$params; - my $schema = Koha::Database->new->schema; my $search_params; --- a/admin/currency.pl +++ a/admin/currency.pl @@ -25,6 +25,7 @@ use C4::Auth; use C4::Context; use C4::Output; +use Koha::Acquisition::Bookseller; use Koha::Acquisition::Currency; use Koha::Acquisition::Currencies; @@ -94,9 +95,11 @@ if ( $op eq 'add_form' ) { # 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_vendors = Koha::Acquisition::Bookseller->search( { -or => { listprice => $currency->currency, invoiceprice => $currency->currency } }); $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); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt @@ -147,10 +147,17 @@ [% END %] [% IF op =='delete_confirm' %] - [% IF nb_of_orders %] + [% IF nb_of_orders or nb_of_vendors %]

Cannot delete currency '[% currency.currency %]'

-

This currency is used by [% nb_of_orders %] orders. Deletion not possible

+

+ [% IF nb_of_orders %] + This currency is used by [% nb_of_orders %] orders. + [% ELSIF nb_of_vendors %] + This currency is used by [% nb_of_vendors %] vendors. + [% END %] + Deletion not possible +

--