=cut
sub check_items_and_biblioitems {
my ($itemtype_code) = @_;
my $dbh = C4::Context->dbh;
# Check both items and biblioitems
my ($total) = $dbh->selectrow_array( '
SELECT COUNT(*) AS total FROM (
SELECT itemtype AS t FROM biblioitems
UNION ALL
SELECT itype AS t FROM items
) AS tmp
WHERE tmp.t=?
', {}, $itemtype_code );
return $total;
}
sub _type {
return 'Itemtype';
$op = 'list';
} elsif ( $op eq 'delete_confirm' ) {
my $total = Koha::ItemTypes->check_items_and_biblioitems($itemtype_code);
if ($total) {
push @messages, { type => 'error', code => 'cannot_be_deleted', total => $total };
-