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

(-)a/C4/Search.pm (-3 / +3 lines)
Lines 571-577 sub getRecords { Link Here
571
                                    {
571
                                    {
572
                                        $facet_label_value =
572
                                        $facet_label_value =
573
                                          $itemtypes->{$one_facet}
573
                                          $itemtypes->{$one_facet}
574
                                          ->{'description'};
574
                                          ->{translated_description};
575
                                    }
575
                                    }
576
                                }
576
                                }
577
577
Lines 1950-1956 sub searchResults { Link Here
1950
1950
1951
		# edition information, if any
1951
		# edition information, if any
1952
        $oldbiblio->{edition} = $oldbiblio->{editionstatement};
1952
        $oldbiblio->{edition} = $oldbiblio->{editionstatement};
1953
		$oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{description};
1953
        $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{translated_description};
1954
 # Build summary if there is one (the summary is defined in the itemtypes table)
1954
 # Build summary if there is one (the summary is defined in the itemtypes table)
1955
 # FIXME: is this used anywhere, I think it can be commented out? -- JF
1955
 # FIXME: is this used anywhere, I think it can be commented out? -- JF
1956
        if ( $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) {
1956
        if ( $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) {
Lines 2062-2068 sub searchResults { Link Here
2062
            foreach my $code ( keys %subfieldstosearch ) {
2062
            foreach my $code ( keys %subfieldstosearch ) {
2063
                $item->{$code} = $field->subfield( $subfieldstosearch{$code} );
2063
                $item->{$code} = $field->subfield( $subfieldstosearch{$code} );
2064
            }
2064
            }
2065
            $item->{description} = $itemtypes{ $item->{itype} }{description};
2065
            $item->{description} = $itemtypes{ $item->{itype} }{translated_description};
2066
2066
2067
	        # OPAC hidden items
2067
	        # OPAC hidden items
2068
            if ($is_opac) {
2068
            if ($is_opac) {
(-)a/catalogue/search.pl (-1 / +1 lines)
Lines 262-268 foreach my $advanced_srch_type (@advanced_search_types) { Link Here
262
   if ($advanced_srch_type eq 'itemtypes') {
262
   if ($advanced_srch_type eq 'itemtypes') {
263
   # itemtype is a special case, since it's not defined in authorized values
263
   # itemtype is a special case, since it's not defined in authorized values
264
        my @itypesloop;
264
        my @itypesloop;
265
	foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
265
        foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes ) {
266
	    my %row =(  number=>$cnt++,
266
	    my %row =(  number=>$cnt++,
267
		ccl => "$itype_or_itemtype,phr",
267
		ccl => "$itype_or_itemtype,phr",
268
                code => $thisitemtype,
268
                code => $thisitemtype,
(-)a/opac/opac-search.pl (-2 / +2 lines)
Lines 236-248 foreach my $advanced_srch_type (@advanced_search_types) { Link Here
236
   if ($advanced_srch_type eq 'itemtypes') {
236
   if ($advanced_srch_type eq 'itemtypes') {
237
   # itemtype is a special case, since it's not defined in authorized values
237
   # itemtype is a special case, since it's not defined in authorized values
238
        my @itypesloop;
238
        my @itypesloop;
239
	foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
239
        foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes ) {
240
            next if $hidingrules->{itype} && any { $_ eq $thisitemtype } @{$hidingrules->{itype}};
240
            next if $hidingrules->{itype} && any { $_ eq $thisitemtype } @{$hidingrules->{itype}};
241
            next if $hidingrules->{itemtype} && any { $_ eq $thisitemtype } @{$hidingrules->{itemtype}};
241
            next if $hidingrules->{itemtype} && any { $_ eq $thisitemtype } @{$hidingrules->{itemtype}};
242
	    my %row =(  number=>$cnt++,
242
	    my %row =(  number=>$cnt++,
243
		ccl => "$itype_or_itemtype,phr",
243
		ccl => "$itype_or_itemtype,phr",
244
                code => $thisitemtype,
244
                code => $thisitemtype,
245
                description => $itemtypes->{$thisitemtype}->{'description'},
245
                description => $itemtypes->{$thisitemtype}->{translated_description},
246
                imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
246
                imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
247
            );
247
            );
248
	    push @itypesloop, \%row;
248
	    push @itypesloop, \%row;
(-)a/opac/opac-topissues.pl (-11 / +22 lines)
Lines 25-30 use warnings; Link Here
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Context;
27
use C4::Context;
28
use C4::Languages;
28
use C4::Search;
29
use C4::Search;
29
use C4::Output;
30
use C4::Output;
30
use C4::Koha;
31
use C4::Koha;
Lines 77-87 my $whereclause = ''; Link Here
77
$whereclause .= ' AND items.homebranch='.$dbh->quote($branch) if ($branch);
78
$whereclause .= ' AND items.homebranch='.$dbh->quote($branch) if ($branch);
78
$whereclause .= ' AND TO_DAYS(NOW()) - TO_DAYS(biblio.datecreated) <= '.($timeLimit*30) if $timeLimit < 999;
79
$whereclause .= ' AND TO_DAYS(NOW()) - TO_DAYS(biblio.datecreated) <= '.($timeLimit*30) if $timeLimit < 999;
79
$whereclause =~ s/ AND $// if $whereclause;
80
$whereclause =~ s/ AND $// if $whereclause;
80
my $query;
81
my $sth;
81
82
if($advanced_search_types eq 'ccode'){
82
if($advanced_search_types eq 'ccode'){
83
    $whereclause .= ' AND authorised_values.authorised_value='.$dbh->quote($itemtype) if $itemtype;
83
    $whereclause .= ' AND authorised_values.authorised_value='.$dbh->quote($itemtype) if $itemtype;
84
    $query = "SELECT datecreated, biblio.biblionumber, title,
84
    my $query = "SELECT datecreated, biblio.biblionumber, title,
85
                    author, sum( items.issues ) AS tot, biblioitems.itemtype,
85
                    author, sum( items.issues ) AS tot, biblioitems.itemtype,
86
                    biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate,
86
                    biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate,
87
                    authorised_values.lib as description, biblioitems.pages, biblioitems.size
87
                    authorised_values.lib as description, biblioitems.pages, biblioitems.size
Lines 98-103 if($advanced_search_types eq 'ccode'){ Link Here
98
                    LIMIT ?
98
                    LIMIT ?
99
                    ";
99
                    ";
100
    $template->param(ccodesearch => 1);
100
    $template->param(ccodesearch => 1);
101
    $sth = $dbh->prepare($query);
102
    $sth->execute($limit);
101
}else{
103
}else{
102
    if ($itemtype){
104
    if ($itemtype){
103
	if (C4::Context->preference('item-level_itypes')){
105
	if (C4::Context->preference('item-level_itypes')){
Lines 107-120 if($advanced_search_types eq 'ccode'){ Link Here
107
	    $whereclause .= ' AND biblioitems.itemtype='.$dbh->quote($itemtype);
109
	    $whereclause .= ' AND biblioitems.itemtype='.$dbh->quote($itemtype);
108
        }
110
        }
109
    }
111
    }
110
    $query = "SELECT datecreated, biblio.biblionumber, title,
112
    my $query = "SELECT datecreated, biblio.biblionumber, title,
111
                    author, sum( items.issues ) AS tot, biblioitems.itemtype,
113
                    author, sum( items.issues ) AS tot, biblioitems.itemtype,
112
                    biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate,
114
                    biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate,
113
                    itemtypes.description, biblioitems.pages, biblioitems.size
115
                    itemtypes.description, biblioitems.pages, biblioitems.size,
116
                    COALESCE( localization.translation, itemtypes.description ) AS translated_description
114
                    FROM biblio
117
                    FROM biblio
115
                    LEFT JOIN items USING (biblionumber)
118
                    LEFT JOIN items USING (biblionumber)
116
                    LEFT JOIN biblioitems USING (biblionumber)
119
                    LEFT JOIN biblioitems USING (biblionumber)
117
                    LEFT JOIN itemtypes ON itemtypes.itemtype = biblioitems.itemtype
120
                    LEFT JOIN itemtypes ON itemtypes.itemtype = biblioitems.itemtype
121
                    LEFT JOIN localization ON itemtypes.itemtype = localization.code
122
                        AND localization.entity = 'itemtypes'
123
                        AND localization.lang = ?
118
                    WHERE 1
124
                    WHERE 1
119
                    $whereclause
125
                    $whereclause
120
                    GROUP BY biblio.biblionumber
126
                    GROUP BY biblio.biblionumber
Lines 122-134 if($advanced_search_types eq 'ccode'){ Link Here
122
                    ORDER BY tot DESC
128
                    ORDER BY tot DESC
123
                    LIMIT ?
129
                    LIMIT ?
124
                    ";
130
                    ";
125
     $template->param(itemtypesearch => 1);
131
    $template->param(itemtypesearch => 1);
132
    $sth = $dbh->prepare($query);
133
    my $language = C4::Languages::getlanguage();
134
    $sth->execute($language, $limit);
126
}
135
}
127
136
128
my $sth = $dbh->prepare($query);
129
$sth->execute($limit);
130
my @results;
137
my @results;
131
while (my $line= $sth->fetchrow_hashref) {
138
while (my $line= $sth->fetchrow_hashref) {
139
    if ( $advanced_search_types ne 'ccode' ) {
140
        $line->{description} = $line->{translated_description};
141
    }
142
132
    push @results, $line;
143
    push @results, $line;
133
}
144
}
134
145
Lines 138-144 if($timeLimit eq 999){ $timeLimitFinite = 0 }; Link Here
138
$template->param(do_it => 1,
149
$template->param(do_it => 1,
139
                limit => $limit,
150
                limit => $limit,
140
                branch => $branches->{$branch}->{branchname},
151
                branch => $branches->{$branch}->{branchname},
141
                itemtype => $itemtypes->{$itemtype}->{description},
152
                itemtype => $itemtypes->{$itemtype}->{translated_description},
142
                timeLimit => $timeLimit,
153
                timeLimit => $timeLimit,
143
                timeLimitFinite => $timeLimitFinite,
154
                timeLimitFinite => $timeLimitFinite,
144
                results_loop => \@results,
155
                results_loop => \@results,
Lines 151-159 my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':' Link Here
151
$itemtypes = GetItemTypes;
162
$itemtypes = GetItemTypes;
152
my @itemtypesloop;
163
my @itemtypesloop;
153
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
164
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
154
        foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
165
        foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes ) {
155
        my %row =( value => $thisitemtype,
166
        my %row =( value => $thisitemtype,
156
                   description => $itemtypes->{$thisitemtype}->{'description'},
167
                   description => $itemtypes->{$thisitemtype}->{translated_description},
157
                   selected    => $thisitemtype eq $itemtype,
168
                   selected    => $thisitemtype eq $itemtype,
158
            );
169
            );
159
        push @itemtypesloop, \%row;
170
        push @itemtypesloop, \%row;
(-)a/reports/bor_issues_top.pl (-2 / +1 lines)
Lines 125-131 my $itemtypes = GetItemTypes; Link Here
125
my @itemtypeloop;
125
my @itemtypeloop;
126
foreach (sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_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->{$_}->{translated_description},
128
               translated_description => $itemtypes->{$_}->{translated_description},
129
              );
129
              );
130
    push @itemtypeloop, \%row;
130
    push @itemtypeloop, \%row;
131
}
131
}
132
- 

Return to bug 14100