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

(-)a/Koha/ItemType.pm (+14 lines)
Lines 89-94 sub translated_descriptions { Link Here
89
    } @translated_descriptions ];
89
    } @translated_descriptions ];
90
}
90
}
91
91
92
93
=head3 get_items_and_biblioitems
94
95
=cut
96
97
sub get_items_and_biblioitems {
98
    my $itemtype_code = $_[1];
99
    my $schema = Koha::Database->new()->schema();
100
    my $itemtotal = $schema->resultset('Item')->search({ 'itype' => $itemtype_code})->count;
101
    my $bibliototal = $schema->resultset('Biblioitem')->search({ 'itemtype' => $itemtype_code})->count;
102
    my $overalltotal = $itemtotal + $bibliototal;
103
    return $overalltotal;
104
}
105
92
=head3 type
106
=head3 type
93
107
94
=cut
108
=cut
(-)a/admin/itemtypes.pl (-8 / +2 lines)
Lines 31-38 use C4::Koha; Link Here
31
use C4::Context;
31
use C4::Context;
32
use C4::Auth;
32
use C4::Auth;
33
use C4::Output;
33
use C4::Output;
34
35
use Koha::ItemTypes;
34
use Koha::ItemTypes;
35
use Koha::ItemType;
36
use Koha::Localizations;
36
use Koha::Localizations;
37
37
38
my $input         = new CGI;
38
my $input         = new CGI;
Lines 140-151 if ( $op eq 'add_form' ) { Link Here
140
140
141
 } elsif ( $op eq 'delete_confirm' ) {
141
 } elsif ( $op eq 'delete_confirm' ) {
142
142
143
    my $schema = Koha::Database->new()->schema();
143
    my $overalltotal = Koha::ItemType->get_items_and_biblioitems($itemtype_code);
144
    my $itemtotal = $schema->resultset('Item')->search({ 'itype' => $itemtype_code})->count;
145
    my $bibliototal = $schema->resultset('Biblioitem')->search({ 'itemtype' => $itemtype_code})->count;
146
147
    my $overalltotal = $itemtotal + $bibliototal;
148
149
    if ($overalltotal) {
144
    if ($overalltotal) {
150
        push @messages, { type => 'error', code => 'cannot_be_deleted', total => $overalltotal };
145
        push @messages, { type => 'error', code => 'cannot_be_deleted', total => $overalltotal };
151
        $op = 'list';
146
        $op = 'list';
152
- 

Return to bug 17944