X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=admin%2Fitemtypes.pl;h=841672d34d735ac898016e68f2a8e206bbfeb191;hb=8ad00bc02ff23e0dad6661da9ff6b11745cda6f7;hp=1a33a219c5276b9994d8cd590821f9ac29a67afd;hpb=03890c90ac41f66b2de04d0280e2e96a0d2e8be8;p=koha_fer diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 1a33a219c5..841672d34d 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -77,7 +77,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 1 }, + flagsrequired => { parameters => 'parameters_remaining_permissions' }, debug => 1, } ); @@ -188,15 +188,17 @@ elsif ( $op eq 'add_validate' ) { # called by default form, used to confirm deletion of data in DB } elsif ( $op eq 'delete_confirm' ) { - # Check both categoryitem and biblioitems, see Bug 199 - my $total = 0; - for my $table ('biblioitems') { - my $sth = - $dbh->prepare( - "select count(*) as total from $table where itemtype=?"); - $sth->execute($itemtype); - $total += $sth->fetchrow_hashref->{total}; - } + # Check both items and biblioitems + my $sth = $dbh->prepare(' + SELECT COUNT(*) AS total FROM ( + SELECT itemtype AS t FROM biblioitems + UNION + SELECT itype AS t FROM items + ) AS tmp + WHERE tmp.t=? + '); + $sth->execute($itemtype); + my $total = $sth->fetchrow_hashref->{'total'}; my $sth = $dbh->prepare(