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

(-)a/C4/Koha.pm (-2 / +1 lines)
Lines 31-37 use DateTime::Format::MySQL; Link Here
31
use Business::ISBN;
31
use Business::ISBN;
32
use autouse 'Data::cselectall_arrayref' => qw(Dumper);
32
use autouse 'Data::cselectall_arrayref' => qw(Dumper);
33
use DBI qw(:sql_types);
33
use DBI qw(:sql_types);
34
 use Data::Dumper;
35
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG);
34
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG);
36
35
37
BEGIN {
36
BEGIN {
Lines 281-287 sub GetItemTypes { Link Here
281
280
282
Returns a hashref containing search categories.
281
Returns a hashref containing search categories.
283
A search category will be put in the hash if at least one of its itemtypes is visible in OPAC.
282
A search category will be put in the hash if at least one of its itemtypes is visible in OPAC.
284
The categories must be part of Authorized Values (DOCTYPECAT)
283
The categories must be part of Authorized Values (ITEMTYPECAT)
285
284
286
=cut
285
=cut
287
286
(-)a/admin/authorised_values.pl (-1 / +1 lines)
Lines 246-252 sub default_form { Link Here
246
    }
246
    }
247
247
248
    # push koha system categories
248
    # push koha system categories
249
    foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP DEPARTMENT TERM SUGGEST_STATUS DOCTYPECAT)) {
249
    foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP DEPARTMENT TERM SUGGEST_STATUS ITEMTYPECAT)) {
250
        push @category_list, $_ unless $categories{$_};
250
        push @category_list, $_ unless $categories{$_};
251
    }
251
    }
252
252
(-)a/admin/itemtypes.pl (-1 / +1 lines)
Lines 112-118 if ( $op eq 'add_form' ) { Link Here
112
        $remote_image = $data->{imageurl};
112
        $remote_image = $data->{imageurl};
113
    }
113
    }
114
114
115
    my $searchcategory = GetAuthorisedValues("DOCTYPECAT", $data->{'searchcategory'});
115
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", $data->{'searchcategory'});
116
116
117
    $template->param(
117
    $template->param(
118
        itemtype        => $itemtype,
118
        itemtype        => $itemtype,
(-)a/installer/data/mysql/atomicupdate/bz10937_group_item_types.pl (+20 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use strict;
4
use warnings;
5
use C4::Context;
6
7
my $dbh = C4::Context->dbh;
8
9
my $DBversion = "3.21.00.XXX";
10
#if ( CheckVersion($DBversion) ) {
11
    $dbh->do(q{
12
        ALTER TABLE itemtypes
13
            ADD hideinopac TINYINT(1) NOT NULL DEFAULT 0 AFTER sip_media_type,
14
            ADD searchcategory VARCHAR(80) DEFAULT NULL AFTER hideinopac;
15
    });
16
    print "Upgrade to $DBversion done (Bug 10937 - Option to hide and group itemtypes from advanced search)\n";
17
#    SetVersion($DBversion);
18
#}
19
 
20
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1283-1289 CREATE TABLE `itemtypes` ( -- defines the item types Link Here
1283
  checkinmsgtype CHAR(16) DEFAULT 'message' NOT NULL, -- type (CSS class) for the checkinmsg, can be "alert" or "message"
1283
  checkinmsgtype CHAR(16) DEFAULT 'message' NOT NULL, -- type (CSS class) for the checkinmsg, can be "alert" or "message"
1284
  sip_media_type VARCHAR(3) DEFAULT NULL, -- SIP2 protocol media type for this itemtype
1284
  sip_media_type VARCHAR(3) DEFAULT NULL, -- SIP2 protocol media type for this itemtype
1285
  hideinopac tinyint(1) NOT NULL DEFAULT 0, -- Hide the item type from the search options in OPAC
1285
  hideinopac tinyint(1) NOT NULL DEFAULT 0, -- Hide the item type from the search options in OPAC
1286
  searchcategory varchar(20) default NULL, -- Group this item type with others with the same value on OPAC search options
1286
  searchcategory varchar(80) default NULL, -- Group this item type with others with the same value on OPAC search options
1287
  PRIMARY KEY  (`itemtype`),
1287
  PRIMARY KEY  (`itemtype`),
1288
  UNIQUE KEY `itemtype` (`itemtype`)
1288
  UNIQUE KEY `itemtype` (`itemtype`)
1289
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1289
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-1 / +1 lines)
Lines 125-131 Item types administration Link Here
125
                    [% END %]
125
                    [% END %]
126
                [% END %]
126
                [% END %]
127
          </select>
127
          </select>
128
          (Options are defined as the authorized values for the DOCTYPECAT category)
128
          (Options are defined as the authorized values for the ITEMTYPECAT category)
129
      </li>
129
      </li>
130
130
131
     [% IF ( noItemTypeImages ) %]
131
     [% IF ( noItemTypeImages ) %]
(-)a/t/db_dependent/Koha.t (-4 / +2 lines)
Lines 7-13 use strict; Link Here
7
use warnings;
7
use warnings;
8
use C4::Context;
8
use C4::Context;
9
use Koha::DateUtils qw(dt_from_string);
9
use Koha::DateUtils qw(dt_from_string);
10
use Data::Dumper;
11
10
12
use Test::More tests => 9;
11
use Test::More tests => 9;
13
use DateTime::Format::MySQL;
12
use DateTime::Format::MySQL;
Lines 316-322 subtest 'GetFrameworksLoop() tests' => sub { Link Here
316
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{
315
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{
317
    plan tests => 7;
316
    plan tests => 7;
318
317
319
    my $insertGroup = AddAuthorisedValue('DOCTYPECAT', 'Qwertyware');
318
    my $insertGroup = AddAuthorisedValue('ITEMTYPECAT', 'Qwertyware');
320
    ok($insertGroup, "Create group Qwertyware");
319
    ok($insertGroup, "Create group Qwertyware");
321
320
322
    my $query = "INSERT into itemtypes (itemtype, description, searchcategory, hideinopac) values (?,?,?,?)";
321
    my $query = "INSERT into itemtypes (itemtype, description, searchcategory, hideinopac) values (?,?,?,?)";
Lines 334-340 subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ Link Here
334
    is_deeply(\@results,\@expected,'GetItemTypesByCategory: valid category returns itemtypes');
333
    is_deeply(\@results,\@expected,'GetItemTypesByCategory: valid category returns itemtypes');
335
334
336
    # add more data since GetItemTypesCategorized's search is more subtle
335
    # add more data since GetItemTypesCategorized's search is more subtle
337
    $insertGroup = AddAuthorisedValue('DOCTYPECAT', 'Veryheavybook');
336
    $insertGroup = AddAuthorisedValue('ITEMTYPECAT', 'Veryheavybook');
338
    $insertSth->execute('BKghjklo4', 'Another hidden book', 'Veryheavybook', 1);
337
    $insertSth->execute('BKghjklo4', 'Another hidden book', 'Veryheavybook', 1);
339
338
340
    my $hrCat = GetItemTypesCategorized();
339
    my $hrCat = GetItemTypesCategorized();
341
- 

Return to bug 10937