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

(-)a/Koha/Acquisition/Bookseller.pm (-2 lines)
Lines 31-38 sub fetch { Link Here
31
sub search {
31
sub search {
32
    my ( $class, $params ) = @_;
32
    my ( $class, $params ) = @_;
33
33
34
    croak "Cannot search on other fields than aqbooksellers.name" if $params and grep { $_ !~ /^name$/ } keys %$params;
35
36
    my $schema = Koha::Database->new->schema;
34
    my $schema = Koha::Database->new->schema;
37
35
38
    my $search_params;
36
    my $search_params;
(-)a/admin/currency.pl (+3 lines)
Lines 25-30 use C4::Auth; Link Here
25
use C4::Context;
25
use C4::Context;
26
use C4::Output;
26
use C4::Output;
27
27
28
use Koha::Acquisition::Bookseller;
28
use Koha::Acquisition::Currency;
29
use Koha::Acquisition::Currency;
29
use Koha::Acquisition::Currencies;
30
use Koha::Acquisition::Currencies;
30
31
Lines 94-102 if ( $op eq 'add_form' ) { Link Here
94
    # TODO rewrite the following when Koha::Acquisition::Orders will use Koha::Objects
95
    # TODO rewrite the following when Koha::Acquisition::Orders will use Koha::Objects
95
    my $schema = Koha::Database->schema;
96
    my $schema = Koha::Database->schema;
96
    my $nb_of_orders = $schema->resultset('Aqorder')->search( { currency => $currency->currency } )->count;
97
    my $nb_of_orders = $schema->resultset('Aqorder')->search( { currency => $currency->currency } )->count;
98
    my $nb_of_vendors = Koha::Acquisition::Bookseller->search( { -or => { listprice => $currency->currency, invoiceprice => $currency->currency } });
97
    $template->param(
99
    $template->param(
98
        currency     => $currency,
100
        currency     => $currency,
99
        nb_of_orders => $nb_of_orders,
101
        nb_of_orders => $nb_of_orders,
102
        nb_of_vendors => $nb_of_vendors,
100
    );
103
    );
101
} elsif ( $op eq 'delete_confirmed' ) {
104
} elsif ( $op eq 'delete_confirmed' ) {
102
    my $currency = Koha::Acquisition::Currencies->find($currency_code);
105
    my $currency = Koha::Acquisition::Currencies->find($currency_code);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt (-3 / +9 lines)
Lines 147-156 Link Here
147
[% END %]
147
[% END %]
148
148
149
[% IF op =='delete_confirm' %]
149
[% IF op =='delete_confirm' %]
150
    [% IF nb_of_orders %]
150
    [% IF nb_of_orders or nb_of_vendors %]
151
    <div class="dialog alert">
151
    <div class="dialog alert">
152
        <h3>Cannot delete currency <span class="ex">'[% currency.currency %]'</span></h3>
152
        <h3>Cannot delete currency <span class="ex">'[% currency.currency %]'</span></h3>
153
        <p>This currency is used by [% nb_of_orders %] orders. Deletion not possible</p>
153
        <p>
154
            [% IF nb_of_orders %]
155
                This currency is used by [% nb_of_orders %] orders.
156
            [% ELSIF nb_of_vendors %]
157
                This currency is used by [% nb_of_vendors %] vendors.
158
            [% END %]
159
            Deletion not possible
160
        </p>
154
        <form action="/cgi-bin/koha/admin/currency.pl" method="post">
161
        <form action="/cgi-bin/koha/admin/currency.pl" method="post">
155
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
162
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
156
        </form>
163
        </form>
157
- 

Return to bug 15962