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

(-)a/C4/Items.pm (-4 / +5 lines)
Lines 41-46 use Koha::Database; Link Here
41
41
42
use Koha::Biblioitems;
42
use Koha::Biblioitems;
43
use Koha::Items;
43
use Koha::Items;
44
use Koha::ItemTypes;
44
use Koha::SearchEngine;
45
use Koha::SearchEngine;
45
use Koha::SearchEngine::Search;
46
use Koha::SearchEngine::Search;
46
use Koha::Libraries;
47
use Koha::Libraries;
Lines 2998-3009 sub PrepareItemrecordDisplay { Link Here
2998
2999
2999
                        #----- itemtypes
3000
                        #----- itemtypes
3000
                    } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
3001
                    } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
3001
                        my $itemtypes = GetItemTypes( style => 'array' );
3002
                        my $itemtypes = Koha::ItemTypes->search_with_localization;
3002
                        push @authorised_values, ""
3003
                        push @authorised_values, ""
3003
                          unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
3004
                          unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
3004
                        for my $itemtype ( @$itemtypes ) {
3005
                        while ( my $itemtype = $itemtypes->next ) {
3005
                            push @authorised_values, $itemtype->{itemtype};
3006
                            push @authorised_values, $itemtype->itemtype;
3006
                            $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
3007
                            $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
3007
                        }
3008
                        }
3008
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
3009
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
3009
                            $defaultvalue = $defaultvalues->{'itemtype'};
3010
                            $defaultvalue = $defaultvalues->{'itemtype'};
(-)a/C4/Search.pm (-1 / +3 lines)
Lines 31-36 use C4::Reserves; # GetReserveStatus Link Here
31
use C4::Debug;
31
use C4::Debug;
32
use C4::Charset;
32
use C4::Charset;
33
use Koha::AuthorisedValues;
33
use Koha::AuthorisedValues;
34
use Koha::ItemTypes;
34
use Koha::Libraries;
35
use Koha::Libraries;
35
use Koha::Patrons;
36
use Koha::Patrons;
36
use YAML;
37
use YAML;
Lines 1866-1872 sub searchResults { Link Here
1866
    my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef;
1867
    my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef;
1867
1868
1868
    #Get itemtype hash
1869
    #Get itemtype hash
1869
    my %itemtypes = %{ GetItemTypes() };
1870
    my $itemtypes = Koha::ItemTypes->search_with_localization;
1871
    my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };
1870
1872
1871
    #search item field code
1873
    #search item field code
1872
    my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" );
1874
    my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" );
(-)a/C4/XSLT.pm (-1 / +2 lines)
Lines 30-35 use C4::Biblio; Link Here
30
use C4::Circulation;
30
use C4::Circulation;
31
use C4::Reserves;
31
use C4::Reserves;
32
use Koha::AuthorisedValues;
32
use Koha::AuthorisedValues;
33
use Koha::ItemTypes;
33
use Koha::XSLT_Handler;
34
use Koha::XSLT_Handler;
34
use Koha::Libraries;
35
use Koha::Libraries;
35
36
Lines 280-286 sub buildKohaItemsNamespace { Link Here
280
281
281
    my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
282
    my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
282
283
283
    my $itemtypes = GetItemTypes();
284
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
284
    my $location = "";
285
    my $location = "";
285
    my $ccode = "";
286
    my $ccode = "";
286
    my $xml = '';
287
    my $xml = '';
(-)a/Koha/Template/Plugin/ItemTypes.pm (-3 / +2 lines)
Lines 23-28 use Template::Plugin; Link Here
23
use base qw( Template::Plugin );
23
use base qw( Template::Plugin );
24
24
25
use C4::Koha;
25
use C4::Koha;
26
use Koha::ItemTypes;
26
27
27
sub GetDescription {
28
sub GetDescription {
28
    my ( $self, $itemtype ) = @_;
29
    my ( $self, $itemtype ) = @_;
Lines 33-41 sub GetDescription { Link Here
33
}
34
}
34
35
35
sub Get {
36
sub Get {
36
    my @itemtypes = @{ GetItemTypes(style => 'array') };
37
    return Koha::ItemTypes->search_with_localization->unblessed;
37
    @itemtypes = sort { $a->{description} cmp $b->{description} } @itemtypes;
38
    return \@itemtypes;
39
}
38
}
40
39
41
1;
40
1;
(-)a/acqui/basketgroup.pl (-2 / +2 lines)
Lines 56-61 use C4::Members qw/GetMember/; Link Here
56
use Koha::EDI qw/create_edi_order get_edifact_ean/;
56
use Koha::EDI qw/create_edi_order get_edifact_ean/;
57
57
58
use Koha::Acquisition::Booksellers;
58
use Koha::Acquisition::Booksellers;
59
use Koha::ItemTypes;
59
60
60
our $input=new CGI;
61
our $input=new CGI;
61
62
Lines 174-180 sub printbasketgrouppdf{ Link Here
174
            $ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity};
175
            $ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity};
175
176
176
            my $bib = GetBiblioData($ord->{biblionumber});
177
            my $bib = GetBiblioData($ord->{biblionumber});
177
            my $itemtypes = GetItemTypes();
178
178
179
            #FIXME DELETE ME
179
            #FIXME DELETE ME
180
            # 0      1        2        3         4            5         6       7      8        9
180
            # 0      1        2        3         4            5         6       7      8        9
Lines 195-201 sub printbasketgrouppdf{ Link Here
195
                }
195
                }
196
            }
196
            }
197
197
198
            $ord->{itemtype} = ( $ord->{itemtype} and $bib->{itemtype} ) ? $itemtypes->{$bib->{itemtype}}->{description} : undef;
198
            $ord->{itemtype} = ( $ord->{itemtype} and $bib->{itemtype} ) ? Koha::ItemTypes->find( $bib->{itemtype} )->description : undef;
199
            $ord->{en} = $en ? $en : undef;
199
            $ord->{en} = $en ? $en : undef;
200
            $ord->{edition} = $edition ? $edition : undef;
200
            $ord->{edition} = $edition ? $edition : undef;
201
201
(-)a/acqui/orderreceive.pl (-1 lines)
Lines 63-69 use warnings; Link Here
63
63
64
use CGI qw ( -utf8 );
64
use CGI qw ( -utf8 );
65
use C4::Context;
65
use C4::Context;
66
use C4::Koha;   # GetItemTypes
67
use C4::Acquisition;
66
use C4::Acquisition;
68
use C4::Auth;
67
use C4::Auth;
69
use C4::Output;
68
use C4::Output;
(-)a/admin/smart-rules.pl (-3 / +2 lines)
Lines 468-475 $template->param( Link Here
468
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
468
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
469
469
470
my @row_loop;
470
my @row_loop;
471
my @itemtypes = @{ GetItemTypes( style => 'array' ) };
471
my $itemtypes = Koha::ItemTypes->search_with_localization;
472
@itemtypes = sort { lc $a->{translated_description} cmp lc $b->{translated_description} } @itemtypes;
473
472
474
my $sth2 = $dbh->prepare("
473
my $sth2 = $dbh->prepare("
475
    SELECT  issuingrules.*,
474
    SELECT  issuingrules.*,
Lines 616-622 $template->param(default_rules => ($defaults ? 1 : 0)); Link Here
616
615
617
$template->param(
616
$template->param(
618
    patron_categories => $patron_categories,
617
    patron_categories => $patron_categories,
619
                        itemtypeloop => \@itemtypes,
618
                        itemtypeloop => $itemtypes,
620
                        rules => \@sorted_row_loop,
619
                        rules => \@sorted_row_loop,
621
                        humanbranch => ($branch ne '*' ? $branch : ''),
620
                        humanbranch => ($branch ne '*' ? $branch : ''),
622
                        current_branch => $branch,
621
                        current_branch => $branch,
(-)a/authorities/authorities.pl (-4 / +5 lines)
Lines 32-37 use MARC::File::USMARC; Link Here
32
use MARC::File::XML;
32
use MARC::File::XML;
33
use C4::Biblio;
33
use C4::Biblio;
34
use Koha::Authority::Types;
34
use Koha::Authority::Types;
35
use Koha::ItemTypes;
35
use vars qw( $tagslib);
36
use vars qw( $tagslib);
36
use vars qw( $authorised_values_sth);
37
use vars qw( $authorised_values_sth);
37
use vars qw( $is_a_modif );
38
use vars qw( $is_a_modif );
Lines 91-100 sub build_authorized_values_list { Link Here
91
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
92
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
92
93
93
        my $itemtype;
94
        my $itemtype;
94
        my $itemtypes = GetItemTypes( style => 'array' );
95
        my $itemtypes = Koha::ItemTypes->search_with_localization;
95
        for my $itemtype ( @$itemtypes ) {
96
        while ( $itemtype = $itemtypes->next ) {
96
            push @authorised_values, $itemtype->{itemtype};
97
            push @authorised_values, $itemtype->itemtype;
97
            $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
98
            $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
98
        }
99
        }
99
        $value = $itemtype unless ($value);
100
        $value = $itemtype unless ($value);
100
101
(-)a/catalogue/detail.pl (-2 / +3 lines)
Lines 42-47 use C4::HTML5Media; Link Here
42
use C4::CourseReserves qw(GetItemCourseReservesInfo);
42
use C4::CourseReserves qw(GetItemCourseReservesInfo);
43
use C4::Acquisition qw(GetOrdersByBiblionumber);
43
use C4::Acquisition qw(GetOrdersByBiblionumber);
44
use Koha::AuthorisedValues;
44
use Koha::AuthorisedValues;
45
use Koha::ItemTypes;
45
use Koha::Patrons;
46
use Koha::Patrons;
46
use Koha::Virtualshelves;
47
use Koha::Virtualshelves;
47
48
Lines 127-134 my $marcurlsarray = GetMarcUrls ($record,$marcflavour); Link Here
127
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
128
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
128
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
129
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
129
130
130
# Get Branches, Itemtypes and Locations
131
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
131
my $itemtypes = GetItemTypes();
132
132
my $dbh = C4::Context->dbh;
133
my $dbh = C4::Context->dbh;
133
134
134
my @all_items = GetItemsInfo( $biblionumber );
135
my @all_items = GetItemsInfo( $biblionumber );
(-)a/catalogue/moredetail.pl (-1 / +2 lines)
Lines 124-130 my $ccodes = Link Here
124
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
124
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
125
my $copynumbers =
125
my $copynumbers =
126
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
126
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
127
my $itemtypes = GetItemTypes;
127
128
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
128
129
129
$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'translated_description'};
130
$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'translated_description'};
130
$data->{'rentalcharge'} = sprintf( "%.2f", $data->{'rentalcharge'} );
131
$data->{'rentalcharge'} = sprintf( "%.2f", $data->{'rentalcharge'} );
(-)a/catalogue/search.pl (-3 / +4 lines)
Lines 151-156 use URI::Escape; Link Here
151
use POSIX qw(ceil floor);
151
use POSIX qw(ceil floor);
152
use C4::Search::History;
152
use C4::Search::History;
153
153
154
use Koha::ItemTypes;
154
use Koha::LibraryCategories;
155
use Koha::LibraryCategories;
155
use Koha::Virtualshelves;
156
use Koha::Virtualshelves;
156
use Koha::SearchEngine::Search;
157
use Koha::SearchEngine::Search;
Lines 221-227 $template->param( Link Here
221
);
222
);
222
223
223
# load the Type stuff
224
# load the Type stuff
224
my $itemtypes = GetItemTypes;
225
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
225
# the index parameter is different for item-level itemtypes
226
# the index parameter is different for item-level itemtypes
226
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
227
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
227
my @advancedsearchesloop;
228
my @advancedsearchesloop;
Lines 515-521 my $facets; # this object stores the faceted results that display on the left-ha Link Here
515
my $results_hashref;
516
my $results_hashref;
516
517
517
eval {
518
eval {
518
    my $itemtypes = GetItemTypes;
519
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
519
    ( $error, $results_hashref, $facets ) = $searcher->search_compat(
520
    ( $error, $results_hashref, $facets ) = $searcher->search_compat(
520
        $query,            $simple_query, \@sort_by,       \@servers,
521
        $query,            $simple_query, \@sort_by,       \@servers,
521
        $results_per_page, $offset,       $expanded_facet, undef,
522
        $results_per_page, $offset,       $expanded_facet, undef,
Lines 780-786 sub prepare_adv_search_types { Link Here
780
    # the index parameter is different for item-level itemtypes
781
    # the index parameter is different for item-level itemtypes
781
    my $itype_or_itemtype =
782
    my $itype_or_itemtype =
782
      ( C4::Context->preference("item-level_itypes") ) ? 'itype' : 'itemtype';
783
      ( C4::Context->preference("item-level_itypes") ) ? 'itype' : 'itemtype';
783
    my $itemtypes = GetItemTypes;
784
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
784
785
785
    my ( $cnt, @result );
786
    my ( $cnt, @result );
786
    foreach my $advanced_srch_type (@advanced_search_types) {
787
    foreach my $advanced_srch_type (@advanced_search_types) {
(-)a/cataloguing/addbiblio.pl (-4 / +5 lines)
Lines 37-42 use C4::Charset; Link Here
37
use Koha::BiblioFrameworks;
37
use Koha::BiblioFrameworks;
38
use Koha::DateUtils;
38
use Koha::DateUtils;
39
39
40
use Koha::ItemTypes;
40
use Koha::Libraries;
41
use Koha::Libraries;
41
42
42
use Koha::BiblioFrameworks;
43
use Koha::BiblioFrameworks;
Lines 188-197 sub build_authorized_values_list { Link Here
188
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
189
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
189
190
190
        my $itemtype;
191
        my $itemtype;
191
        my $itemtypes = GetItemTypes( style => 'array' );
192
        my $itemtypes = Koha::ItemTypes->search_with_localization;
192
        for my $itemtype ( @$itemtypes ) {
193
        while ( $itemtype = $itemtypes->next ) {
193
            push @authorised_values, $itemtype->{itemtype};
194
            push @authorised_values, $itemtype->itemtype;
194
            $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
195
            $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
195
        }
196
        }
196
        $value = $itemtype unless ($value);
197
        $value = $itemtype unless ($value);
197
    }
198
    }
(-)a/cataloguing/additem.pl (-4 / +5 lines)
Lines 31-36 use C4::Circulation; Link Here
31
use C4::Koha;
31
use C4::Koha;
32
use C4::ClassSource;
32
use C4::ClassSource;
33
use Koha::DateUtils;
33
use Koha::DateUtils;
34
use Koha::ItemTypes;
34
use Koha::Libraries;
35
use Koha::Libraries;
35
use List::MoreUtils qw/any/;
36
use List::MoreUtils qw/any/;
36
use C4::Search;
37
use C4::Search;
Lines 182-191 sub generate_subfield_form { Link Here
182
            }
183
            }
183
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
184
            elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
184
                  push @authorised_values, "" unless ( $subfieldlib->{mandatory} );
185
                  push @authorised_values, "" unless ( $subfieldlib->{mandatory} );
185
                  my $itemtypes = GetItemTypes( style => 'array' );
186
                  my $itemtypes = Koha::ItemTypes->search_with_localization;
186
                  for my $itemtype ( @$itemtypes ) {
187
                  while ( my $itemtype = $itemtypes->next ) {
187
                      push @authorised_values, $itemtype->{itemtype};
188
                      push @authorised_values, $itemtype->itemtype;
188
                      $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
189
                      $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
189
                  }
190
                  }
190
191
191
                  unless ( $value ) {
192
                  unless ( $value ) {
(-)a/circ/view_holdsqueue.pl (-6 / +7 lines)
Lines 29-37 use C4::Auth; Link Here
29
use C4::Output;
29
use C4::Output;
30
use C4::Biblio;
30
use C4::Biblio;
31
use C4::Items;
31
use C4::Items;
32
use C4::Koha;   # GetItemTypes
33
use C4::HoldsQueue qw(GetHoldsQueueItems);
32
use C4::HoldsQueue qw(GetHoldsQueueItems);
34
33
34
use Koha::ItemTypes;
35
35
my $query = new CGI;
36
my $query = new CGI;
36
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
    {
38
    {
Lines 61-76 if ( $run_report ) { Link Here
61
}
62
}
62
63
63
# getting all itemtypes
64
# getting all itemtypes
64
my $itemtypes = &GetItemTypes();
65
my $itemtypes = Koha::ItemTypes->search({}, {order_by => 'itemtype'});;
65
my @itemtypesloop;
66
my @itemtypesloop;
66
foreach my $thisitemtype ( sort keys %$itemtypes ) {
67
while ( my $itemtype = $itemtypes->next ) {
67
    push @itemtypesloop, {
68
    push @itemtypesloop, {
68
        value       => $thisitemtype,
69
        value       => $itemtype->itemtype,
69
        description => $itemtypes->{$thisitemtype}->{'description'},
70
        description => $itemtypes->description, # FIXME Don't we want the translated_description here?
70
    };
71
    };
71
}
72
}
72
73
73
$template->param(
74
$template->param( # FIXME Could be improved passing the $itemtypes iterator directly to the template
74
   itemtypeloop => \@itemtypesloop,
75
   itemtypeloop => \@itemtypesloop,
75
);
76
);
76
77
(-)a/course_reserves/add_items.pl (-1 / +4 lines)
Lines 29-34 use C4::Biblio; Link Here
29
29
30
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
30
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
31
31
32
use Koha::ItemTypes;
33
32
my $cgi = new CGI;
34
my $cgi = new CGI;
33
35
34
my $action    = $cgi->param('action')    || '';
36
my $action    = $cgi->param('action')    || '';
Lines 64-69 if ( $action eq 'lookup' ) { Link Here
64
      )
66
      )
65
      : undef;
67
      : undef;
66
68
69
    my $itemtypes = Koha::ItemTypes->search;
67
    $template->param(
70
    $template->param(
68
        item           => $item,
71
        item           => $item,
69
        course_item    => $course_item,
72
        course_item    => $course_item,
Lines 71-77 if ( $action eq 'lookup' ) { Link Here
71
74
72
        ccodes    => GetAuthorisedValues('CCODE'),
75
        ccodes    => GetAuthorisedValues('CCODE'),
73
        locations => GetAuthorisedValues('LOC'),
76
        locations => GetAuthorisedValues('LOC'),
74
        itypes    => GetItemTypes( style => 'array' ),
77
        itypes    => $itemtypes, # FIXME We certainly want to display the translated_description in the template
75
        return    => $return,
78
        return    => $return,
76
    );
79
    );
77
80
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt (-2 / +2 lines)
Lines 147-154 function Dopop(link) { Link Here
147
    </select>			</li>
147
    </select>			</li>
148
			<li> 
148
			<li> 
149
                <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
149
                <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
150
    [% FOREACH itemtypeloo IN itemtypeloop %]
150
    [% FOREACH itemtype IN itemtypes %]
151
        <option value="[% itemtypeloo.value %]" >[% itemtypeloo.translated_description %] </option>
151
        <option value="[% itemtype.itemtype %]" >[% itemtype.translated_description %] </option>
152
     [% END %] 
152
     [% END %] 
153
    </select>
153
    </select>
154
			</li>
154
			</li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt (-2 / +2 lines)
Lines 120-127 Link Here
120
        </li>
120
        </li>
121
      <li> 
121
      <li> 
122
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
122
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
123
    [% FOREACH itemtypeloo IN itemtypeloop %]
123
    [% FOREACH itemtype IN itemtypes %]
124
        <option value="[% itemtypeloo.value %]" >[% itemtypeloo.description %] </option>  
124
        <option value="[% itemtype.itemtype %]" >[% itemtype.translated_description %] </option>
125
     [% END %] 
125
     [% END %] 
126
    </select>
126
    </select>
127
      </li>
127
      </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt (-2 / +2 lines)
Lines 97-104 Link Here
97
      <li> 
97
      <li> 
98
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
98
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
99
        <option value="">Any item type</option>
99
        <option value="">Any item type</option>
100
    [% FOREACH itemtypeloo IN itemtypeloop %]
100
    [% FOREACH itemtype IN itemtypes %]
101
        <option value="[% itemtypeloo.value %]">[% itemtypeloo.description %]</option>  
101
        <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
102
     [% END %] 
102
     [% END %] 
103
    </select>
103
    </select>
104
    </li>
104
    </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt (-2 / +2 lines)
Lines 167-174 Link Here
167
            <td><input type="radio" name="Column" value="itemtype" /></td>
167
            <td><input type="radio" name="Column" value="itemtype" /></td>
168
           <td><select name="Filter" id="itemtype">
168
           <td><select name="Filter" id="itemtype">
169
               <option value=""> </option>
169
               <option value=""> </option>
170
               [% FOREACH itemtypeloo IN itemtypeloop %]
170
               [% FOREACH itemtype IN itemtypes %]
171
                 <option value="[% itemtypeloo.code %]">[% itemtypeloo.description %]</option>
171
                 <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
172
               [% END %]
172
               [% END %]
173
               </select>
173
               </select>
174
             </td> 
174
             </td> 
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt (-5 / +2 lines)
Lines 106-116 Link Here
106
            </select></li>
106
            </select></li>
107
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
107
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
108
                <option value="">All</option>
108
                <option value="">All</option>
109
                [% FOREACH itemtypeloo IN itemtypeloop %]
109
                [% FOREACH itemtype IN itemtypes %]
110
                [% IF ( itemtypeloo.selected ) %]<option value="[% itemtypeloo.value %]" selected="selected">[% itemtypeloo.description %]</option>
110
                    <option value="[% itemtype.itemtype  %]">[% itemtype.translated_description %]</option>
111
				[% ELSE %]
112
				<option value="[% itemtypeloo.value %]">[% itemtypeloo.description %]</option>
113
				[% END %]
114
                [% END %]
111
                [% END %]
115
            </select></li>
112
            </select></li>
116
113
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt (-6 / +2 lines)
Lines 80-91 $(document).ready(function() { Link Here
80
            <label for="itemtype">Item type: </label>
80
            <label for="itemtype">Item type: </label>
81
            <select name="itemtype" id="itemtype">
81
            <select name="itemtype" id="itemtype">
82
                <option value="">-- All --</option>
82
                <option value="">-- All --</option>
83
                [% FOREACH itemtypeloo IN itemtypeloop %]
83
                [% FOREACH itemtype IN itemtypes %]
84
				[% IF ( itemtypeloo.selected ) %]
84
                    <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
85
                <option value="[% itemtypeloo.value %]" selected="selected">[% itemtypeloo.description %]</option>
86
[% ELSE %]
87
                <option value="[% itemtypeloo.value %]">[% itemtypeloo.description %]</option>
88
[% END %]
89
                [% END %]
85
                [% END %]
90
            </select>
86
            </select>
91
        </li>
87
        </li>
(-)a/labels/label-item-search.pl (-5 / +8 lines)
Lines 31-41 use C4::Context; Link Here
31
use C4::Search qw(SimpleSearch);
31
use C4::Search qw(SimpleSearch);
32
use C4::Biblio qw(TransformMarcToKoha);
32
use C4::Biblio qw(TransformMarcToKoha);
33
use C4::Items qw(GetItemInfosOf get_itemnumbers_of);
33
use C4::Items qw(GetItemInfosOf get_itemnumbers_of);
34
use C4::Koha qw(GetItemTypes);
35
use C4::Creators::Lib qw(html_table);
34
use C4::Creators::Lib qw(html_table);
36
use C4::Debug;
35
use C4::Debug;
37
use Koha::DateUtils;
36
use Koha::DateUtils;
38
37
38
use Koha::ItemTypes;
39
use Koha::SearchEngine::Search;
39
use Koha::SearchEngine::Search;
40
40
41
BEGIN {
41
BEGIN {
Lines 251-262 else { Link Here
251
            debug           => 1,
251
            debug           => 1,
252
        }
252
        }
253
    );
253
    );
254
    my $itemtypes = GetItemTypes;
254
    my $itemtypes = Koha::ItemTypes->search;
255
    my @itemtypeloop;
255
    my @itemtypeloop;
256
    foreach my $thisitemtype ( keys %$itemtypes ) {
256
    while ( my $itemtype = $itemtypes->next ) {
257
        # FIXME This must be improved:
258
        # - pass the iterator to the template
259
        # - display the translated_description
257
        my %row = (
260
        my %row = (
258
            value       => $thisitemtype,
261
            value       => $itemtype->itemtype,
259
            description => $itemtypes->{$thisitemtype}->{'description'},
262
            description => $itemtype->description,
260
        );
263
        );
261
        push @itemtypeloop, \%row;
264
        push @itemtypeloop, \%row;
262
    }
265
    }
(-)a/opac/opac-ISBDdetail.pl (-1 / +2 lines)
Lines 53-58 use C4::Acquisition; Link Here
53
use C4::Serials;    # uses getsubscriptionfrom biblionumber
53
use C4::Serials;    # uses getsubscriptionfrom biblionumber
54
use C4::Koha;
54
use C4::Koha;
55
use C4::Members;    # GetMember
55
use C4::Members;    # GetMember
56
use Koha::ItemTypes;
56
use Koha::RecordProcessor;
57
use Koha::RecordProcessor;
57
58
58
59
Lines 162-168 my $res = GetISBDView({ Link Here
162
    'framework' => $framework
163
    'framework' => $framework
163
});
164
});
164
165
165
my $itemtypes = GetItemTypes();
166
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
166
my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
167
my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
167
for my $itm (@items) {
168
for my $itm (@items) {
168
    $norequests = 0
169
    $norequests = 0
(-)a/opac/opac-detail.pl (-2 / +3 lines)
Lines 49-54 use C4::HTML5Media; Link Here
49
use C4::CourseReserves qw(GetItemCourseReservesInfo);
49
use C4::CourseReserves qw(GetItemCourseReservesInfo);
50
use Koha::RecordProcessor;
50
use Koha::RecordProcessor;
51
use Koha::AuthorisedValues;
51
use Koha::AuthorisedValues;
52
use Koha::ItemTypes;
52
use Koha::Virtualshelves;
53
use Koha::Virtualshelves;
53
use Koha::Ratings;
54
use Koha::Ratings;
54
use Koha::Reviews;
55
use Koha::Reviews;
Lines 205-211 if ($session->param('busc')) { Link Here
205
        my ($arrParamsBusc, $offset, $results_per_page) = @_;
206
        my ($arrParamsBusc, $offset, $results_per_page) = @_;
206
207
207
        my $expanded_facet = $arrParamsBusc->{'expand'};
208
        my $expanded_facet = $arrParamsBusc->{'expand'};
208
        my $itemtypes = GetItemTypes;
209
        my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
209
        my @servers;
210
        my @servers;
210
        @servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
211
        @servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
211
        @servers = ("biblioserver") unless (@servers);
212
        @servers = ("biblioserver") unless (@servers);
Lines 537-543 my $HideMARC = $record_processor->filters->[0]->should_hide_marc( Link Here
537
        interface     => 'opac',
538
        interface     => 'opac',
538
    } );
539
    } );
539
540
540
my $itemtypes = GetItemTypes();
541
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
541
# imageurl:
542
# imageurl:
542
my $itemtype = $dat->{'itemtype'};
543
my $itemtype = $dat->{'itemtype'};
543
if ( $itemtype ) {
544
if ( $itemtype ) {
(-)a/opac/opac-readingrecord.pl (-1 / +3 lines)
Lines 32-37 use MARC::Record; Link Here
32
use C4::Output;
32
use C4::Output;
33
use C4::Charset qw(StripNonXmlChars);
33
use C4::Charset qw(StripNonXmlChars);
34
34
35
use Koha::ItemTypes;
36
35
my $query = new CGI;
37
my $query = new CGI;
36
38
37
# if opacreadinghistory is disabled, leave immediately
39
# if opacreadinghistory is disabled, leave immediately
Lines 55-61 my ( $borr ) = GetMember( borrowernumber => $borrowernumber ); Link Here
55
57
56
$template->param(%{$borr});
58
$template->param(%{$borr});
57
59
58
my $itemtypes = GetItemTypes();
60
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
59
61
60
# get the record
62
# get the record
61
my $order = $query->param('order') || '';
63
my $order = $query->param('order') || '';
(-)a/opac/opac-reserve.pl (-6 / +7 lines)
Lines 33-38 use C4::Members; Link Here
33
use C4::Overdues;
33
use C4::Overdues;
34
use C4::Debug;
34
use C4::Debug;
35
use Koha::DateUtils;
35
use Koha::DateUtils;
36
use Koha::ItemTypes;
36
use Koha::Libraries;
37
use Koha::Libraries;
37
use Koha::Patrons;
38
use Koha::Patrons;
38
use Date::Calc qw/Today Date_to_Days/;
39
use Date::Calc qw/Today Date_to_Days/;
Lines 90-96 if ( $reservefee > 0){ Link Here
90
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$reservefee));
91
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$reservefee));
91
}
92
}
92
93
93
my $itemTypes = GetItemTypes();
94
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
94
95
95
# There are two ways of calling this script, with a single biblio num
96
# There are two ways of calling this script, with a single biblio num
96
# or multiple biblio nums.
97
# or multiple biblio nums.
Lines 399-412 foreach my $biblioNum (@biblionumbers) { Link Here
399
    $biblioLoopIter{mandatorynotes}=0; #FIXME: For future use
400
    $biblioLoopIter{mandatorynotes}=0; #FIXME: For future use
400
401
401
    if (!$itemLevelTypes && $biblioData->{itemtype}) {
402
    if (!$itemLevelTypes && $biblioData->{itemtype}) {
402
        $biblioLoopIter{translated_description} = $itemTypes->{$biblioData->{itemtype}}{translated_description};
403
        $biblioLoopIter{translated_description} = $itemtypes->{$biblioData->{itemtype}}{translated_description};
403
        $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemTypes->{$biblioData->{itemtype}}{imageurl};
404
        $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}{imageurl};
404
    }
405
    }
405
406
406
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
407
    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
407
        if ($itemLevelTypes && $itemInfo->{itype}) {
408
        if ($itemLevelTypes && $itemInfo->{itype}) {
408
            $itemInfo->{translated_description} = $itemTypes->{$itemInfo->{itype}}{translated_description};
409
            $itemInfo->{translated_description} = $itemtypes->{$itemInfo->{itype}}{translated_description};
409
            $itemInfo->{imageurl} = getitemtypeimagesrc() . "/". $itemTypes->{$itemInfo->{itype}}{imageurl};
410
            $itemInfo->{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$itemInfo->{itype}}{imageurl};
410
        }
411
        }
411
412
412
        if (!$itemInfo->{'notforloan'} && !($itemInfo->{'itemnotforloan'} > 0)) {
413
        if (!$itemInfo->{'notforloan'} && !($itemInfo->{'itemnotforloan'} > 0)) {
Lines 522-528 foreach my $biblioNum (@biblionumbers) { Link Here
522
            $numCopiesAvailable++;
523
            $numCopiesAvailable++;
523
        }
524
        }
524
525
525
        $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
526
        $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itemInfo->{itype} }{imageurl} );
526
527
527
    # Show serial enumeration when needed
528
    # Show serial enumeration when needed
528
        if ($itemLoopIter->{enumchron}) {
529
        if ($itemLoopIter->{enumchron}) {
(-)a/opac/opac-search.pl (-2 lines)
Lines 229-236 foreach my $itemtype ( keys %{$itemtypes} ) { Link Here
229
    $itemtypes->{$itemtype}->{translated_description} =
229
    $itemtypes->{$itemtype}->{translated_description} =
230
            ( $translated_description ) ? $translated_description : $itemtypes->{$itemtype}->{description};
230
            ( $translated_description ) ? $translated_description : $itemtypes->{$itemtype}->{description};
231
}
231
}
232
# Load the Type stuff without search categories for facets
233
my $itemtypes_nocategory = GetItemTypes;
234
# the index parameter is different for item-level itemtypes
232
# the index parameter is different for item-level itemtypes
235
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
233
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
236
my @advancedsearchesloop;
234
my @advancedsearchesloop;
(-)a/opac/opac-topissues.pl (-2 lines)
Lines 48-55 if ( ! C4::Context->preference('OpacTopissue') ) { Link Here
48
    exit;
48
    exit;
49
}
49
}
50
50
51
my $itemtypes = GetItemTypes();
52
53
my ($template, $borrowernumber, $cookie) = get_template_and_user(
51
my ($template, $borrowernumber, $cookie) = get_template_and_user(
54
    {
52
    {
55
        template_name   => 'opac-topissues.tt',
53
        template_name   => 'opac-topissues.tt',
(-)a/opac/opac-user.pl (-1 / +2 lines)
Lines 36-41 use C4::Letters; Link Here
36
use Koha::DateUtils;
36
use Koha::DateUtils;
37
use Koha::Holds;
37
use Koha::Holds;
38
use Koha::Database;
38
use Koha::Database;
39
use Koha::ItemTypes;
39
use Koha::Patron::Messages;
40
use Koha::Patron::Messages;
40
use Koha::Patron::Discharge;
41
use Koha::Patron::Discharge;
41
use Koha::Patrons;
42
use Koha::Patrons;
Lines 174-180 my $count = 0; Link Here
174
my $overdues_count = 0;
175
my $overdues_count = 0;
175
my @overdues;
176
my @overdues;
176
my @issuedat;
177
my @issuedat;
177
my $itemtypes = GetItemTypes();
178
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
178
my $issues = GetPendingIssues($borrowernumber);
179
my $issues = GetPendingIssues($borrowernumber);
179
if ($issues){
180
if ($issues){
180
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
181
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
(-)a/reports/acquisitions_stats.pl (-3 / +3 lines)
Lines 27-32 use C4::Output; Link Here
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Biblio;
29
use C4::Biblio;
30
use Koha::ItemTypes;
30
use Koha::DateUtils;
31
use Koha::DateUtils;
31
use Koha::Libraries;
32
use Koha::Libraries;
32
33
Lines 124-131 else { Link Here
124
    $req->execute;
125
    $req->execute;
125
    my $booksellers = $req->fetchall_arrayref({});
126
    my $booksellers = $req->fetchall_arrayref({});
126
127
127
    my $itemtypes = GetItemTypes( style => 'array' );
128
129
    $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
128
    $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
130
    $req->execute;
129
    $req->execute;
131
    my @bselect;
130
    my @bselect;
Lines 195-203 else { Link Here
195
        $ccode_avlist = GetAuthorisedValues($ccode_subfield_structure->{authorised_value});
194
        $ccode_avlist = GetAuthorisedValues($ccode_subfield_structure->{authorised_value});
196
    }
195
    }
197
196
197
    my $itemtypes = Koha::ItemTypes->search_with_localization;
198
    $template->param(
198
    $template->param(
199
        booksellers   => $booksellers,
199
        booksellers   => $booksellers,
200
        itemtypes     => $itemtypes,
200
        itemtypes     => $itemtypes, # FIXME Should use the TT plugin instead
201
        Budgets       => $Budgets,
201
        Budgets       => $Budgets,
202
        hassort1      => $hassort1,
202
        hassort1      => $hassort1,
203
        hassort2      => $hassort2,
203
        hassort2      => $hassort2,
(-)a/reports/bor_issues_top.pl (-11 / +3 lines)
Lines 30-35 use C4::Reports; Link Here
30
use C4::Debug;
30
use C4::Debug;
31
31
32
use Koha::DateUtils;
32
use Koha::DateUtils;
33
use Koha::ItemTypes;
33
use Koha::Patron::Categories;
34
use Koha::Patron::Categories;
34
35
35
=head1 NAME
36
=head1 NAME
Lines 110-130 my @values; Link Here
110
my @mime  = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation
111
my @mime  = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation
111
my $delims = GetDelimiterChoices;
112
my $delims = GetDelimiterChoices;
112
113
113
my $itemtypes = GetItemTypes;
114
my @itemtypeloop;
115
foreach (sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) {
116
	my %row = (value => $_,
117
               translated_description => $itemtypes->{$_}->{translated_description},
118
              );
119
    push @itemtypeloop, \%row;
120
}
121
122
my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
114
my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
123
115
my $itemtypes = Koha::ItemTypes->search_with_localization;
124
$template->param(
116
$template->param(
125
	    mimeloop => \@mime,
117
	    mimeloop => \@mime,
126
	  CGIseplist => $delims,
118
	  CGIseplist => $delims,
127
	itemtypeloop => \@itemtypeloop,
119
      itemtypes => $itemtypes,
128
patron_categories => $patron_categories,
120
patron_categories => $patron_categories,
129
);
121
);
130
output_html_with_http_headers $input, $cookie, $template->output;
122
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/reports/cat_issues_top.pl (-9 / +3 lines)
Lines 29-34 use C4::Circulation; Link Here
29
use C4::Reports;
29
use C4::Reports;
30
use C4::Members;
30
use C4::Members;
31
use Koha::DateUtils;
31
use Koha::DateUtils;
32
use Koha::ItemTypes;
32
33
33
=head1 NAME
34
=head1 NAME
34
35
Lines 118-131 if ($do_it) { Link Here
118
    my $CGIsepChoice=GetDelimiterChoices;
119
    my $CGIsepChoice=GetDelimiterChoices;
119
120
120
    #doctype
121
    #doctype
121
    my $itemtypes = GetItemTypes;
122
    my $itemtypes = Koha::ItemTypes->search_with_localization;
122
    my @itemtypeloop;
123
    foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) {
124
            my %row =(value => $thisitemtype,
125
                      description => $itemtypes->{$thisitemtype}->{translated_description},
126
                            );
127
            push @itemtypeloop, \%row;
128
    }
129
123
130
    #ccode
124
    #ccode
131
    my $ccodes = GetAuthorisedValues('CCODE');
125
    my $ccodes = GetAuthorisedValues('CCODE');
Lines 156-162 if ($do_it) { Link Here
156
    $template->param(
150
    $template->param(
157
                    CGIextChoice => $CGIextChoice,
151
                    CGIextChoice => $CGIextChoice,
158
                    CGIsepChoice => $CGIsepChoice,
152
                    CGIsepChoice => $CGIsepChoice,
159
                    itemtypeloop =>\@itemtypeloop,
153
                    itemtypes => $itemtypes,
160
                    ccodeloop =>\@ccodeloop,
154
                    ccodeloop =>\@ccodeloop,
161
                    shelvinglocloop =>\@shelvinglocloop,
155
                    shelvinglocloop =>\@shelvinglocloop,
162
                    patron_categories => $patron_categories,
156
                    patron_categories => $patron_categories,
(-)a/reports/catalogue_out.pl (-17 / +2 lines)
Lines 25-31 use C4::Auth; Link Here
25
use C4::Context;
25
use C4::Context;
26
use C4::Debug;
26
use C4::Debug;
27
use C4::Output;
27
use C4::Output;
28
use C4::Koha;      # GetItemTypes
29
# use Date::Manip;  # TODO: add not borrowed since date X criteria
28
# use Date::Manip;  # TODO: add not borrowed since date X criteria
30
use Data::Dumper;
29
use Data::Dumper;
31
30
Lines 60-82 if ($do_it) { Link Here
60
    exit;    # in either case, exit after do_it
59
    exit;    # in either case, exit after do_it
61
}
60
}
62
61
63
# Displaying choices (i.e., not do_it)
62
my $itemtypes = Koha::ItemTypes->search_with_localization;
64
my $itemtypes = GetItemTypes();
65
my @itemtypeloop;
66
foreach (
67
    sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} }
68
    keys %$itemtypes
69
  )
70
{
71
    push @itemtypeloop,
72
      {
73
        value       => $_,
74
        description => $itemtypes->{$_}->{translated_description},
75
      };
76
}
77
78
$template->param(
63
$template->param(
79
    itemtypeloop => \@itemtypeloop,
64
    itemtypes => $itemtypes,
80
);
65
);
81
output_html_with_http_headers $input, $cookie, $template->output;
66
output_html_with_http_headers $input, $cookie, $template->output;
82
67
(-)a/reports/catalogue_stats.pl (-1 / +2 lines)
Lines 31-36 use C4::Biblio qw/GetMarcSubfieldStructureFromKohaField/; Link Here
31
31
32
use Koha::AuthorisedValues;
32
use Koha::AuthorisedValues;
33
use Koha::DateUtils;
33
use Koha::DateUtils;
34
use Koha::ItemTypes;
34
35
35
=head1 NAME
36
=head1 NAME
36
37
Lines 120-126 if ($do_it) { Link Here
120
	my $req;
121
	my $req;
121
	my @select;
122
	my @select;
122
123
123
    my $itemtypes = GetItemTypes( style => 'array' );
124
    my $itemtypes = Koha::ItemTypes->search_with_localization;
124
125
125
    my @authvals = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } );
126
    my @authvals = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } );
126
    my @locations = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } );
127
    my @locations = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } );
(-)a/reports/issues_avg_stats.pl (-1 / +2 lines)
Lines 28-33 use C4::Koha; Link Here
28
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Reports;
29
use C4::Reports;
30
use Koha::DateUtils;
30
use Koha::DateUtils;
31
use Koha::ItemTypes;
31
use Koha::Patron::Categories;
32
use Koha::Patron::Categories;
32
use Date::Calc qw(Delta_Days);
33
use Date::Calc qw(Delta_Days);
33
34
Lines 119-125 if ($do_it) { Link Here
119
} else {
120
} else {
120
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
121
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
121
122
122
    my $itemtypes = GetItemTypes( style => 'array' );
123
    my $itemtypes = Koha::ItemTypes->search_with_localization;
123
124
124
    my $dbh = C4::Context->dbh;
125
    my $dbh = C4::Context->dbh;
125
    my $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
126
    my $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
(-)a/reports/issues_stats.pl (-6 / +3 lines)
Lines 34-39 use C4::Members; Link Here
34
34
35
use Koha::AuthorisedValues;
35
use Koha::AuthorisedValues;
36
use Koha::DateUtils;
36
use Koha::DateUtils;
37
use Koha::ItemTypes;
37
use C4::Members::AttributeTypes;
38
use C4::Members::AttributeTypes;
38
39
39
=head1 NAME
40
=head1 NAME
Lines 87-93 $sep = "\t" if ($sep eq 'tabulation'); Link Here
87
$template->param(do_it => $do_it,
88
$template->param(do_it => $do_it,
88
);
89
);
89
90
90
our $itemtypes = GetItemTypes();
91
our @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
91
our @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
92
92
93
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
93
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
Lines 146-155 my %labels; Link Here
146
my %select;
146
my %select;
147
147
148
# create itemtype arrayref for <select>.
148
# create itemtype arrayref for <select>.
149
my @itemtypeloop;
149
our $itemtypes = Koha::ItemTypes->search_with_localization;
150
for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) {
151
    push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ;
152
}
153
150
154
    # location list
151
    # location list
155
my @locations;
152
my @locations;
Lines 181-187 foreach my $attribute_type (@attribute_types) { Link Here
181
178
182
$template->param(
179
$template->param(
183
    categoryloop => \@patron_categories,
180
    categoryloop => \@patron_categories,
184
    itemtypeloop => \@itemtypeloop,
181
    itemtypes    => $itemtypes,
185
    locationloop => \@locations,
182
    locationloop => \@locations,
186
    ccodeloop    => \@ccodes,
183
    ccodeloop    => \@ccodes,
187
    hassort1     => $hassort1,
184
    hassort1     => $hassort1,
(-)a/reports/itemslost.pl (-11 / +2 lines)
Lines 33-39 use C4::Auth; Link Here
33
use C4::Output;
33
use C4::Output;
34
use C4::Biblio;
34
use C4::Biblio;
35
use C4::Items;
35
use C4::Items;
36
use C4::Koha;                  # GetItemTypes
37
use Koha::DateUtils;
36
use Koha::DateUtils;
38
37
39
my $query = new CGI;
38
my $query = new CGI;
Lines 80-100 if ( $get_items ) { Link Here
80
}
79
}
81
80
82
# getting all itemtypes
81
# getting all itemtypes
83
my $itemtypes = &GetItemTypes();
82
my $itemtypes = Koha::ItemTypes->search_with_localization;
84
my @itemtypesloop;
85
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes ) {
86
    my %row = (
87
        value       => $thisitemtype,
88
        description => $itemtypes->{$thisitemtype}->{'translated_description'},
89
    );
90
    push @itemtypesloop, \%row;
91
}
92
83
93
# get lost statuses
84
# get lost statuses
94
my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
85
my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
95
86
96
$template->param(
87
$template->param(
97
                  itemtypeloop   => \@itemtypesloop,
88
                  itemtypes => $itemtypes,
98
                  loststatusloop => $lost_status_loop,
89
                  loststatusloop => $lost_status_loop,
99
);
90
);
100
91
(-)a/reports/reserves_stats.pl (-9 / +4 lines)
Lines 30-35 use C4::Reports; Link Here
30
use C4::Members;
30
use C4::Members;
31
use Koha::AuthorisedValues;
31
use Koha::AuthorisedValues;
32
use Koha::DateUtils;
32
use Koha::DateUtils;
33
use Koha::ItemTypes;
33
use Koha::Libraries;
34
use Koha::Libraries;
34
use Koha::Patron::Categories;
35
use Koha::Patron::Categories;
35
use List::MoreUtils qw/any/;
36
use List::MoreUtils qw/any/;
Lines 74-80 $sep = "\t" if ($sep eq 'tabulation'); Link Here
74
$template->param(do_it => $do_it,
75
$template->param(do_it => $do_it,
75
);
76
);
76
77
77
my $itemtypes = GetItemTypes();
78
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
78
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
79
79
80
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
80
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
Lines 130-140 my @values; Link Here
130
my %labels;
130
my %labels;
131
my %select;
131
my %select;
132
132
133
# create itemtype arrayref for <select>.
133
my $itemtypes = Koha::ItemTypes->search_with_localization;
134
my @itemtypeloop;
135
for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) {
136
	push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ;
137
}
138
134
139
    # location list
135
    # location list
140
my @locations;
136
my @locations;
Lines 153-159 my $CGIsepChoice=GetDelimiterChoices; Link Here
153
 
149
 
154
$template->param(
150
$template->param(
155
    categoryloop => \@patron_categories,
151
    categoryloop => \@patron_categories,
156
	itemtypeloop => \@itemtypeloop,
152
    itemtypes => $itemtypes,
157
	locationloop => \@locations,
153
	locationloop => \@locations,
158
	   ccodeloop => \@ccodes,
154
	   ccodeloop => \@ccodes,
159
	hassort1=> $hassort1,
155
	hassort1=> $hassort1,
Lines 319-331 sub display_value { Link Here
319
    my ( $crit, $value ) = @_;
315
    my ( $crit, $value ) = @_;
320
    my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
316
    my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
321
    my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
317
    my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
322
    my $itemtypes = GetItemTypes();
323
    my $Bsort1 = GetAuthorisedValues("Bsort1");
318
    my $Bsort1 = GetAuthorisedValues("Bsort1");
324
    my $Bsort2 = GetAuthorisedValues("Bsort2");
319
    my $Bsort2 = GetAuthorisedValues("Bsort2");
325
    my $display_value =
320
    my $display_value =
326
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
321
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
327
      : ( $crit =~ /location/ )      ? $locations->{$value}
322
      : ( $crit =~ /location/ )      ? $locations->{$value}
328
      : ( $crit =~ /itemtype/ )      ? $itemtypes->{$value}->{description}
323
      : ( $crit =~ /itemtype/ )      ? Koha::ItemTypes->find( $value )->translated_description
329
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
324
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
330
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
325
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
331
      :                                $value;    # default fallback
326
      :                                $value;    # default fallback
(-)a/reserve/request.pl (-1 / +2 lines)
Lines 44-49 use C4::Members; Link Here
44
use C4::Search;		# enabled_staff_search_views
44
use C4::Search;		# enabled_staff_search_views
45
use Koha::DateUtils;
45
use Koha::DateUtils;
46
use Koha::Holds;
46
use Koha::Holds;
47
use Koha::ItemTypes;
47
use Koha::Libraries;
48
use Koha::Libraries;
48
use Koha::Patrons;
49
use Koha::Patrons;
49
50
Lines 63-69 my $multihold = $input->param('multi_hold'); Link Here
63
$template->param(multi_hold => $multihold);
64
$template->param(multi_hold => $multihold);
64
my $showallitems = $input->param('showallitems');
65
my $showallitems = $input->param('showallitems');
65
66
66
my $itemtypes = GetItemTypes();
67
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
67
68
68
# Select borrowers infos
69
# Select borrowers infos
69
my $findborrower = $input->param('findborrower');
70
my $findborrower = $input->param('findborrower');
(-)a/serials/subscription-add.pl (-1 / +3 lines)
Lines 32-37 use C4::Serials::Numberpattern; Link Here
32
use C4::Letters;
32
use C4::Letters;
33
use Koha::AdditionalField;
33
use Koha::AdditionalField;
34
use Koha::DateUtils;
34
use Koha::DateUtils;
35
use Koha::ItemTypes;
35
use Carp;
36
use Carp;
36
37
37
#use Smart::Comments;
38
#use Smart::Comments;
Lines 141-148 for my $field ( @$additional_fields ) { Link Here
141
}
142
}
142
$template->param( additional_fields_for_subscription => $additional_fields );
143
$template->param( additional_fields_for_subscription => $additional_fields );
143
144
144
my $typeloop = GetItemTypes();
145
my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
145
146
147
# FIXME We should use the translated_description for item types
146
my @typearg =
148
my @typearg =
147
    map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{itemtype} and $_ eq $subs->{itemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
149
    map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{itemtype} and $_ eq $subs->{itemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
148
my @previoustypearg =
150
my @previoustypearg =
(-)a/serials/subscription-bib-search.pl (-1 / +4 lines)
Lines 58-63 use C4::Search; Link Here
58
use C4::Biblio;
58
use C4::Biblio;
59
use C4::Debug;
59
use C4::Debug;
60
60
61
use Koha::ItemTypes;
61
use Koha::SearchEngine;
62
use Koha::SearchEngine;
62
use Koha::SearchEngine::Search;
63
use Koha::SearchEngine::Search;
63
64
Lines 196-203 else { Link Here
196
    );
197
    );
197
198
198
    # load the itemtypes
199
    # load the itemtypes
199
    my $itemtypes = GetItemTypes();
200
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
200
    my @itemtypesloop;
201
    my @itemtypesloop;
202
    # FIXME This is uselessly complex, the iterator should be send to the template
203
    # FIXME The translated_description should be used
201
    foreach my $thisitemtype (
204
    foreach my $thisitemtype (
202
        sort {
205
        sort {
203
            $itemtypes->{$a}->{'description'}
206
            $itemtypes->{$a}->{'description'}
(-)a/suggestion/suggestion.pl (-1 lines)
Lines 24-30 use CGI qw ( -utf8 ); Link Here
24
use C4::Auth;    # get_template_and_user
24
use C4::Auth;    # get_template_and_user
25
use C4::Output;
25
use C4::Output;
26
use C4::Suggestions;
26
use C4::Suggestions;
27
use C4::Koha; #GetItemTypes
28
use C4::Budgets;
27
use C4::Budgets;
29
use C4::Search;
28
use C4::Search;
30
use C4::Members;
29
use C4::Members;
(-)a/svc/bib_profile (-1 / +2 lines)
Lines 25-30 use CGI qw ( -utf8 ); Link Here
25
use C4::Auth qw/check_api_auth/;
25
use C4::Auth qw/check_api_auth/;
26
use C4::Context;
26
use C4::Context;
27
use C4::Koha;
27
use C4::Koha;
28
use Koha::ItemTypes;
28
use XML::Simple;
29
use XML::Simple;
29
30
30
my $query = new CGI;
31
my $query = new CGI;
Lines 113-119 sub _get_bib_number_tag { Link Here
113
114
114
sub _get_biblioitem_itemtypes {
115
sub _get_biblioitem_itemtypes {
115
    my $result = shift;
116
    my $result = shift;
116
    my $itemtypes = GetItemTypes;
117
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
117
    my $sth = $dbh->prepare_cached("SELECT tagfield, tagsubfield
118
    my $sth = $dbh->prepare_cached("SELECT tagfield, tagsubfield
118
                                    FROM marc_subfield_structure 
119
                                    FROM marc_subfield_structure 
119
                                    WHERE frameworkcode = '' 
120
                                    WHERE frameworkcode = '' 
(-)a/tools/batchMod.pl (-4 / +6 lines)
Lines 34-40 use C4::Debug; Link Here
34
use C4::Members;
34
use C4::Members;
35
use MARC::File::XML;
35
use MARC::File::XML;
36
use List::MoreUtils qw/uniq/;
36
use List::MoreUtils qw/uniq/;
37
37
use Koha::DateUtils;
38
use Koha::DateUtils;
39
use Koha::ItemTypes;
38
40
39
my $input = new CGI;
41
my $input = new CGI;
40
my $dbh = C4::Context->dbh;
42
my $dbh = C4::Context->dbh;
Lines 359-368 foreach my $tag (sort keys %{$tagslib}) { Link Here
359
    }
361
    }
360
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
362
    elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
361
        push @authorised_values, "";
363
        push @authorised_values, "";
362
        my $itemtypes = GetItemTypes( style => 'array' );
364
        my $itemtypes = Koha::ItemTypes->search_with_localization;
363
        for my $itemtype ( @$itemtypes ) {
365
        while ( my $itemtype = $itemtypes->next ) {
364
            push @authorised_values, $itemtype->{itemtype};
366
            push @authorised_values, $itemtype->itemtype;
365
            $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
367
            $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
366
        }
368
        }
367
        $value = "";
369
        $value = "";
368
370
(-)a/tools/export.pl (-12 / +3 lines)
Lines 21-27 use CGI qw ( -utf8 ); Link Here
21
use MARC::File::XML;
21
use MARC::File::XML;
22
use List::MoreUtils qw(uniq);
22
use List::MoreUtils qw(uniq);
23
use C4::Auth;
23
use C4::Auth;
24
use C4::Koha;               # GetItemTypes
25
use C4::Output;
24
use C4::Output;
26
25
27
use Koha::Authority::Types;
26
use Koha::Authority::Types;
Lines 30-35 use Koha::CsvProfiles; Link Here
30
use Koha::Database;
29
use Koha::Database;
31
use Koha::DateUtils qw( dt_from_string output_pref );
30
use Koha::DateUtils qw( dt_from_string output_pref );
32
use Koha::Exporter::Record;
31
use Koha::Exporter::Record;
32
use Koha::ItemTypes;
33
use Koha::Libraries;
33
use Koha::Libraries;
34
34
35
my $query = new CGI;
35
my $query = new CGI;
Lines 259-273 if ( $op eq "export" ) { Link Here
259
259
260
else {
260
else {
261
261
262
    my $itemtypes = GetItemTypes;
262
    my $itemtypes = Koha::ItemTypes->search_with_localization;
263
    my @itemtypesloop;
264
    foreach my $thisitemtype ( sort keys %$itemtypes ) {
265
        my %row = (
266
            value       => $thisitemtype,
267
            description => $itemtypes->{$thisitemtype}->{translated_description},
268
        );
269
        push @itemtypesloop, \%row;
270
    }
271
263
272
    my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
264
    my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
273
265
Lines 298-304 else { Link Here
298
290
299
    $template->param(
291
    $template->param(
300
        libraries                => $libraries,
292
        libraries                => $libraries,
301
        itemtypeloop             => \@itemtypesloop,
293
        itemtypes                => $itemtypes,
302
        authority_types          => $authority_types,
294
        authority_types          => $authority_types,
303
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
295
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
304
        csv_profiles             => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
296
        csv_profiles             => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
305
- 

Return to bug 17835