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

(-)a/C4/Biblio.pm (-1 / +3 lines)
Lines 41-46 use C4::Debug; Link Here
41
use Koha::Caches;
41
use Koha::Caches;
42
use Koha::Authority::Types;
42
use Koha::Authority::Types;
43
use Koha::Acquisition::Currencies;
43
use Koha::Acquisition::Currencies;
44
use Koha::ItemTypes;
44
use Koha::SearchEngine;
45
use Koha::SearchEngine;
45
use Koha::Libraries;
46
use Koha::Libraries;
46
47
Lines 1709-1715 sub GetAuthorisedValueDesc { Link Here
1709
1710
1710
        #---- itemtypes
1711
        #---- itemtypes
1711
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1712
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1712
            return getitemtypeinfo($value)->{translated_description};
1713
            my $itemtype = Koha::ItemTypes->find( $value );
1714
            return $itemtype ? $itemtype->translated_description : q||;
1713
        }
1715
        }
1714
1716
1715
        #---- "true" authorized value
1717
        #---- "true" authorized value
(-)a/Koha/Template/Plugin/ItemTypes.pm (-5 / +1 lines)
Lines 22-36 use Modern::Perl; Link Here
22
use Template::Plugin;
22
use Template::Plugin;
23
use base qw( Template::Plugin );
23
use base qw( Template::Plugin );
24
24
25
use C4::Koha;
26
use Koha::ItemTypes;
25
use Koha::ItemTypes;
27
26
28
sub GetDescription {
27
sub GetDescription {
29
    my ( $self, $itemtype ) = @_;
28
    my ( $self, $itemtype ) = @_;
30
29
    return Koha::ItemTypes->find( $itemtype )->translated_description;
31
    $itemtype = C4::Koha::getitemtypeinfo( $itemtype );
32
    return $itemtype->{translated_description};
33
34
}
30
}
35
31
36
sub Get {
32
sub Get {
(-)a/acqui/orderreceive.pl (-2 / +3 lines)
Lines 74-79 use C4::Suggestions; Link Here
74
74
75
use Koha::Acquisition::Booksellers;
75
use Koha::Acquisition::Booksellers;
76
use Koha::DateUtils qw( dt_from_string );
76
use Koha::DateUtils qw( dt_from_string );
77
use Koha::ItemTypes;
77
78
78
my $input      = new CGI;
79
my $input      = new CGI;
79
80
Lines 143-150 if ($AcqCreateItem eq 'receiving') { Link Here
143
        $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
144
        $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
144
        $item->{materials} = $descriptions->{lib} // '';
145
        $item->{materials} = $descriptions->{lib} // '';
145
146
146
        my $itemtype = getitemtypeinfo($item->{itype});
147
        my $itemtype = Koha::ItemsTypes->find( $item->{itype} );
147
        $item->{itemtype} = $itemtype->{description};
148
        $item->{itemtype} = $itemtype->description; # FIXME Should not it be translated_description?
148
        push @items, $item;
149
        push @items, $item;
149
    }
150
    }
150
    $template->param(items => \@items);
151
    $template->param(items => \@items);
(-)a/catalogue/getitem-ajax.pl (-2 / +3 lines)
Lines 29-34 use C4::Output; Link Here
29
use Koha::Libraries;
29
use Koha::Libraries;
30
30
31
use Koha::AuthorisedValues;
31
use Koha::AuthorisedValues;
32
use Koha::ItemTypes;
32
33
33
my $cgi = new CGI;
34
my $cgi = new CGI;
34
35
Lines 71-78 if($itemnumber) { Link Here
71
    $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
72
    $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
72
    $item->{materials} = $descriptions->{lib} // '';
73
    $item->{materials} = $descriptions->{lib} // '';
73
74
74
    my $itemtype = getitemtypeinfo($item->{itype});
75
    my $itemtype = Koha::ItemTypes->find( $item->{itype} );
75
    $item->{itemtype} = $itemtype->{description};
76
    $item->{itemtype} = $itemtype->description; # FIXME Should not it be translated_description?
76
}
77
}
77
78
78
my $json_text = to_json( $item, { utf8 => 1 } );
79
my $json_text = to_json( $item, { utf8 => 1 } );
(-)a/circ/transferstoreceive.pl (-2 / +3 lines)
Lines 36-41 use Date::Calc qw( Link Here
36
36
37
use C4::Koha;
37
use C4::Koha;
38
use C4::Reserves;
38
use C4::Reserves;
39
use Koha::ItemTypes;
39
use Koha::Libraries;
40
use Koha::Libraries;
40
41
41
my $input = new CGI;
42
my $input = new CGI;
Lines 87-96 while ( my $library = $libraries->next ) { Link Here
87
				$getransf{'diff'} = $diff;
88
				$getransf{'diff'} = $diff;
88
            }
89
            }
89
            my $gettitle     = GetBiblioFromItemNumber( $num->{'itemnumber'} );
90
            my $gettitle     = GetBiblioFromItemNumber( $num->{'itemnumber'} );
90
            my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $gettitle->{'itype'} : $gettitle->{'itemtype'} );
91
            my $itemtype = Koha::ItemTypes->find( (C4::Context->preference('item-level_itypes')) ? $gettitle->{'itype'} : $gettitle->{'itemtype'} );
91
92
92
            $getransf{'datetransfer'} = $num->{'datesent'};
93
            $getransf{'datetransfer'} = $num->{'datesent'};
93
            $getransf{'itemtype'} = $itemtypeinfo ->{'description'};
94
            $getransf{'itemtype'} = $itemtype->description; # FIXME Should not it be translated_description?
94
			foreach (qw(title author biblionumber itemnumber barcode homebranch holdingbranch itemcallnumber)) {
95
			foreach (qw(title author biblionumber itemnumber barcode homebranch holdingbranch itemcallnumber)) {
95
            	$getransf{$_} = $gettitle->{$_};
96
            	$getransf{$_} = $gettitle->{$_};
96
			}
97
			}
(-)a/circ/waitingreserves.pl (-2 / +4 lines)
Lines 37-42 use Date::Calc qw( Link Here
37
use C4::Reserves;
37
use C4::Reserves;
38
use C4::Koha;
38
use C4::Koha;
39
39
40
use Koha::ItemTypes;
41
40
my $input = new CGI;
42
my $input = new CGI;
41
43
42
my $item           = $input->param('itemnumber');
44
my $item           = $input->param('itemnumber');
Lines 104-110 foreach my $num (@getreserves) { Link Here
104
    # fix up item type for display
106
    # fix up item type for display
105
    $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
107
    $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
106
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
108
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
107
    my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
109
    my $itemtype = Koha::ItemTypes->find( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
108
    $getreserv{'waitingdate'} = $num->{'waitingdate'};
110
    $getreserv{'waitingdate'} = $num->{'waitingdate'};
109
    my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
111
    my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
110
112
Lines 113-119 foreach my $num (@getreserves) { Link Here
113
        $max_pickup_delay);
115
        $max_pickup_delay);
114
    my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
116
    my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
115
117
116
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
118
    $getreserv{'itemtype'}       = $itemtype->description; # FIXME Should not it be translated_description?
117
    $getreserv{'title'}          = $gettitle->{'title'};
119
    $getreserv{'title'}          = $gettitle->{'title'};
118
    $getreserv{'subtitle'}       = GetRecordValue('subtitle', GetMarcBiblio($gettitle->{'biblionumber'}), GetFrameworkCode($gettitle->{'biblionumber'}));
120
    $getreserv{'subtitle'}       = GetRecordValue('subtitle', GetMarcBiblio($gettitle->{'biblionumber'}), GetFrameworkCode($gettitle->{'biblionumber'}));
119
    $getreserv{'biblionumber'}   = $gettitle->{'biblionumber'};
121
    $getreserv{'biblionumber'}   = $gettitle->{'biblionumber'};
(-)a/members/summary-print.pl (-3 / +3 lines)
Lines 22-32 use CGI; Link Here
22
use C4::Auth;
22
use C4::Auth;
23
use C4::Output;
23
use C4::Output;
24
use C4::Members;
24
use C4::Members;
25
use C4::Koha qw( getitemtypeinfo );
26
use C4::Circulation qw( GetIssuingCharges );
25
use C4::Circulation qw( GetIssuingCharges );
27
use C4::Reserves;
26
use C4::Reserves;
28
use C4::Items;
27
use C4::Items;
29
use Koha::Holds;
28
use Koha::Holds;
29
use Koha::ItemTypes;
30
30
31
my $input          = CGI->new;
31
my $input          = CGI->new;
32
my $borrowernumber = $input->param('borrowernumber');
32
my $borrowernumber = $input->param('borrowernumber');
Lines 94-101 sub build_issue_data { Link Here
94
        my ( $charge, $itemtype ) =
94
        my ( $charge, $itemtype ) =
95
          GetIssuingCharges( $issue->{itemnumber}, $borrowernumber );
95
          GetIssuingCharges( $issue->{itemnumber}, $borrowernumber );
96
96
97
        my $itemtypeinfo = getitemtypeinfo($itemtype);
97
        my $itemtype = Koha::ItemTypes->find( $itemtype );
98
        $row{'itemtype_description'} = $itemtypeinfo->{description};
98
        $row{'itemtype_description'} = $itemtype->description; #FIXME Should not it be translated_description
99
99
100
        $row{'charge'} = sprintf( "%.2f", $charge );
100
        $row{'charge'} = sprintf( "%.2f", $charge );
101
101
(-)a/opac/opac-browser.pl (-1 lines)
Lines 32-38 use C4::Context; Link Here
32
use C4::Output;
32
use C4::Output;
33
use CGI qw ( -utf8 );
33
use CGI qw ( -utf8 );
34
use C4::Biblio;
34
use C4::Biblio;
35
use C4::Koha;       # use getitemtypeinfo
36
35
37
my $query = new CGI;
36
my $query = new CGI;
38
37
(-)a/opac/opac-search.pl (-1 / +2 lines)
Lines 52-57 use C4::Tags qw(get_tags); Link Here
52
use C4::SocialData;
52
use C4::SocialData;
53
use C4::External::OverDrive;
53
use C4::External::OverDrive;
54
54
55
use Koha::ItemTypes;
55
use Koha::LibraryCategories;
56
use Koha::LibraryCategories;
56
use Koha::Ratings;
57
use Koha::Ratings;
57
use Koha::Virtualshelves;
58
use Koha::Virtualshelves;
Lines 225-231 my $itemtypes = GetItemTypesCategorized; Link Here
225
# add translated_description to itemtypes
226
# add translated_description to itemtypes
226
foreach my $itemtype ( keys %{$itemtypes} ) {
227
foreach my $itemtype ( keys %{$itemtypes} ) {
227
    # Itemtypes search categories don't have (yet) translated descriptions, they are auth values
228
    # Itemtypes search categories don't have (yet) translated descriptions, they are auth values
228
    my $translated_description = getitemtypeinfo( $itemtype, 'opac' )->{translated_description};
229
    my $translated_description = Koha::ItemTypes->find( $itemtype )->translated_description;
229
    $itemtypes->{$itemtype}->{translated_description} =
230
    $itemtypes->{$itemtype}->{translated_description} =
230
            ( $translated_description ) ? $translated_description : $itemtypes->{$itemtype}->{description};
231
            ( $translated_description ) ? $translated_description : $itemtypes->{$itemtype}->{description};
231
}
232
}
(-)a/opac/opac-shelves.pl (-4 / +5 lines)
Lines 30-35 use C4::Tags qw( get_tags ); Link Here
30
use C4::XSLT;
30
use C4::XSLT;
31
31
32
use Koha::Biblioitems;
32
use Koha::Biblioitems;
33
use Koha::ItemTypes;
33
use Koha::Virtualshelves;
34
use Koha::Virtualshelves;
34
use Koha::RecordProcessor;
35
use Koha::RecordProcessor;
35
36
Lines 277-286 if ( $op eq 'view' ) { Link Here
277
278
278
                my $marcflavour = C4::Context->preference("marcflavour");
279
                my $marcflavour = C4::Context->preference("marcflavour");
279
                my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
280
                my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
280
                my $itemtypeinfo = getitemtypeinfo( $itemtype, 'opac' );
281
                $itemtype = Koha::ItemTypes->find( $itemtype );
281
                $this_item->{imageurl}          = $itemtypeinfo->{imageurl};
282
                $this_item->{imageurl}          = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl );
282
                $this_item->{description}       = $itemtypeinfo->{description};
283
                $this_item->{description}       = $itemtype->description; #FIXME Should not it be translated_description?
283
                $this_item->{notforloan}        = $itemtypeinfo->{notforloan};
284
                $this_item->{notforloan}        = $itemtype->notforloan;
284
                $this_item->{'coins'}           = GetCOinSBiblio($record);
285
                $this_item->{'coins'}           = GetCOinSBiblio($record);
285
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
286
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
286
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
287
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
(-)a/opac/opac-tags_subject.pl (-1 lines)
Lines 32-38 use C4::Context; Link Here
32
use C4::Output;
32
use C4::Output;
33
use CGI qw ( -utf8 );
33
use CGI qw ( -utf8 );
34
use C4::Biblio;
34
use C4::Biblio;
35
use C4::Koha;       # use getitemtypeinfo
36
35
37
my $query = new CGI;
36
my $query = new CGI;
38
37
(-)a/svc/checkouts (-2 / +3 lines)
Lines 31-36 use C4::Context; 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
my $input = new CGI;
36
my $input = new CGI;
36
37
Lines 148-154 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
148
    my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
149
    my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
149
      GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
150
      GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
150
151
151
    my $itemtype = C4::Koha::getitemtypeinfo( $item_level_itypes ? $c->{itype} : $c->{itemtype} );
152
    my $itemtype = Koha::ItemTypes->find( $item_level_itypes ? $c->{itype} : $c->{itemtype} );
152
    my $location;
153
    my $location;
153
    if ( $c->{location} ) {
154
    if ( $c->{location} ) {
154
        my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $c->{location} });
155
        my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $c->{location} });
Lines 170-176 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
170
        author               => $c->{author},
171
        author               => $c->{author},
171
        barcode              => $c->{barcode},
172
        barcode              => $c->{barcode},
172
        itemtype             => $item_level_itypes ? $c->{itype} : $c->{itemtype},
173
        itemtype             => $item_level_itypes ? $c->{itype} : $c->{itemtype},
173
        itemtype_description => $itemtype->{translated_description},
174
        itemtype_description => $itemtype->translated_description,
174
        location             => $location,
175
        location             => $location,
175
        homebranch           => $c->{homebranch},
176
        homebranch           => $c->{homebranch},
176
        itemnotes            => $c->{itemnotes},
177
        itemnotes            => $c->{itemnotes},
(-)a/svc/holds (-2 / +3 lines)
Lines 30-35 use C4::Context; Link Here
30
30
31
use Koha::DateUtils;
31
use Koha::DateUtils;
32
use Koha::Holds;
32
use Koha::Holds;
33
use Koha::ItemTypes;
33
use Koha::Libraries;
34
use Koha::Libraries;
34
35
35
my $input = new CGI;
36
my $input = new CGI;
Lines 75-82 while ( my $h = $holds_rs->next() ) { Link Here
75
76
76
    my $itemtype_limit;
77
    my $itemtype_limit;
77
    if ( $h->itemtype ) {
78
    if ( $h->itemtype ) {
78
        my $itemtype = C4::Koha::getitemtypeinfo( $h->itemtype );
79
        my $itemtype = Koha::ItemTypes->find( $h->itemtype );
79
        $itemtype_limit = $itemtype->{translated_description};
80
        $itemtype_limit = $itemtype->translated_description;
80
    }
81
    }
81
82
82
    my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
83
    my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
(-)a/virtualshelves/shelves.pl (-5 / +5 lines)
Lines 29-34 use C4::XSLT; Link Here
29
29
30
use Koha::Biblios;
30
use Koha::Biblios;
31
use Koha::Biblioitems;
31
use Koha::Biblioitems;
32
use Koha::ItemTypes;
32
use Koha::CsvProfiles;
33
use Koha::CsvProfiles;
33
use Koha::Virtualshelves;
34
use Koha::Virtualshelves;
34
35
Lines 235-248 if ( $op eq 'view' ) { Link Here
235
236
236
                my $marcflavour = C4::Context->preference("marcflavour");
237
                my $marcflavour = C4::Context->preference("marcflavour");
237
                my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
238
                my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
238
                my $itemtypeinfo = getitemtypeinfo( $itemtype, 'intranet' );
239
                $itemtype = Koha::ItemTypes->find( $itemtype );
239
                my $biblio = Koha::Biblios->find( $content->biblionumber );
240
                my $biblio = Koha::Biblios->find( $content->biblionumber );
240
                $this_item->{title}             = $biblio->title;
241
                $this_item->{title}             = $biblio->title;
241
                $this_item->{author}            = $biblio->author;
242
                $this_item->{author}            = $biblio->author;
242
                $this_item->{dateadded}         = $content->dateadded;
243
                $this_item->{dateadded}         = $content->dateadded;
243
                $this_item->{imageurl}          = $itemtypeinfo->{imageurl};
244
                $this_item->{imageurl}          = C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl );
244
                $this_item->{description}       = $itemtypeinfo->{description};
245
                $this_item->{description}       = $itemtype->description; #FIXME Should not it be translated_description
245
                $this_item->{notforloan}        = $itemtypeinfo->{notforloan};
246
                $this_item->{notforloan}        = $itemtype->notforloan;
246
                $this_item->{'coins'}           = GetCOinSBiblio($record);
247
                $this_item->{'coins'}           = GetCOinSBiblio($record);
247
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
248
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
248
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
249
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
249
- 

Return to bug 17843