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

(-)a/C4/ItemCirculationAlertPreference.pm (-2 / +3 lines)
Lines 21-29 use strict; Link Here
21
use warnings;
21
use warnings;
22
use C4::Context;
22
use C4::Context;
23
use C4::Category;
23
use C4::Category;
24
use C4::ItemType;
25
use Carp qw(carp croak);
24
use Carp qw(carp croak);
26
25
26
use Koha::ItemTypes;
27
27
our $AUTOLOAD;
28
our $AUTOLOAD;
28
29
29
# helper function for validating \%opts
30
# helper function for validating \%opts
Lines 331-337 sub grid { Link Here
331
    my @branch_prefs = $class->find($where);
332
    my @branch_prefs = $class->find($where);
332
    my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
333
    my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
333
    my @cc = C4::Category->all;
334
    my @cc = C4::Category->all;
334
    my @it = C4::ItemType->all;
335
    my @it = Koha::ItemTypes->search;
335
    my $notification = $where->{notification};
336
    my $notification = $where->{notification};
336
    my %disabled = map {
337
    my %disabled = map {
337
        my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification;
338
        my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification;
(-)a/acqui/neworderempty.pl (-1 / +2 lines)
Lines 89-94 use C4::Search qw/FindDuplicate/; Link Here
89
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
89
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
90
90
91
use Koha::Acquisition::Bookseller;
91
use Koha::Acquisition::Bookseller;
92
use Koha::ItemTypes;
92
93
93
our $input           = new CGI;
94
our $input           = new CGI;
94
my $booksellerid    = $input->param('booksellerid');	# FIXME: else ERROR!
95
my $booksellerid    = $input->param('booksellerid');	# FIXME: else ERROR!
Lines 303-309 if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) { Link Here
303
}
304
}
304
# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
305
# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
305
my @itemtypes;
306
my @itemtypes;
306
@itemtypes = C4::ItemType->all unless C4::Context->preference('item-level_itypes');
307
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
307
308
308
if ( defined $subscriptionid ) {
309
if ( defined $subscriptionid ) {
309
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
310
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
(-)a/admin/item_circulation_alerts.pl (-15 / +3 lines)
Lines 28-51 use C4::Auth; Link Here
28
use C4::Context;
28
use C4::Context;
29
use C4::Branch;
29
use C4::Branch;
30
use C4::Category;
30
use C4::Category;
31
use C4::ItemType;
32
use C4::ItemCirculationAlertPreference;
31
use C4::ItemCirculationAlertPreference;
33
use C4::Output;
32
use C4::Output;
34
33
34
use Koha::ItemTypes;
35
35
# shortcut for long package name
36
# shortcut for long package name
36
our $preferences = 'C4::ItemCirculationAlertPreference';
37
our $preferences = 'C4::ItemCirculationAlertPreference';
37
38
38
# prepend "br_" to column name and replace spaces with "<br/>"
39
sub br {
40
    my ($data, @keys) = @_;
41
    for (@keys) {
42
        my $br = $data->{$_};
43
        $br =~ s{\s+}{<br/>}g;
44
        $data->{'br_'.$_} = $br;
45
    }
46
    $data;
47
}
48
49
# display item circulation alerts
39
# display item circulation alerts
50
sub show {
40
sub show {
51
    my ($input) = @_;
41
    my ($input) = @_;
Lines 78-86 sub show { Link Here
78
    my @categories = (
68
    my @categories = (
79
        C4::Category->all
69
        C4::Category->all
80
    );
70
    );
81
    my @item_types = map { br($_, 'description') }  (
71
    my @item_types = Koha::ItemTypes->search;
82
        C4::ItemType->all
83
    );
84
    my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
72
    my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
85
    my $grid_checkin  = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
73
    my $grid_checkin  = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
86
74
(-)a/catalogue/itemsearch.pl (-5 / +7 lines)
Lines 27-35 use C4::Items; Link Here
27
use C4::Biblio;
27
use C4::Biblio;
28
use C4::Branch;
28
use C4::Branch;
29
use C4::Koha;
29
use C4::Koha;
30
use C4::ItemType;
31
30
32
use Koha::Item::Search::Field qw(GetItemSearchFields);
31
use Koha::Item::Search::Field qw(GetItemSearchFields);
32
use Koha::ItemTypes;
33
33
34
my $cgi = new CGI;
34
my $cgi = new CGI;
35
my %params = $cgi->Vars;
35
my %params = $cgi->Vars;
Lines 255-264 if ($format eq 'html') { Link Here
255
            label => $location->{lib} // $location->{authorised_value},
255
            label => $location->{lib} // $location->{authorised_value},
256
        };
256
        };
257
    }
257
    }
258
    my @itemtypes = C4::ItemType->all();
258
    my @itemtypes;
259
    foreach my $itemtype (@itemtypes) {
259
    foreach my $itemtype ( Koha::ItemTypes->search ) {
260
        $itemtype->{value} = $itemtype->{itemtype};
260
        push @itemtypes, {
261
        $itemtype->{label} = $itemtype->{translated_description};
261
            value => $itemtype->itemtype,
262
            label => $itemtype->translated_description,
263
        };
262
    }
264
    }
263
    my $ccode_avcode = GetAuthValCode('items.ccode') || 'CCODE';
265
    my $ccode_avcode = GetAuthValCode('items.ccode') || 'CCODE';
264
    my $ccodes = GetAuthorisedValues($ccode_avcode);
266
    my $ccodes = GetAuthorisedValues($ccode_avcode);
(-)a/cataloguing/value_builder/marc21_linking_section.pl (-3 / +4 lines)
Lines 32-38 use C4::Biblio; Link Here
32
use C4::Koha;
32
use C4::Koha;
33
use MARC::Record;
33
use MARC::Record;
34
use C4::Branch;
34
use C4::Branch;
35
use C4::ItemType;
35
36
use Koha::ItemTypes;
36
37
37
my $builder = sub {
38
my $builder = sub {
38
    my ( $params ) = @_;
39
    my ( $params ) = @_;
Lines 304-310 my $launcher = sub { Link Here
304
            }
305
            }
305
        );
306
        );
306
307
307
        my @itemtypes = C4::ItemType->all;
308
        my @itemtypes = Koha::ItemTypes->search;
308
309
309
        $template->param(
310
        $template->param(
310
            itypeloop => \@itemtypes,
311
            itypeloop => \@itemtypes,
Lines 315-318 my $launcher = sub { Link Here
315
    output_html_with_http_headers $query, $cookie, $template->output;
316
    output_html_with_http_headers $query, $cookie, $template->output;
316
};
317
};
317
318
318
return { builder => $builder, launcher => $launcher };
319
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/unimarc_field_4XX.pl (-2 / +3 lines)
Lines 32-38 use C4::Biblio; Link Here
32
use C4::Koha;
32
use C4::Koha;
33
use MARC::Record;
33
use MARC::Record;
34
use C4::Branch;    # GetBranches
34
use C4::Branch;    # GetBranches
35
use C4::ItemType;
35
36
use Koha::ItemTypes;
36
37
37
sub plugin_javascript {
38
sub plugin_javascript {
38
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
39
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
Lines 508-514 sub plugin { Link Here
508
            }
509
            }
509
        );
510
        );
510
511
511
        my @itemtypes = C4::ItemType->all;
512
        my @itemtypes = Koha::ItemTypes->search;
512
513
513
        $template->param(    #classlist => $classlist,
514
        $template->param(    #classlist => $classlist,
514
            itypeloop    => \@itemtypes,
515
            itypeloop    => \@itemtypes,
(-)a/circ/returns.pl (-5 / +5 lines)
Lines 267-282 if ($barcode) { Link Here
267
267
268
    # Check if we should display a checkin message, based on the the item
268
    # Check if we should display a checkin message, based on the the item
269
    # type of the checked in item
269
    # type of the checked in item
270
    my $itemtype = C4::ItemType->get( $biblio->{'itemtype'} );
270
    my $itemtype = Koha::ItemTypes->find( $biblio->{'itemtype'} );
271
    if ( $itemtype->{'checkinmsg'} ) {
271
    if ( $itemtype->checkinmsg ) {
272
        $template->param(
272
        $template->param(
273
            checkinmsg     => $itemtype->{'checkinmsg'},
273
            checkinmsg     => $itemtype->checkinmsg,
274
            checkinmsgtype => $itemtype->{'checkinmsgtype'},
274
            checkinmsgtype => $itemtype->checkinmsgtype,
275
        );
275
        );
276
    }
276
    }
277
277
278
    # make sure return branch respects home branch circulation rules, default to homebranch
278
    # make sure return branch respects home branch circulation rules, default to homebranch
279
    my $hbr = GetBranchItemRule($biblio->{'homebranch'}, $itemtype)->{'returnbranch'} || "homebranch";
279
    my $hbr = GetBranchItemRule($biblio->{'homebranch'}, $itemtype->itemtype)->{'returnbranch'} || "homebranch";
280
    my $returnbranch = $biblio->{$hbr} ;
280
    my $returnbranch = $biblio->{$hbr} ;
281
281
282
    $template->param(
282
    $template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/item_circulation_alerts.tt (-2 / +2 lines)
Lines 157-163 $(function(){ Link Here
157
<tr>
157
<tr>
158
  <th>&nbsp;</th>
158
  <th>&nbsp;</th>
159
  [% FOREACH item_type IN item_types %]
159
  [% FOREACH item_type IN item_types %]
160
  <th>[% item_type.br_description %]</th>
160
  <th>[% item_type.description %]</th>
161
  [% END %]
161
  [% END %]
162
</tr>
162
</tr>
163
</thead>
163
</thead>
Lines 181-187 $(function(){ Link Here
181
<tr>
181
<tr>
182
  <th>&nbsp;</th>
182
  <th>&nbsp;</th>
183
  [% FOREACH item_type IN item_types %]
183
  [% FOREACH item_type IN item_types %]
184
  <th>[% item_type.br_description %]</th>
184
  <th>[% item_type.description %]</th>
185
  [% END %]
185
  [% END %]
186
</tr>
186
</tr>
187
</thead>
187
</thead>
(-)a/t/db_dependent/HoldsQueue.t (-7 / +6 lines)
Lines 14-24 use Data::Dumper; Link Here
14
14
15
use Test::More tests => 21;
15
use Test::More tests => 21;
16
16
17
18
use C4::Branch;
17
use C4::Branch;
19
use C4::ItemType;
18
use C4::Branch;
20
use C4::Members;
19
use C4::Members;
21
20
21
use Koha::ItemTypes;
22
22
BEGIN {
23
BEGIN {
23
    use FindBin;
24
    use FindBin;
24
    use lib $FindBin::Bin;
25
    use lib $FindBin::Bin;
Lines 49-57 my $branches = C4::Branch::GetBranches; Link Here
49
my @other_branches = grep { $_ ne $borrower_branchcode } keys %$branches;
50
my @other_branches = grep { $_ ne $borrower_branchcode } keys %$branches;
50
my $least_cost_branch_code = pop @other_branches
51
my $least_cost_branch_code = pop @other_branches
51
  or BAIL_OUT("No point testing only one branch...");
52
  or BAIL_OUT("No point testing only one branch...");
52
my @item_types = C4::ItemType->all;
53
my $itemtype = Koha::ItemTypes->search({ notforloan => 1 })->next;
53
my $itemtype = grep { $_->{notforloan} == 1 } @item_types
54
$itemtype or BAIL_OUT("No adequate itemtype");
54
  or BAIL_OUT("No adequate itemtype");
55
55
56
#Set up the stage
56
#Set up the stage
57
# Sysprefs and cost matrix
57
# Sysprefs and cost matrix
Lines 168-174 $dbh->do("DELETE FROM default_circ_rules"); Link Here
168
C4::Context->set_preference('UseTransportCostMatrix', 0);
168
C4::Context->set_preference('UseTransportCostMatrix', 0);
169
169
170
my @branchcodes = keys %$branches;
170
my @branchcodes = keys %$branches;
171
( $itemtype ) = @{ $dbh->selectrow_arrayref("SELECT itemtype FROM itemtypes LIMIT 1") };
171
$itemtype = Koha::ItemTypes->search->next;
172
172
173
my $borrowernumber1 = AddMember(
173
my $borrowernumber1 = AddMember(
174
    (
174
    (
175
- 

Return to bug 14828