Bug 10937: cleanup and rename DOCTYPECAT to ITEMTYPECAT
- "Item" and not "Document" is the word used throughout Koha. - Moved the updates to an atomic update - changed searchcategory from varchar(20) to (80) - cleanup
This commit is contained in:
parent
30edfbfa58
commit
96b05f3535
|
|
@ -31,7 +31,6 @@ use DateTime::Format::MySQL;
|
|||
use Business::ISBN;
|
||||
use autouse 'Data::cselectall_arrayref' => qw(Dumper);
|
||||
use DBI qw(:sql_types);
|
||||
use Data::Dumper;
|
||||
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG);
|
||||
|
||||
BEGIN {
|
||||
|
|
@ -281,7 +280,7 @@ sub GetItemTypes {
|
|||
|
||||
Returns a hashref containing search categories.
|
||||
A search category will be put in the hash if at least one of its itemtypes is visible in OPAC.
|
||||
The categories must be part of Authorized Values (DOCTYPECAT)
|
||||
The categories must be part of Authorized Values (ITEMTYPECAT)
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ if ( $op eq 'list' ) {
|
|||
}
|
||||
|
||||
# push koha system categories
|
||||
foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP DEPARTMENT TERM SUGGEST_STATUS DOCTYPECAT)) {
|
||||
foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP DEPARTMENT TERM SUGGEST_STATUS ITEMTYPECAT)) {
|
||||
push @category_list, $_ unless $categories{$_};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ if ( $op eq 'add_form' ) {
|
|||
$remote_image = $data->{imageurl};
|
||||
}
|
||||
|
||||
my $searchcategory = GetAuthorisedValues("DOCTYPECAT", $data->{'searchcategory'});
|
||||
my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", $data->{'searchcategory'});
|
||||
|
||||
$template->param(
|
||||
itemtype => $itemtype,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use C4::Context;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my $DBversion = "3.21.00.XXX";
|
||||
#if ( CheckVersion($DBversion) ) {
|
||||
$dbh->do(q{
|
||||
ALTER TABLE itemtypes
|
||||
ADD hideinopac TINYINT(1) NOT NULL DEFAULT 0 AFTER sip_media_type,
|
||||
ADD searchcategory VARCHAR(80) DEFAULT NULL AFTER hideinopac;
|
||||
});
|
||||
print "Upgrade to $DBversion done (Bug 10937 - Option to hide and group itemtypes from advanced search)\n";
|
||||
# SetVersion($DBversion);
|
||||
#}
|
||||
|
|
@ -1275,7 +1275,7 @@ CREATE TABLE `itemtypes` ( -- defines the item types
|
|||
checkinmsgtype CHAR(16) DEFAULT 'message' NOT NULL, -- type (CSS class) for the checkinmsg, can be "alert" or "message"
|
||||
sip_media_type VARCHAR(3) DEFAULT NULL, -- SIP2 protocol media type for this itemtype
|
||||
hideinopac tinyint(1) NOT NULL DEFAULT 0, -- Hide the item type from the search options in OPAC
|
||||
searchcategory varchar(20) default NULL, -- Group this item type with others with the same value on OPAC search options
|
||||
searchcategory varchar(80) default NULL, -- Group this item type with others with the same value on OPAC search options
|
||||
PRIMARY KEY (`itemtype`),
|
||||
UNIQUE KEY `itemtype` (`itemtype`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ Item types administration
|
|||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
(Options are defined as the authorized values for the DOCTYPECAT category)
|
||||
(Options are defined as the authorized values for the ITEMTYPECAT category)
|
||||
</li>
|
||||
|
||||
[% IF ( noItemTypeImages ) %]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use strict;
|
|||
use warnings;
|
||||
use C4::Context;
|
||||
use Koha::DateUtils qw(dt_from_string);
|
||||
use Data::Dumper;
|
||||
|
||||
use Test::More tests => 9;
|
||||
use DateTime::Format::MySQL;
|
||||
|
|
@ -316,7 +315,7 @@ subtest 'GetFrameworksLoop() tests' => sub {
|
|||
subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{
|
||||
plan tests => 7;
|
||||
|
||||
my $insertGroup = AddAuthorisedValue('DOCTYPECAT', 'Qwertyware');
|
||||
my $insertGroup = AddAuthorisedValue('ITEMTYPECAT', 'Qwertyware');
|
||||
ok($insertGroup, "Create group Qwertyware");
|
||||
|
||||
my $query = "INSERT into itemtypes (itemtype, description, searchcategory, hideinopac) values (?,?,?,?)";
|
||||
|
|
@ -334,7 +333,7 @@ subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{
|
|||
is_deeply(\@results,\@expected,'GetItemTypesByCategory: valid category returns itemtypes');
|
||||
|
||||
# add more data since GetItemTypesCategorized's search is more subtle
|
||||
$insertGroup = AddAuthorisedValue('DOCTYPECAT', 'Veryheavybook');
|
||||
$insertGroup = AddAuthorisedValue('ITEMTYPECAT', 'Veryheavybook');
|
||||
$insertSth->execute('BKghjklo4', 'Another hidden book', 'Veryheavybook', 1);
|
||||
|
||||
my $hrCat = GetItemTypesCategorized();
|
||||
|
|
|
|||
Loading…
Reference in New Issue