[Koha-bugs] [Bug 17944] Remove the sql code from itemtypes.pl administrative perl script

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jan 26 03:37:52 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17944

--- Comment #9 from Alex Buckley <alexbuckley at catalyst.net.nz> ---
So before I attach the new commit just to check would you be happy with this?

 my $schema = Koha::Database->new()->schema();
 my $itemtotal = $schema->resultset('Item')->search({ 'itype' =>
$itemtype_code})->count;
 my $bibliototal = $schema->resultset('Biblioitem')->search({ 'itemtype' =>
$itemtype_code})->count;

 my $overalltotal = $itemtotal + $bibliototal;

 if ($overalltotal) {
      push @messages, { type => 'error', code => 'cannot_be_deleted', total =>
$overalltotal };
      $op = 'list';
 } else {
      my $itemtype = Koha::ItemTypes->find($itemtype_code);
      $template->param( itemtype => $itemtype, );
}   

I have tested it and it outputs the correct value

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list