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

(-)a/admin/currency.pl (-8 / +10 lines)
Lines 132-152 sub delete_confirm { Link Here
132
    my $curr = shift;
132
    my $curr = shift;
133
133
134
    $template->param( delete_confirm => 1 );
134
    $template->param( delete_confirm => 1 );
135
    my $total_row = $dbh->selectrow_hashref(
135
    my ($nb_of_vendors) = $dbh->selectrow_array(q{
136
        'select count(*) as total from aqbooksellers where currency=?',
136
        select count(*) from aqbooksellers
137
        {}, $curr );
137
        where listprice = ? or invoiceprice = ?
138
    }, {}, $curr, $curr);
139
    my ($nb_of_orders) = $dbh->selectrow_array(q{
140
        select count(*) from aqorders
141
        where currency = ?
142
    }, {}, $curr);
138
143
139
    my $curr_ref = $dbh->selectrow_hashref(
144
    my $curr_ref = $dbh->selectrow_hashref(
140
        'select currency,rate from currency where currency=?',
145
        'select currency,rate from currency where currency=?',
141
        {}, $curr );
146
        {}, $curr );
142
147
143
    if ( $total_row->{total} ) {
144
        $template->param( totalgtzero => 1 );
145
    }
146
147
    $template->param(
148
    $template->param(
148
        rate  => $curr_ref->{rate},
149
        rate  => $curr_ref->{rate},
149
        total => $total_row->{total}
150
        nb_of_orders => $nb_of_orders,
151
        nb_of_vendors => $nb_of_vendors,
150
    );
152
    );
151
153
152
    return;
154
    return;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt (-3 / +9 lines)
Lines 125-134 Link Here
125
[% END %]
125
[% END %]
126
126
127
[% IF ( delete_confirm ) %]
127
[% IF ( delete_confirm ) %]
128
    [% IF ( totalgtzero ) %]
128
    [% IF ( nb_of_orders or nb_of_vendors ) %]
129
    <div class="dialog message">
129
    <div class="dialog message">
130
        <h3>Cannot delete currency <span class="ex">'[% searchfield %]'</span></h3>
130
        <h3>Cannot delete currency <span class="ex">'[% searchfield %]'</span></h3>
131
        <p>This currency is used [% total %] times. Deletion not possible</p>
131
        <p>
132
            [% IF nb_of_orders %]
133
                This currency is used by [% nb_of_orders %] orders.
134
            [% ELSIF nb_of_vendors %]
135
                This currency is used by [% nb_of_vendors %] vendors.
136
            [% END %]
137
            Deletion not possible
138
        </p>
132
        <form action="[% script_name %]" method="post">
139
        <form action="[% script_name %]" method="post">
133
            <input type="submit" value="OK" class="approve" />
140
            <input type="submit" value="OK" class="approve" />
134
        </form>
141
        </form>
135
- 

Return to bug 15962