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

(-)a/C4/Biblio.pm (-1 / +1 lines)
Lines 1635-1641 sub GetAuthorisedValueDesc { Link Here
1635
1635
1636
        #---- itemtypes
1636
        #---- itemtypes
1637
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1637
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1638
            return getitemtypeinfo($value)->{description};
1638
            return getitemtypeinfo($value)->{translated_description};
1639
        }
1639
        }
1640
1640
1641
        #---- "true" authorized value
1641
        #---- "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 386-410 while (my $data=$sth->fetchrow_hashref){ Link Here
386
}
387
}
387
388
388
$sth->finish;
389
$sth->finish;
389
$sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes ORDER BY description");
390
$sth->execute;
391
# $i=0;
392
my @row_loop;
390
my @row_loop;
393
my @itemtypes;
391
my @itemtypes = @{ GetItemTypes( style => 'array' ) };
394
while (my $row=$sth->fetchrow_hashref){
395
    push @itemtypes,$row;
396
}
397
392
398
my $sth2 = $dbh->prepare("
393
my $sth2 = $dbh->prepare("
399
    SELECT issuingrules.*, itemtypes.description AS humanitemtype, categories.description AS humancategorycode
394
    SELECT  issuingrules.*,
395
            itemtypes.description AS humanitemtype,
396
            categories.description AS humancategorycode,
397
            COALESCE( localization.translation, itemtypes.description ) AS translated_description
400
    FROM issuingrules
398
    FROM issuingrules
401
    LEFT JOIN itemtypes
399
    LEFT JOIN itemtypes
402
        ON (itemtypes.itemtype = issuingrules.itemtype)
400
        ON (itemtypes.itemtype = issuingrules.itemtype)
403
    LEFT JOIN categories
401
    LEFT JOIN categories
404
        ON (categories.categorycode = issuingrules.categorycode)
402
        ON (categories.categorycode = issuingrules.categorycode)
403
    LEFT JOIN localization ON issuingrules.itemtype = localization.code
404
        AND localization.entity = 'itemtypes'
405
        AND localization.lang = ?
405
    WHERE issuingrules.branchcode = ?
406
    WHERE issuingrules.branchcode = ?
406
");
407
");
407
$sth2->execute($branch);
408
$sth2->execute($language, $branch);
408
409
409
while (my $row = $sth2->fetchrow_hashref) {
410
while (my $row = $sth2->fetchrow_hashref) {
410
    $row->{'current_branch'} ||= $row->{'branchcode'};
411
    $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 174-180 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
174
							<td>[% IF ( rule.default_humanitemtype ) %]
174
							<td>[% IF ( rule.default_humanitemtype ) %]
175
									<em>All</em>
175
									<em>All</em>
176
								[% ELSE %]
176
								[% ELSE %]
177
									[% rule.humanitemtype %]
177
									[% rule.translated_description %]
178
								[% END %]
178
								[% END %]
179
							</td>
179
							</td>
180
							<td>[% IF ( rule.unlimited_maxissueqty ) %]
180
							<td>[% IF ( rule.unlimited_maxissueqty ) %]
Lines 242-248 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
242
                        <select name="itemtype" id="matrixitemtype" style="width:13em;">
242
                        <select name="itemtype" id="matrixitemtype" style="width:13em;">
243
                            <option value="*">All</option>
243
                            <option value="*">All</option>
244
                        [% FOREACH itemtypeloo IN itemtypeloop %]
244
                        [% FOREACH itemtypeloo IN itemtypeloop %]
245
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
245
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
246
                        [% END %]
246
                        [% END %]
247
                        </select>
247
                        </select>
248
                    </td>
248
                    </td>
Lines 501-507 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
501
                        <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
501
                        <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %]
502
                                <em>Default</em>
502
                                <em>Default</em>
503
                            [% ELSE %]
503
                            [% ELSE %]
504
                                [% branch_item_rule_loo.humanitemtype %]
504
                                [% branch_item_rule_loo.translated_description %]
505
                            [% END %]
505
                            [% END %]
506
                        </td>
506
                        </td>
507
                        <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
507
                        <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
Lines 531-537 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
531
                    <td>
531
                    <td>
532
                        <select name="itemtype">
532
                        <select name="itemtype">
533
                        [% FOREACH itemtypeloo IN itemtypeloop %]
533
                        [% FOREACH itemtypeloo IN itemtypeloop %]
534
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option>
534
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
535
                        [% END %]
535
                        [% END %]
536
                        </select>
536
                        </select>
537
                    </td>
537
                    </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-3 / +3 lines)
Lines 401-407 function verify_images() { Link Here
401
    [% FOREACH subtitl IN subtitle %]
401
    [% FOREACH subtitl IN subtitle %]
402
    	<h4>[% subtitl.subfield %]</h4>
402
    	<h4>[% subtitl.subfield %]</h4>
403
    [% END %]
403
    [% END %]
404
            [% UNLESS ( item_level_itypes ) %]<img src="[% imageurl %]" alt="[% description %]" title="[% description %]">[% END %]
404
            [% UNLESS ( item_level_itypes ) %]<img src="[% imageurl %]" alt="[% translated_description %]" title="[% translated_description %]">[% END %]
405
            [% IF ( unititle ) %]<p>[% unititle |html %]</p>[% END %]
405
            [% IF ( unititle ) %]<p>[% unititle |html %]</p>[% END %]
406
            [% IF ( author ) %]<p>By <a href="/cgi-bin/koha/catalogue/search.pl?q=au:[% author |url %]">[% author %]</a></p>[% END %]
406
            [% IF ( author ) %]<p>By <a href="/cgi-bin/koha/catalogue/search.pl?q=au:[% author |url %]">[% author %]</a></p>[% END %]
407
        <ul>
407
        <ul>
Lines 618-626 function verify_images() { Link Here
618
                    [% IF ( item_level_itypes ) %]
618
                    [% IF ( item_level_itypes ) %]
619
                        <td class="itype">
619
                        <td class="itype">
620
                            [% IF !noItemTypeImages && item.imageurl %]
620
                            [% IF !noItemTypeImages && item.imageurl %]
621
                                <img src="[% item.imageurl %]" alt="[% item.description %]" title="[% item.description %]" />
621
                                <img src="[% item.imageurl %]" alt="[% item.translated_description %]" title="[% item.translated_description %]" />
622
                            [% END %]
622
                            [% END %]
623
                            [% item.description %]
623
                            [% item.translated_description %]
624
                        </td>
624
                        </td>
625
                    [% END %]
625
                    [% END %]
626
                    <td class="location">[% UNLESS ( singlebranchmode ) %][% item.branchname %] [% END %]</td>
626
                    <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 120-137 else { Link Here
120
    $req->execute;
120
    $req->execute;
121
    my $booksellers = $req->fetchall_arrayref({});
121
    my $booksellers = $req->fetchall_arrayref({});
122
122
123
    $req = $dbh->prepare("SELECT DISTINCTROW itemtype,description FROM itemtypes ORDER BY description");
123
    my $itemtypes = GetItemTypes( style => 'array' );
124
    $req->execute;
125
    my @iselect;
126
    my %iselect;
127
    while ( my ( $value, $desc ) = $req->fetchrow ) {
128
        push @iselect, $value;
129
        $iselect{$value} = $desc;
130
    }
131
    my $ItemTypes = {
132
        values  => \@iselect,
133
        labels  => \%iselect,
134
   };
135
124
136
    $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
125
    $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
137
    $req->execute;
126
    $req->execute;
Lines 208-214 else { Link Here
208
197
209
    $template->param(
198
    $template->param(
210
        booksellers   => $booksellers,
199
        booksellers   => $booksellers,
211
        ItemTypes     => $ItemTypes,
200
        itemtypes     => $itemtypes,
212
        Budgets       => $Budgets,
201
        Budgets       => $Budgets,
213
        hassort1      => $hassort1,
202
        hassort1      => $hassort1,
214
        hassort2      => $hassort2,
203
        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 128-147 if ($do_it) { Link Here
128
        values   => \@selectc,
128
        values   => \@selectc,
129
        labels   => \%labelsc,
129
        labels   => \%labelsc,
130
    };
130
    };
131
    
131
132
    $req = $dbh->prepare( "select distinctrow itemtype,description from itemtypes order by description");
132
    my $itemtypes = GetItemTypes( style => 'array' );
133
    $req->execute;
133
134
    my @selecti;
135
    my %labelsi;
136
    while (my ($value,$desc) =$req->fetchrow) {
137
        push @selecti, $value;
138
        $labelsi{$value}=$desc;
139
    }
140
    my $ItemTypes = {
141
        values   => \@selecti,
142
        labels    => \%labelsi,
143
    };
144
    
145
    $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
134
    $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
146
    $req->execute;
135
    $req->execute;
147
    my @selects1;
136
    my @selects1;
Lines 172-178 if ($do_it) { Link Here
172
    
161
    
173
    $template->param(
162
    $template->param(
174
                    BorCat       => $BorCat,
163
                    BorCat       => $BorCat,
175
                    ItemType     => $ItemTypes,
164
                    itemtypes    => $itemtypes,
176
                    branchloop   => GetBranchesLoop(),
165
                    branchloop   => GetBranchesLoop(),
177
                    hassort1     => $hassort1,
166
                    hassort1     => $hassort1,
178
                    hassort2     => $hassort2,
167
                    hassort2     => $hassort2,
(-)a/reports/issues_stats.pl (-2 / +2 lines)
Lines 131-138 my %select; Link Here
131
131
132
# create itemtype arrayref for <select>.
132
# create itemtype arrayref for <select>.
133
my @itemtypeloop;
133
my @itemtypeloop;
134
for my $itype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys(%$itemtypes)) {
134
for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) {
135
	push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{description} } ;
135
    push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ;
136
}
136
}
137
137
138
    # location list
138
    # 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 482-488 else { Link Here
482
    foreach my $thisitemtype ( sort keys %$itemtypes ) {
482
    foreach my $thisitemtype ( sort keys %$itemtypes ) {
483
        my %row = (
483
        my %row = (
484
            value       => $thisitemtype,
484
            value       => $thisitemtype,
485
            description => $itemtypes->{$thisitemtype}->{'description'},
485
            description => $itemtypes->{$thisitemtype}->{translated_description},
486
        );
486
        );
487
        push @itemtypesloop, \%row;
487
        push @itemtypesloop, \%row;
488
    }
488
    }
489
- 

Return to bug 14100