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

(-)a/C4/Koha.pm (-5 / +7 lines)
Lines 278-291 sub GetItemTypes { Link Here
278
278
279
=head2 GetItemTypesCategorized
279
=head2 GetItemTypesCategorized
280
280
281
Returns item types but grouped by category if available.
281
    $categories = GetItemTypesCategorized();
282
283
Returns a hashref containing search categories.
284
A search category will be put in the hash if at least one of its itemtypes is visible in OPAC.
282
The categories must be part of Authorized Values (DOCTYPECAT)
285
The categories must be part of Authorized Values (DOCTYPECAT)
283
286
284
=cut
287
=cut
285
288
286
sub GetItemTypesCategorized {
289
sub GetItemTypesCategorized {
287
    my $dbh   = C4::Context->dbh;
290
    my $dbh   = C4::Context->dbh;
288
    # Order is important, so that partially hidden search
291
    # Order is important, so that partially hidden (some items are not visible in OPAC) search
289
    # categories will be visible. hideinopac=0 must be last.
292
    # categories will be visible. hideinopac=0 must be last.
290
    my $query = qq|
293
    my $query = qq|
291
        SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) or length(searchcategory) = 0
294
        SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) or length(searchcategory) = 0
Lines 313-327 sub GetItemTypesCategorized { Link Here
313
    while ( my $IT = $sth->fetchrow_hashref ) {
316
    while ( my $IT = $sth->fetchrow_hashref ) {
314
        $itemtypes{ $IT->{'itemtype'} } = $IT;
317
        $itemtypes{ $IT->{'itemtype'} } = $IT;
315
    }
318
    }
316
317
    return ( \%itemtypes );
319
    return ( \%itemtypes );
318
}
320
}
319
321
320
=head2 GetItemTypesByCategory
322
=head2 GetItemTypesByCategory
321
323
322
    $category = category filter
324
    @results = GetItemTypesByCategory( $searchcategory );
323
325
324
Returns the itemtypes that are grouped into the category.
326
Returns the itemtype code of all itemtypes included in a searchcategory.
325
327
326
=cut
328
=cut
327
329
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-14 lines)
Lines 109-115 Item types administration Link Here
109
  [% END %]
109
  [% END %]
110
      <li>
110
      <li>
111
          <label for="description" class="required">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" required="required" /> <span class="required">Required</span></li>
111
          <label for="description" class="required">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" required="required" /> <span class="required">Required</span></li>
112
      [% IF ( itemtype ) %]
113
      <li>
112
      <li>
114
          <span class="label">Search category</span>
113
          <span class="label">Search category</span>
115
          <select id="searchcategory" name="searchcategory">
114
          <select id="searchcategory" name="searchcategory">
Lines 128-146 Item types administration Link Here
128
          </select>
127
          </select>
129
          (Options are defined as the authorized values for the DOCTYPECAT category)
128
          (Options are defined as the authorized values for the DOCTYPECAT category)
130
      </li>
129
      </li>
131
      [% ELSE %]
132
      <li>
133
          <span class="label">Search category</span>
134
          <select id="searchcategory" name="searchcategory">
135
          <option value="" />
136
              [% FOREACH cat IN searchcategory %]
137
                  <option value="[% cat.authorised_value %]" >
138
                      [% cat.lib %]
139
                  </option>
140
              [% END %]
141
          </select>
142
      </li>
143
      [% END %]
144
130
145
     [% IF ( noItemTypeImages ) %]
131
     [% IF ( noItemTypeImages ) %]
146
	 <li><span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=noItemTypeImages">noItemTypeImages system preference</a></li></ol>
132
	 <li><span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=noItemTypeImages">noItemTypeImages system preference</a></li></ol>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt (-2 / +16 lines)
Lines 142-149 Link Here
142
                                    <div class="row-fluid">
142
                                    <div class="row-fluid">
143
                                        [% FOREACH itemtypeloo IN advsearchloo.code_loop %]
143
                                        [% FOREACH itemtypeloo IN advsearchloo.code_loop %]
144
                                            [% IF ((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1) %]
144
                                            [% IF ((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1) %]
145
                                            <div class="span3"><input type="checkbox" id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]" name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]" value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]"/><label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]">[% UNLESS ( noItemTypeImages ) %][% IF ( itemtypeloo.imageurl ) %]<img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]" />[% END %]&nbsp;[% END %]
145
                                                <div class="span3">
146
                                            [% itemtypeloo.description %]</label></div>
146
                                                    <input type="checkbox"
147
                                                        id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]"
148
                                                        name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]"
149
                                                        value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]"
150
                                                    />
151
                                                    <label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]">
152
                                                        [% UNLESS ( noItemTypeImages ) %]
153
                                                            [% IF ( itemtypeloo.imageurl ) %]
154
                                                                <img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]" />
155
                                                            [% END %]
156
                                                            &nbsp;
157
                                                        [% END %]
158
                                                        [% itemtypeloo.description %]
159
                                                    </label>
160
                                                </div>
147
                                            [% IF ( loop.last ) %]</div>[% ELSE %][% UNLESS ( loop.count % 4 ) %]</div><div class="row-fluid">[% END %][% END %]
161
                                            [% IF ( loop.last ) %]</div>[% ELSE %][% UNLESS ( loop.count % 4 ) %]</div><div class="row-fluid">[% END %][% END %]
148
                                            [% END %]
162
                                            [% END %]
149
                                        [% END %]
163
                                        [% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt (-3 / +16 lines)
Lines 188-195 Link Here
188
        <tr>
188
        <tr>
189
    [% FOREACH itemtypeloo IN advsearchloo.code_loop %]
189
    [% FOREACH itemtypeloo IN advsearchloo.code_loop %]
190
            [% IF ((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1) %]
190
            [% IF ((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1) %]
191
                <td><input type="checkbox" id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]" name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]" value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]"/><label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]">[% UNLESS ( noItemTypeImages ) %][% IF ( itemtypeloo.imageurl ) %]<img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]" />[% END %]&nbsp;[% END %]
191
                <td>
192
                [% itemtypeloo.description %]</label></td>
192
                    <input type="checkbox"
193
                        id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]"
194
                        name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]"
195
                        value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]"
196
                    />
197
                    <label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]">
198
                        [% UNLESS ( noItemTypeImages ) %]
199
                            [% IF ( itemtypeloo.imageurl ) %]
200
                                <img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]"/>
201
                            [% END %]
202
                            &nbsp;
203
                        [% END %]
204
                        [% itemtypeloo.description %]
205
                    </label>
206
                </td>
193
            [% END %]
207
            [% END %]
194
        [% IF ( loop.last ) %]</tr>[% ELSE %][% UNLESS ( loop.count % 5 ) %]</tr><tr>[% END %][% END %]
208
        [% IF ( loop.last ) %]</tr>[% ELSE %][% UNLESS ( loop.count % 5 ) %]</tr><tr>[% END %][% END %]
195
    [% END %]
209
    [% END %]
196
- 

Return to bug 10937