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

(-)a/C4/Biblio.pm (-1 / +1 lines)
Lines 1658-1664 sub GetAuthorisedValueDesc { Link Here
1658
1658
1659
        #---- itemtypes
1659
        #---- itemtypes
1660
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1660
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1661
            return getitemtypeinfo($value)->{description};
1661
            return getitemtypeinfo($value)->{translated_description};
1662
        }
1662
        }
1663
1663
1664
        #---- "true" authorized value
1664
        #---- "true" authorized value
(-)a/C4/ItemType.pm (-2 / +11 lines)
Lines 21-26 package C4::ItemType; Link Here
21
use strict;
21
use strict;
22
use warnings;
22
use warnings;
23
use C4::Context;
23
use C4::Context;
24
use C4::Languages;
24
use Encode qw( encode );
25
use Encode qw( encode );
25
26
26
our $AUTOLOAD;
27
our $AUTOLOAD;
Lines 78-86 sub all { Link Here
78
    my ($class) = @_;
79
    my ($class) = @_;
79
    my $dbh = C4::Context->dbh;
80
    my $dbh = C4::Context->dbh;
80
81
82
    my $language = C4::Languages::getlanguage();
81
    my @itypes;
83
    my @itypes;
82
    for ( @{$dbh->selectall_arrayref(
84
    for ( @{$dbh->selectall_arrayref(q|
83
        "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} )
85
        SELECT *,
86
            COALESCE( localization.translation, itemtypes.description ) AS translated_description
87
        FROM itemtypes
88
        LEFT JOIN localization ON itemtypes.itemtype = localization.code
89
            AND localization.entity = 'itemtypes'
90
            AND localization.lang = ?
91
        ORDER BY description
92
    |, { Slice => {} }, $language)} )
84
    {
93
    {
85
        push @itypes, $class->new($_);
94
        push @itypes, $class->new($_);
86
    }
95
    }
(-)a/C4/Items.pm (-1 / +9 lines)
Lines 1301-1306 sub GetItemsInfo { Link Here
1301
    my ( $biblionumber ) = @_;
1301
    my ( $biblionumber ) = @_;
1302
    my $dbh   = C4::Context->dbh;
1302
    my $dbh   = C4::Context->dbh;
1303
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1303
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1304
    my $language = C4::Languages::getlanguage();
1304
    my $query = "
1305
    my $query = "
1305
    SELECT items.*,
1306
    SELECT items.*,
1306
           biblio.*,
1307
           biblio.*,
Lines 1326-1331 sub GetItemsInfo { Link Here
1326
           serial.serialseq,
1327
           serial.serialseq,
1327
           serial.publisheddate,
1328
           serial.publisheddate,
1328
           itemtypes.description,
1329
           itemtypes.description,
1330
           COALESCE( localization.translation, itemtypes.description ) AS translated_description,
1329
           itemtypes.notforloan as notforloan_per_itemtype,
1331
           itemtypes.notforloan as notforloan_per_itemtype,
1330
           holding.branchurl,
1332
           holding.branchurl,
1331
           holding.branchname,
1333
           holding.branchname,
Lines 1344-1352 sub GetItemsInfo { Link Here
1344
     LEFT JOIN serial USING (serialid)
1346
     LEFT JOIN serial USING (serialid)
1345
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1347
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1346
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1348
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1349
    $query .= q|
1350
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
1351
        AND localization.entity = 'itemtypes'
1352
        AND localization.lang = ?
1353
    |;
1354
1347
    $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1355
    $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1348
    my $sth = $dbh->prepare($query);
1356
    my $sth = $dbh->prepare($query);
1349
    $sth->execute($biblionumber);
1357
    $sth->execute($language, $biblionumber);
1350
    my $i = 0;
1358
    my $i = 0;
1351
    my @results;
1359
    my @results;
1352
    my $serial;
1360
    my $serial;
(-)a/C4/Koha.pm (-8 / +1 lines)
Lines 194-207 build a HTML select with the following code : Link Here
194
sub GetSupportList{
194
sub GetSupportList{
195
	my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
195
	my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
196
    if (!$advanced_search_types or $advanced_search_types =~ /itemtypes/) {
196
    if (!$advanced_search_types or $advanced_search_types =~ /itemtypes/) {
197
		my $query = qq|
197
        return GetItemTypes( style => 'array' );
198
			SELECT *
199
			FROM   itemtypes
200
			order by description
201
		|;
202
		my $sth = C4::Context->dbh->prepare($query);
203
		$sth->execute;
204
		return $sth->fetchall_arrayref({});
205
	} else {
198
	} else {
206
		my $advsearchtypes = GetAuthorisedValues($advanced_search_types);
199
		my $advsearchtypes = GetAuthorisedValues($advanced_search_types);
207
		my @results= map {{itemtype=>$$_{authorised_value},description=>$$_{lib},imageurl=>$$_{imageurl}}} @$advsearchtypes;
200
		my @results= map {{itemtype=>$$_{authorised_value},description=>$$_{lib},imageurl=>$$_{imageurl}}} @$advsearchtypes;
(-)a/Koha/Template/Plugin/ItemTypes.pm (-1 / +1 lines)
Lines 27-33 use C4::Koha; Link Here
27
sub GetDescription {
27
sub GetDescription {
28
    my ( $self, $itemtype ) = @_;
28
    my ( $self, $itemtype ) = @_;
29
29
30
    my $itemtype = C4::Koha::getitemtypeinfo( $itemtype );
30
    $itemtype = C4::Koha::getitemtypeinfo( $itemtype );
31
    return $itemtype->{translated_description};
31
    return $itemtype->{translated_description};
32
32
33
}
33
}
(-)a/admin/smart-rules.pl (-9 / +10 lines)
Lines 46-51 my ($template, $loggedinuser, $cookie) Link Here
46
my $type=$input->param('type');
46
my $type=$input->param('type');
47
my $branch = $input->param('branch') || ( C4::Branch::onlymine() ? ( C4::Branch::mybranch() || '*' ) : '*' );
47
my $branch = $input->param('branch') || ( C4::Branch::onlymine() ? ( C4::Branch::mybranch() || '*' ) : '*' );
48
my $op = $input->param('op') || q{};
48
my $op = $input->param('op') || q{};
49
my $language = C4::Languages::getlanguage();
49
50
50
if ($op eq 'delete') {
51
if ($op eq 'delete') {
51
    my $itemtype     = $input->param('itemtype');
52
    my $itemtype     = $input->param('itemtype');
Lines 419-443 while (my $data=$sth->fetchrow_hashref){ Link Here
419
}
420
}
420
421
421
$sth->finish;
422
$sth->finish;
422
$sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes ORDER BY description");
423
$sth->execute;
424
# $i=0;
425
my @row_loop;
423
my @row_loop;
426
my @itemtypes;
424
my @itemtypes = @{ GetItemTypes( style => 'array' ) };
427
while (my $row=$sth->fetchrow_hashref){
428
    push @itemtypes,$row;
429
}
430
425
431
my $sth2 = $dbh->prepare("
426
my $sth2 = $dbh->prepare("
432
    SELECT issuingrules.*, itemtypes.description AS humanitemtype, categories.description AS humancategorycode
427
    SELECT  issuingrules.*,
428
            itemtypes.description AS humanitemtype,
429
            categories.description AS humancategorycode,
430
            COALESCE( localization.translation, itemtypes.description ) AS translated_description
433
    FROM issuingrules
431
    FROM issuingrules
434
    LEFT JOIN itemtypes
432
    LEFT JOIN itemtypes
435
        ON (itemtypes.itemtype = issuingrules.itemtype)
433
        ON (itemtypes.itemtype = issuingrules.itemtype)
436
    LEFT JOIN categories
434
    LEFT JOIN categories
437
        ON (categories.categorycode = issuingrules.categorycode)
435
        ON (categories.categorycode = issuingrules.categorycode)
436
    LEFT JOIN localization ON issuingrules.itemtype = localization.code
437
        AND localization.entity = 'itemtypes'
438
        AND localization.lang = ?
438
    WHERE issuingrules.branchcode = ?
439
    WHERE issuingrules.branchcode = ?
439
");
440
");
440
$sth2->execute($branch);
441
$sth2->execute($language, $branch);
441
442
442
while (my $row = $sth2->fetchrow_hashref) {
443
while (my $row = $sth2->fetchrow_hashref) {
443
    $row->{'current_branch'} ||= $row->{'branchcode'};
444
    $row->{'current_branch'} ||= $row->{'branchcode'};
(-)a/catalogue/itemsearch.pl (-1 / +1 lines)
Lines 258-264 if ($format eq 'html') { Link Here
258
    my @itemtypes = C4::ItemType->all();
258
    my @itemtypes = C4::ItemType->all();
259
    foreach my $itemtype (@itemtypes) {
259
    foreach my $itemtype (@itemtypes) {
260
        $itemtype->{value} = $itemtype->{itemtype};
260
        $itemtype->{value} = $itemtype->{itemtype};
261
        $itemtype->{label} = $itemtype->{description};
261
        $itemtype->{label} = $itemtype->{translated_description};
262
    }
262
    }
263
    my $ccode_avcode = GetAuthValCode('items.ccode') || 'CCODE';
263
    my $ccode_avcode = GetAuthValCode('items.ccode') || 'CCODE';
264
    my $ccodes = GetAuthorisedValues($ccode_avcode);
264
    my $ccodes = GetAuthorisedValues($ccode_avcode);
(-)a/catalogue/moredetail.pl (-2 / +2 lines)
Lines 127-133 my $ccodes= GetKohaAuthorisedValues('items.ccode',$fw); Link Here
127
my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$fw);
127
my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$fw);
128
my $itemtypes = GetItemTypes;
128
my $itemtypes = GetItemTypes;
129
129
130
$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'description'};
130
$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'translated_description'};
131
$data->{'rentalcharge'} = sprintf( "%.2f", $data->{'rentalcharge'} );
131
$data->{'rentalcharge'} = sprintf( "%.2f", $data->{'rentalcharge'} );
132
foreach ( keys %{$data} ) {
132
foreach ( keys %{$data} ) {
133
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
133
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
Lines 138-144 foreach my $item (@items){ Link Here
138
    $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw);
138
    $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw);
139
    $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw);
139
    $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw);
140
    $item->{'collection'}              = $ccodes->{ $item->{ccode} } if ($ccodes);
140
    $item->{'collection'}              = $ccodes->{ $item->{ccode} } if ($ccodes);
141
    $item->{'itype'}                   = $itemtypes->{ $item->{'itype'} }->{'description'};
141
    $item->{'itype'}                   = $itemtypes->{ $item->{'itype'} }->{'translated_description'};
142
    $item->{'replacementprice'}        = sprintf( "%.2f", $item->{'replacementprice'} );
142
    $item->{'replacementprice'}        = sprintf( "%.2f", $item->{'replacementprice'} );
143
    if ( defined $item->{'copynumber'} ) {
143
    if ( defined $item->{'copynumber'} ) {
144
        $item->{'displaycopy'} = 1;
144
        $item->{'displaycopy'} = 1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-4 / +4 lines)
Lines 176-182 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
176
							<td>[% IF ( rule.default_humanitemtype ) %]
176
							<td>[% IF ( rule.default_humanitemtype ) %]
177
									<em>All</em>
177
									<em>All</em>
178
								[% ELSE %]
178
								[% ELSE %]
179
									[% rule.humanitemtype %]
179
									[% rule.translated_description %]
180
								[% END %]
180
								[% END %]
181
							</td>
181
							</td>
182
							<td>[% IF ( rule.unlimited_maxissueqty ) %]
182
							<td>[% IF ( rule.unlimited_maxissueqty ) %]
Lines 251-257 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
251
                        <select name="itemtype" id="matrixitemtype" style="width:13em;">
251
                        <select name="itemtype" id="matrixitemtype" style="width:13em;">
252
                            <option value="*">All</option>
252
                            <option value="*">All</option>
253
                        [% FOREACH itemtypeloo IN itemtypeloop %]
253
                        [% FOREACH itemtypeloo IN itemtypeloop %]
254
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
254
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
255
                        [% END %]
255
                        [% END %]
256
                        </select>
256
                        </select>
257
                    </td>
257
                    </td>
Lines 530-536 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
530
                        <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
530
                        <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
531
                                <em>Default</em>
531
                                <em>Default</em>
532
                            [% ELSE %]
532
                            [% ELSE %]
533
                                [% branch_item_rule_loo.humanitemtype %]
533
                                [% branch_item_rule_loo.translated_description %]
534
                            [% END %]
534
                            [% END %]
535
                        </td>
535
                        </td>
536
                        <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
536
                        <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
Lines 560-566 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
560
                    <td>
560
                    <td>
561
                        <select name="itemtype">
561
                        <select name="itemtype">
562
                        [% FOREACH itemtypeloo IN itemtypeloop %]
562
                        [% FOREACH itemtypeloo IN itemtypeloop %]
563
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
563
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
564
                        [% END %]
564
                        [% END %]
565
                        </select>
565
                        </select>
566
                    </td>
566
                    </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-3 / +3 lines)
Lines 402-408 function verify_images() { Link Here
402
    [% FOREACH subtitl IN subtitle %]
402
    [% FOREACH subtitl IN subtitle %]
403
    	<h4>[% subtitl.subfield %]</h4>
403
    	<h4>[% subtitl.subfield %]</h4>
404
    [% END %]
404
    [% END %]
405
            [% UNLESS ( item_level_itypes ) %]<img src="[% imageurl %]" alt="[% description %]" title="[% description %]">[% END %]
405
            [% UNLESS ( item_level_itypes ) %]<img src="[% imageurl %]" alt="[% translated_description %]" title="[% translated_description %]">[% END %]
406
            [% IF ( unititle ) %]<p>[% unititle |html %]</p>[% END %]
406
            [% IF ( unititle ) %]<p>[% unititle |html %]</p>[% END %]
407
            [% IF ( author ) %]<p>By <a href="/cgi-bin/koha/catalogue/search.pl?q=au:[% author |url %]">[% author %]</a></p>[% END %]
407
            [% IF ( author ) %]<p>By <a href="/cgi-bin/koha/catalogue/search.pl?q=au:[% author |url %]">[% author %]</a></p>[% END %]
408
        <ul>
408
        <ul>
Lines 619-627 function verify_images() { Link Here
619
                    [% IF ( item_level_itypes ) %]
619
                    [% IF ( item_level_itypes ) %]
620
                        <td class="itype">
620
                        <td class="itype">
621
                            [% IF !noItemTypeImages && item.imageurl %]
621
                            [% IF !noItemTypeImages && item.imageurl %]
622
                                <img src="[% item.imageurl %]" alt="[% item.description %]" title="[% item.description %]" />
622
                                <img src="[% item.imageurl %]" alt="[% item.translated_description %]" title="[% item.translated_description %]" />
623
                            [% END %]
623
                            [% END %]
624
                            [% item.description %]
624
                            [% item.translated_description %]
625
                        </td>
625
                        </td>
626
                    [% END %]
626
                    [% END %]
627
                    <td class="location">[% UNLESS ( singlebranchmode ) %][% item.branchname %] [% END %]</td>
627
                    <td class="location">[% UNLESS ( singlebranchmode ) %][% item.branchname %] [% END %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt (-2 / +2 lines)
Lines 223-230 Link Here
223
                <td>
223
                <td>
224
                    <select name="Filter" size="1" id="itemtypes">
224
                    <select name="Filter" size="1" id="itemtypes">
225
                        <option value="">All item types</option>
225
                        <option value="">All item types</option>
226
                        [% FOREACH value IN ItemTypes.values %]
226
                        [% FOREACH itemtype IN itemtypes %]
227
                        <option value="[% value %]">[% ItemTypes.labels.$value %]</option>
227
                        <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
228
                        [% END %]
228
                        [% END %]
229
                    </select>
229
                    </select>
230
                </td>
230
                </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt (-1 / +1 lines)
Lines 148-154 function Dopop(link) { Link Here
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 itemtypeloo IN itemtypeloop %]
151
        <option value="[% itemtypeloo.value %]" >[% itemtypeloo.description %] </option>  
151
        <option value="[% itemtypeloo.value %]" >[% itemtypeloo.translated_description %] </option>
152
     [% END %] 
152
     [% END %] 
153
    </select>
153
    </select>
154
			</li>
154
			</li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt (-5 / +3 lines)
Lines 164-174 Link Here
164
				<td><input type="radio" name="Column" value="[% item_itype %]" /></td>
164
				<td><input type="radio" name="Column" value="[% item_itype %]" /></td>
165
				<td><select name="Filter" id="[% item_itype %]">
165
				<td><select name="Filter" id="[% item_itype %]">
166
					<option value=""> </option>
166
					<option value=""> </option>
167
					[% FOREACH CGIItemTyp IN CGIItemType %]
167
                    [% FOREACH itemtype IN itemtypes %]
168
					[% IF ( CGIItemTyp.selected ) %]
168
                        <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
169
					<option value="[% CGIItemTyp.itemtype %]" selected="selected">[% CGIItemTyp.description %]</option>[% ELSE %]<option value="[% CGIItemTyp.itemtype %]">[% CGIItemTyp.description %]</option>[% END %]
169
                    [% END %]
170
171
					[% END %]
172
					</select>
170
					</select>
173
				</td>
171
				</td>
174
			</tr>
172
			</tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt (-2 / +2 lines)
Lines 168-175 Link Here
168
                <td>
168
                <td>
169
                    <select name="Filter" size="1" id="itemtypes">
169
                    <select name="Filter" size="1" id="itemtypes">
170
                        <option value=""></option>
170
                        <option value=""></option>
171
                        [% FOREACH value IN ItemType.values %]
171
                        [% FOREACH itemtype IN itemtypes %]
172
                        <option value="[%- value -%]">[%- ItemType.labels.$value -%]</option>
172
                        <option value="[%- itemtype.itemtype -%]">[%- itemtype.translated_description -%]</option>
173
                        [% END %]
173
                        [% END %]
174
                    </select>
174
                    </select>
175
                </td>
175
                </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt (-1 / +2 lines)
Lines 1-3 Link Here
1
[% USE ItemTypes %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Catalog by item types</title>
3
<title>Koha &rsaquo; Reports &rsaquo; Catalog by item types</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 47-53 $(document).ready(function(){ Link Here
47
		<tbody>
48
		<tbody>
48
			[% FOREACH loopitemtyp IN mainloo.loopitemtype %]
49
			[% FOREACH loopitemtyp IN mainloo.loopitemtype %]
49
				<tr>
50
				<tr>
50
					<td>[% loopitemtyp.itemtype %]</td>
51
                    <td>[% ItemTypes.GetDescription( loopitemtyp.itemtype ) %]</td>
51
					<td>[% loopitemtyp.count %]</td>
52
					<td>[% loopitemtyp.count %]</td>
52
				</tr>
53
				</tr>
53
			[% END %]
54
			[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-2 / +2 lines)
Lines 214-220 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
214
        <li><span class="label">Collection title:</span>[% collectiontitle |html %]</li>
214
        <li><span class="label">Collection title:</span>[% collectiontitle |html %]</li>
215
        <li><span class="label">Document type:</span>
215
        <li><span class="label">Document type:</span>
216
            [% FOREACH itemtypeloo IN itemtypeloop %]
216
            [% FOREACH itemtypeloo IN itemtypeloop %]
217
                [% IF ( itemtypeloo.selected ) %][% itemtypeloo.description %][% END %]
217
                [% IF ( itemtypeloo.selected ) %][% itemtypeloo.translated_description %][% END %]
218
            [% END %]
218
            [% END %]
219
        </li>
219
        </li>
220
        [% IF ( patron_reason_loop ) %]
220
        [% IF ( patron_reason_loop ) %]
Lines 339-345 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
339
            <select id="itemtype" name="itemtype" >
339
            <select id="itemtype" name="itemtype" >
340
            [% FOREACH itemtypeloo IN itemtypeloop %]
340
            [% FOREACH itemtypeloo IN itemtypeloop %]
341
                [% IF ( itemtypeloo.selected ) %]<option selected="selected" value="[% itemtypeloo.itemtype %]">[% ELSE %]<option value="[% itemtypeloo.itemtype %]">[% END %]
341
                [% IF ( itemtypeloo.selected ) %]<option selected="selected" value="[% itemtypeloo.itemtype %]">[% ELSE %]<option value="[% itemtypeloo.itemtype %]">[% END %]
342
                [% itemtypeloo.description %]</option>
342
                [% itemtypeloo.translated_description %]</option>
343
            [% END %]
343
            [% END %]
344
            </select>
344
            </select>
345
        </li>
345
        </li>
(-)a/opac/opac-detail.pl (-2 / +2 lines)
Lines 521-527 my $itemtypes = GetItemTypes(); Link Here
521
my $itemtype = $dat->{'itemtype'};
521
my $itemtype = $dat->{'itemtype'};
522
if ( $itemtype ) {
522
if ( $itemtype ) {
523
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
523
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
524
    $dat->{'description'} = $itemtypes->{$itemtype}->{'description'};
524
    $dat->{'description'} = $itemtypes->{$itemtype}->{translated_description};
525
}
525
}
526
my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
526
my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
527
my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
527
my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
Lines 647-653 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
647
    }
647
    }
648
    if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
648
    if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
649
        $itm->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
649
        $itm->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
650
        $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'};
650
        $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{translated_description};
651
    }
651
    }
652
    foreach (qw(ccode enumchron copynumber itemnotes uri)) {
652
    foreach (qw(ccode enumchron copynumber itemnotes uri)) {
653
        $itemfields{$_} = 1 if ($itm->{$_});
653
        $itemfields{$_} = 1 if ($itm->{$_});
(-)a/reports/acquisitions_stats.pl (-13 / +2 lines)
Lines 124-141 else { Link Here
124
    $req->execute;
124
    $req->execute;
125
    my $booksellers = $req->fetchall_arrayref({});
125
    my $booksellers = $req->fetchall_arrayref({});
126
126
127
    $req = $dbh->prepare("SELECT DISTINCTROW itemtype,description FROM itemtypes ORDER BY description");
127
    my $itemtypes = GetItemTypes( style => 'array' );
128
    $req->execute;
129
    my @iselect;
130
    my %iselect;
131
    while ( my ( $value, $desc ) = $req->fetchrow ) {
132
        push @iselect, $value;
133
        $iselect{$value} = $desc;
134
    }
135
    my $ItemTypes = {
136
        values  => \@iselect,
137
        labels  => \%iselect,
138
   };
139
128
140
    $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
129
    $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
141
    $req->execute;
130
    $req->execute;
Lines 212-218 else { Link Here
212
201
213
    $template->param(
202
    $template->param(
214
        booksellers   => $booksellers,
203
        booksellers   => $booksellers,
215
        ItemTypes     => $ItemTypes,
204
        itemtypes     => $itemtypes,
216
        Budgets       => $Budgets,
205
        Budgets       => $Budgets,
217
        hassort1      => $hassort1,
206
        hassort1      => $hassort1,
218
        hassort2      => $hassort2,
207
        hassort2      => $hassort2,
(-)a/reports/bor_issues_top.pl (-2 / +2 lines)
Lines 123-131 foreach (sort keys %$branches) { Link Here
123
123
124
my $itemtypes = GetItemTypes;
124
my $itemtypes = GetItemTypes;
125
my @itemtypeloop;
125
my @itemtypeloop;
126
foreach (sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys %$itemtypes) {
126
foreach (sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) {
127
	my %row = (value => $_,
127
	my %row = (value => $_,
128
               description => $itemtypes->{$_}->{description},
128
               description => $itemtypes->{$_}->{translated_description},
129
              );
129
              );
130
    push @itemtypeloop, \%row;
130
    push @itemtypeloop, \%row;
131
}
131
}
(-)a/reports/cat_issues_top.pl (-2 / +2 lines)
Lines 123-131 if ($do_it) { Link Here
123
    #doctype
123
    #doctype
124
    my $itemtypes = GetItemTypes;
124
    my $itemtypes = GetItemTypes;
125
    my @itemtypeloop;
125
    my @itemtypeloop;
126
    foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'}} keys %$itemtypes) {
126
    foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) {
127
            my %row =(value => $thisitemtype,
127
            my %row =(value => $thisitemtype,
128
                      description => $itemtypes->{$thisitemtype}->{'description'},
128
                      description => $itemtypes->{$thisitemtype}->{translated_description},
129
                            );
129
                            );
130
            push @itemtypeloop, \%row;
130
            push @itemtypeloop, \%row;
131
    }
131
    }
(-)a/reports/catalogue_out.pl (-2 / +2 lines)
Lines 65-78 if ($do_it) { Link Here
65
my $itemtypes = GetItemTypes();
65
my $itemtypes = GetItemTypes();
66
my @itemtypeloop;
66
my @itemtypeloop;
67
foreach (
67
foreach (
68
    sort { $itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} }
68
    sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} }
69
    keys %$itemtypes
69
    keys %$itemtypes
70
  )
70
  )
71
{
71
{
72
    push @itemtypeloop,
72
    push @itemtypeloop,
73
      {
73
      {
74
        value       => $_,
74
        value       => $_,
75
        description => $itemtypes->{$_}->{'description'},
75
        description => $itemtypes->{$_}->{translated_description},
76
      };
76
      };
77
}
77
}
78
78
(-)a/reports/catalogue_stats.pl (-4 / +2 lines)
Lines 146-154 if ($do_it) { Link Here
146
    my $hascote = 1;
146
    my $hascote = 1;
147
    my $highcote = 5;
147
    my $highcote = 5;
148
148
149
	$req = $dbh->prepare("select itemtype, description from itemtypes order by description");
149
    my $itemtypes = GetItemTypes( style => 'array' );
150
	$req->execute;
151
	my $CGIitemtype = $req->fetchall_arrayref({});
152
150
153
	my $authvals = GetKohaAuthorisedValues("items.ccode");
151
	my $authvals = GetKohaAuthorisedValues("items.ccode");
154
	my @authvals;
152
	my @authvals;
Lines 167-173 if ($do_it) { Link Here
167
	$template->param(hasdewey=>$hasdewey,
165
	$template->param(hasdewey=>$hasdewey,
168
					haslccn   => $haslccn,
166
					haslccn   => $haslccn,
169
					hascote   => $hascote,
167
					hascote   => $hascote,
170
					CGIItemType => $CGIitemtype,
168
                    itemtypes => $itemtypes,
171
					CGIBranch    => GetBranchesLoop(C4::Context->userenv->{'branch'}),
169
					CGIBranch    => GetBranchesLoop(C4::Context->userenv->{'branch'}),
172
					locationloop => \@locations,
170
					locationloop => \@locations,
173
					authvals     => \@authvals,
171
					authvals     => \@authvals,
(-)a/reports/issues_avg_stats.pl (-15 / +4 lines)
Lines 134-153 if ($do_it) { Link Here
134
        values   => \@selectc,
134
        values   => \@selectc,
135
        labels   => \%labelsc,
135
        labels   => \%labelsc,
136
    };
136
    };
137
    
137
138
    $req = $dbh->prepare( "select distinctrow itemtype,description from itemtypes order by description");
138
    my $itemtypes = GetItemTypes( style => 'array' );
139
    $req->execute;
139
140
    my @selecti;
141
    my %labelsi;
142
    while (my ($value,$desc) =$req->fetchrow) {
143
        push @selecti, $value;
144
        $labelsi{$value}=$desc;
145
    }
146
    my $ItemTypes = {
147
        values   => \@selecti,
148
        labels    => \%labelsi,
149
    };
150
    
151
    $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
140
    $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
152
    $req->execute;
141
    $req->execute;
153
    my @selects1;
142
    my @selects1;
Lines 178-184 if ($do_it) { Link Here
178
    
167
    
179
    $template->param(
168
    $template->param(
180
                    BorCat       => $BorCat,
169
                    BorCat       => $BorCat,
181
                    ItemType     => $ItemTypes,
170
                    itemtypes    => $itemtypes,
182
                    branchloop   => GetBranchesLoop(),
171
                    branchloop   => GetBranchesLoop(),
183
                    hassort1     => $hassort1,
172
                    hassort1     => $hassort1,
184
                    hassort2     => $hassort2,
173
                    hassort2     => $hassort2,
(-)a/reports/issues_stats.pl (-2 / +2 lines)
Lines 133-140 my %select; Link Here
133
133
134
# create itemtype arrayref for <select>.
134
# create itemtype arrayref for <select>.
135
my @itemtypeloop;
135
my @itemtypeloop;
136
for my $itype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys(%$itemtypes)) {
136
for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) {
137
	push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{description} } ;
137
    push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ;
138
}
138
}
139
139
140
    # location list
140
    # location list
(-)a/reports/itemslost.pl (-2 / +2 lines)
Lines 85-94 if ( $get_items ) { Link Here
85
# getting all itemtypes
85
# getting all itemtypes
86
my $itemtypes = &GetItemTypes();
86
my $itemtypes = &GetItemTypes();
87
my @itemtypesloop;
87
my @itemtypesloop;
88
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys %$itemtypes ) {
88
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes ) {
89
    my %row = (
89
    my %row = (
90
        value       => $thisitemtype,
90
        value       => $thisitemtype,
91
        description => $itemtypes->{$thisitemtype}->{'description'},
91
        description => $itemtypes->{$thisitemtype}->{'translated_description'},
92
    );
92
    );
93
    push @itemtypesloop, \%row;
93
    push @itemtypesloop, \%row;
94
}
94
}
(-)a/reports/itemtypes.plugin (-7 / +7 lines)
Lines 49-55 sub calculate { Link Here
49
	if ($branch) {
49
	if ($branch) {
50
		if (C4::Context->preference('item-level_itypes')) {
50
		if (C4::Context->preference('item-level_itypes')) {
51
		$sth = $dbh->prepare("
51
		$sth = $dbh->prepare("
52
        SELECT description, items.itype as itemtype, COUNT(*) AS total 
52
        SELECT itemtype, description, items.itype as itemtype, COUNT(*) AS total
53
			FROM itemtypes,items         
53
			FROM itemtypes,items         
54
		WHERE items.itype=itemtypes.itemtype         
54
		WHERE items.itype=itemtypes.itemtype         
55
		AND items.holdingbranch=?            
55
		AND items.holdingbranch=?            
Lines 59-65 sub calculate { Link Here
59
		}
59
		}
60
		else {
60
		else {
61
		$sth = $dbh->prepare("
61
		$sth = $dbh->prepare("
62
		SELECT description, biblioitems.itemtype, COUNT(*) AS total 
62
        SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total
63
			FROM itemtypes, biblioitems, items 
63
			FROM itemtypes, biblioitems, items 
64
		WHERE biblioitems.itemtype=itemtypes.itemtype 
64
		WHERE biblioitems.itemtype=itemtypes.itemtype 
65
		AND items.biblioitemnumber=biblioitems.biblioitemnumber
65
		AND items.biblioitemnumber=biblioitems.biblioitemnumber
Lines 71-84 sub calculate { Link Here
71
	} else {
71
	} else {
72
		if (C4::Context->preference('item-level_itypes')) {
72
		if (C4::Context->preference('item-level_itypes')) {
73
		$sth = $dbh->prepare("
73
		$sth = $dbh->prepare("
74
		SELECT description,items.itype AS itemtype, COUNT(*) AS total 
74
        SELECT itemtype, description,items.itype AS itemtype, COUNT(*) AS total
75
			FROM itemtypes,items
75
			FROM itemtypes,items
76
		WHERE items.itype=itemtypes.itemtype
76
		WHERE items.itype=itemtypes.itemtype
77
			GROUP BY items.itype
77
			GROUP BY items.itype
78
			ORDER BY itemtypes.description");
78
			ORDER BY itemtypes.description");
79
		}
79
		}
80
		else {
80
		else {
81
		$sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total
81
        $sth = $dbh->prepare("SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total
82
			FROM itemtypes, biblioitems,items 
82
			FROM itemtypes, biblioitems,items 
83
		WHERE biblioitems.itemtype=itemtypes.itemtype 
83
		WHERE biblioitems.itemtype=itemtypes.itemtype 
84
		AND biblioitems.biblioitemnumber = items.biblioitemnumber
84
		AND biblioitems.biblioitemnumber = items.biblioitemnumber
Lines 87-103 sub calculate { Link Here
87
		}
87
		}
88
		$sth->execute;
88
		$sth->execute;
89
	}
89
	}
90
	my ($description,$biblioitems,$total);
90
    my ($itemtype, $description,$biblioitems,$total);
91
	my $grantotal = 0;
91
	my $grantotal = 0;
92
	my $count = 0;
92
	my $count = 0;
93
	while (($description,$biblioitems,$total) = $sth->fetchrow) {
93
    while (($itemtype, $description,$biblioitems,$total) = $sth->fetchrow) {
94
		my %line;
94
		my %line;
95
		if($count % 2){
95
		if($count % 2){
96
			$line{toggle} = 1;
96
			$line{toggle} = 1;
97
			} else {
97
			} else {
98
				$line{toggle} = 0;
98
				$line{toggle} = 0;
99
			}
99
			}
100
		$line{itemtype} = $description;
100
        $line{itemtype} = $itemtype;
101
		$line{count} = $total;
101
		$line{count} = $total;
102
		$grantotal += $total;
102
		$grantotal += $total;
103
		push @results,\%line;
103
		push @results,\%line;
(-)a/reports/reserves_stats.pl (-2 / +2 lines)
Lines 139-146 my %select; Link Here
139
139
140
# create itemtype arrayref for <select>.
140
# create itemtype arrayref for <select>.
141
my @itemtypeloop;
141
my @itemtypeloop;
142
for my $itype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys(%$itemtypes)) {
142
for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) {
143
	push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{description} } ;
143
	push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ;
144
}
144
}
145
145
146
    # location list
146
    # location list
(-)a/tools/export.pl (-2 / +1 lines)
Lines 487-493 else { Link Here
487
    foreach my $thisitemtype ( sort keys %$itemtypes ) {
487
    foreach my $thisitemtype ( sort keys %$itemtypes ) {
488
        my %row = (
488
        my %row = (
489
            value       => $thisitemtype,
489
            value       => $thisitemtype,
490
            description => $itemtypes->{$thisitemtype}->{'description'},
490
            description => $itemtypes->{$thisitemtype}->{translated_description},
491
        );
491
        );
492
        push @itemtypesloop, \%row;
492
        push @itemtypesloop, \%row;
493
    }
493
    }
494
- 

Return to bug 14100