From 925ca3fe744b63c8b704a0609feae6f106f549bc Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 18 Aug 2021 10:35:14 -0300 Subject: [PATCH] Bug 24857: Rename Volumes => Item groups (DB) This patch renames Volumes => Item groups in the DB structure, and also on permissions and sysprefs. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/Schema/Result/Biblio.pm | 23 ++- Koha/Schema/Result/Item.pm | 23 ++- .../Schema/Result/{Volume.pm => ItemGroup.pm} | 74 ++++++--- Koha/Schema/Result/ItemGroupItem.pm | 155 ++++++++++++++++++ Koha/Schema/Result/VolumeItem.pm | 131 --------------- .../atomicupdate/bug_24857_item_groups.pl | 49 ++++++ .../data/mysql/atomicupdate/volumes.perl | 45 ----- installer/data/mysql/kohastructure.sql | 42 ++--- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../data/mysql/mandatory/userpermissions.sql | 2 +- 10 files changed, 316 insertions(+), 230 deletions(-) rename Koha/Schema/Result/{Volume.pm => ItemGroup.pm} (53%) create mode 100644 Koha/Schema/Result/ItemGroupItem.pm delete mode 100644 Koha/Schema/Result/VolumeItem.pm create mode 100755 installer/data/mysql/atomicupdate/bug_24857_item_groups.pl delete mode 100644 installer/data/mysql/atomicupdate/volumes.perl diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 9e652d1028..1dfbdff777 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -315,6 +315,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 item_groups + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "item_groups", + "Koha::Schema::Result::ItemGroup", + { "foreign.biblio_id" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 items Type: has_many @@ -511,8 +526,12 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-27 08:42:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fsBT6f/ma1fDlGQoauO7Uw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+wyHrHxnufn5n/hF2mfB6Q +======= +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BILvOleQqOV6/Apcx7kXVg +>>>>>>> Bug 24857: Rename Volumes => Item groups (DB) __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index a53e10e98a..6c421a329f 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -729,6 +729,21 @@ __PACKAGE__->might_have( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 item_group_items + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "item_group_items", + "Koha::Schema::Result::ItemGroupItem", + { "foreign.item_id" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 items_last_borrower Type: might_have @@ -865,8 +880,12 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-27 08:42:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SjZn3haOtUZWu1jrMigjNQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1mLs4vLD2LsJGkBKZCZbXg +======= +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WG9AuZsBgTMEWjlfwFQdeA +>>>>>>> Bug 24857: Rename Volumes => Item groups (DB) __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); diff --git a/Koha/Schema/Result/Volume.pm b/Koha/Schema/Result/ItemGroup.pm similarity index 53% rename from Koha/Schema/Result/Volume.pm rename to Koha/Schema/Result/ItemGroup.pm index ea5d446dba..ab34f0a15c 100644 --- a/Koha/Schema/Result/Volume.pm +++ b/Koha/Schema/Result/ItemGroup.pm @@ -1,12 +1,12 @@ use utf8; -package Koha::Schema::Result::Volume; +package Koha::Schema::Result::ItemGroup; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE =head1 NAME -Koha::Schema::Result::Volume +Koha::Schema::Result::ItemGroup =cut @@ -15,38 +15,53 @@ use warnings; use base 'DBIx::Class::Core'; -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("volumes"); +__PACKAGE__->table("item_groups"); =head1 ACCESSORS -=head2 id +=head2 item_group_id data_type: 'integer' is_auto_increment: 1 is_nullable: 0 -=head2 biblionumber +id for the items group + +=head2 biblio_id data_type: 'integer' default_value: 0 is_foreign_key: 1 is_nullable: 0 +id for the bibliographic record the group belongs to + +=head2 display_order + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + +The 'sort order' for item_groups + =head2 description data_type: 'mediumtext' is_nullable: 1 +A group description + =head2 created_on data_type: 'timestamp' datetime_undef_if_invalid: 1 - default_value: '0000-00-00 00:00:00' - is_nullable: 0 + is_nullable: 1 + +Time and date the group was created =head2 updated_on @@ -55,26 +70,29 @@ __PACKAGE__->table("volumes"); default_value: current_timestamp is_nullable: 0 +Time and date of the latest change on the group + =cut __PACKAGE__->add_columns( - "id", + "item_group_id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, - "biblionumber", + "biblio_id", { data_type => "integer", default_value => 0, is_foreign_key => 1, is_nullable => 0, }, + "display_order", + { data_type => "integer", default_value => 0, is_nullable => 0 }, "description", { data_type => "mediumtext", is_nullable => 1 }, "created_on", { data_type => "timestamp", datetime_undef_if_invalid => 1, - default_value => "0000-00-00 00:00:00", - is_nullable => 0, + is_nullable => 1, }, "updated_on", { @@ -89,17 +107,17 @@ __PACKAGE__->add_columns( =over 4 -=item * L +=item * L =back =cut -__PACKAGE__->set_primary_key("id"); +__PACKAGE__->set_primary_key("item_group_id"); =head1 RELATIONS -=head2 biblionumber +=head2 biblio Type: belongs_to @@ -108,30 +126,30 @@ Related object: L =cut __PACKAGE__->belongs_to( - "biblionumber", + "biblio", "Koha::Schema::Result::Biblio", - { biblionumber => "biblionumber" }, + { biblionumber => "biblio_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); -=head2 volume_items +=head2 item_group_items Type: has_many -Related object: L +Related object: L =cut __PACKAGE__->has_many( - "volume_items", - "Koha::Schema::Result::VolumeItem", - { "foreign.volume_id" => "self.id" }, + "item_group_items", + "Koha::Schema::Result::ItemGroupItem", + { "foreign.item_group_id" => "self.item_group_id" }, { cascade_copy => 0, cascade_delete => 0 }, ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-04 15:22:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cXvLM2TgY18pxE2ZJBMouw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uB7PHJt6WQHMv/saTCpkOw =head2 koha_objects_class @@ -144,9 +162,11 @@ sub koha_objects_class { =head2 koha_object_class =cut +======= +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1WBTrtEB25MCOwR4nqPpVA +>>>>>>> Bug 24857: Rename Volumes => Item groups (DB):Koha/Schema/Result/ItemGroup.pm -sub koha_object_class { - 'Koha::Biblio::Volume'; -} +# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/Koha/Schema/Result/ItemGroupItem.pm b/Koha/Schema/Result/ItemGroupItem.pm new file mode 100644 index 0000000000..847f957ed4 --- /dev/null +++ b/Koha/Schema/Result/ItemGroupItem.pm @@ -0,0 +1,155 @@ +use utf8; +package Koha::Schema::Result::ItemGroupItem; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::ItemGroupItem + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("item_group_items"); + +=head1 ACCESSORS + +=head2 item_group_items_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +id for the group/item link + +=head2 item_group_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +foreign key making this table a 1 to 1 join from items to item groups + +=head2 item_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +foreign key linking this table to the items table + +=cut + +__PACKAGE__->add_columns( + "item_group_items_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "item_group_id", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "item_id", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("item_group_items_id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("item_group_id", ["item_group_id", "item_id"]); + +=head1 RELATIONS + +=head2 item + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "item", + "Koha::Schema::Result::Item", + { itemnumber => "item_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 item_group + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "item_group", + "Koha::Schema::Result::ItemGroup", + { item_group_id => "item_group_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-01 12:37:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zfCA4diZgiexDnY1rD6xkQ + +=head2 koha_object_class + +=cut + +sub koha_object_class { + 'Koha::Biblio::Volume::Item'; +} + +=head2 koha_objects_class + +=cut +======= +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-18 14:00:35 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UkFl9MLWlH8wy3T/AaVIdQ +>>>>>>> Bug 24857: Rename Volumes => Item groups (DB):Koha/Schema/Result/ItemGroupItem.pm + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/VolumeItem.pm b/Koha/Schema/Result/VolumeItem.pm deleted file mode 100644 index c07fa97167..0000000000 --- a/Koha/Schema/Result/VolumeItem.pm +++ /dev/null @@ -1,131 +0,0 @@ -use utf8; -package Koha::Schema::Result::VolumeItem; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::VolumeItem - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("volume_items"); - -=head1 ACCESSORS - -=head2 id - - data_type: 'integer' - is_auto_increment: 1 - is_nullable: 0 - -=head2 volume_id - - data_type: 'integer' - default_value: 0 - is_foreign_key: 1 - is_nullable: 0 - -=head2 itemnumber - - data_type: 'integer' - default_value: 0 - is_foreign_key: 1 - is_nullable: 0 - -=cut - -__PACKAGE__->add_columns( - "id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, - "volume_id", - { - data_type => "integer", - default_value => 0, - is_foreign_key => 1, - is_nullable => 0, - }, - "itemnumber", - { - data_type => "integer", - default_value => 0, - is_foreign_key => 1, - is_nullable => 0, - }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 itemnumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "itemnumber", - "Koha::Schema::Result::Item", - { itemnumber => "itemnumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - -=head2 volume - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "volume", - "Koha::Schema::Result::Volume", - { id => "volume_id" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - - -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-03 18:25:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:i6YHB4Jq+79kVVYmuurzIQ - -=head2 koha_object_class - -=cut - -sub koha_object_class { - 'Koha::Biblio::Volume::Item'; -} - -=head2 koha_objects_class - -=cut - -sub koha_objects_class { - 'Koha::Biblio::Volume::Items'; -} - -1; diff --git a/installer/data/mysql/atomicupdate/bug_24857_item_groups.pl b/installer/data/mysql/atomicupdate/bug_24857_item_groups.pl new file mode 100755 index 0000000000..07daba7bfa --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24857_item_groups.pl @@ -0,0 +1,49 @@ +use Modern::Perl; + +{ + bug_number => "24857", + description => "Add ability to group items on a record", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('EnableItemGroups','0','','Enable the item groups feature','YesNo'); + }); + + $dbh->do(q{ + INSERT INTO permissions (module_bit, code, description) VALUES + ( 9, 'manage_item_groups', 'Create, update and delete item groups, add or remove items from a item groups'); + }); + + unless ( TableExists('item_groups') ) { + $dbh->do(q{ + CREATE TABLE `item_groups` ( + `item_group_id` INT(11) NOT NULL auto_increment COMMENT "id for the items group", + `biblio_id` INT(11) NOT NULL DEFAULT 0 COMMENT "id for the bibliographic record the group belongs to", + `display_order` INT(4) NOT NULL DEFAULT 0 COMMENT "The 'sort order' for item_groups", + `description` MEDIUMTEXT default NULL COMMENT "A group description", + `created_on` TIMESTAMP NULL COMMENT "Time and date the group was created", + `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Time and date of the latest change on the group", + PRIMARY KEY (`item_group_id`), + CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + + unless ( TableExists('item_group_items') ) { + $dbh->do(q{ + CREATE TABLE `item_group_items` ( + `item_group_items_id` int(11) NOT NULL auto_increment COMMENT "id for the group/item link", + `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups", + `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table", + PRIMARY KEY (`item_group_items_id`), + UNIQUE KEY (item_group_id,item_id), + CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `item_group_items_vifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + }, +} diff --git a/installer/data/mysql/atomicupdate/volumes.perl b/installer/data/mysql/atomicupdate/volumes.perl deleted file mode 100644 index c1886b3087..0000000000 --- a/installer/data/mysql/atomicupdate/volumes.perl +++ /dev/null @@ -1,45 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion( $DBversion ) ) { - $dbh->do(q{ - INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES - ('EnableVolumes','0','','Enable volumes feature','YesNo'); - }); - - $dbh->do(q{ - INSERT INTO permissions (module_bit, code, description) VALUES - ( 9, 'manage_volumes', 'Create, update and delete volumes, add or remove items from a volume'); - }); - - unless ( TableExists('volumes') ) { - $dbh->do(q{ - CREATE TABLE `volumes` ( -- information related to bibliographic records in Koha - `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha - `biblionumber` INT(11) NOT NULL default 0, -- foreign key linking this table to the biblio table - `display_order` INT(4) NOT NULL default 0, -- specifies the 'sort order' for volumes - `description` MEDIUMTEXT default NULL, -- equivilent to enumchron - `created_on` TIMESTAMP NULL, -- Time and date the volume was created - `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Time and date of the latest change on the volume (description) - PRIMARY KEY (`id`), - CONSTRAINT `volumes_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); - } - - unless ( TableExists('volume_items') ) { - $dbh->do(q{ - CREATE TABLE `volume_items` ( -- information related to bibliographic records in Koha - `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha - `volume_id` int(11) NOT NULL default 0, -- foreign key making this table a 1 to 1 join from items to volumes - `itemnumber` int(11) NOT NULL default 0, -- foreign key linking this table to the items table - PRIMARY KEY (`id`), - UNIQUE KEY (volume_id,itemnumber), - CONSTRAINT `volume_items_iifk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `volume_items_vifk_1` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); - } - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug XXXXX - Add ability to define volumes for items on a record)\n"; -} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 58c8546e1a..05fd10fef3 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1808,34 +1808,34 @@ CREATE TABLE `club_fields` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `volumes` +-- Table structure for table `item_groups` -- -DROP TABLE IF EXISTS `volumes`; -CREATE TABLE `volumes` ( -- information related to bibliographic records in Koha - `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha - `biblionumber` INT(11) NOT NULL default 0, -- foreign key linking this table to the biblio table - `display_order` INT(4) NOT NULL default 0, -- specifies the 'sort order' for volumes - `description` MEDIUMTEXT default NULL, -- equivilent to enumchron - `created_on` TIMESTAMP NULL, -- Time and date the volume was created - `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Time and date of the latest change on the volume (description) - PRIMARY KEY (`id`), - CONSTRAINT `volumes_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE +DROP TABLE IF EXISTS `item_groups`; +CREATE TABLE `item_groups` ( + `item_group_id` INT(11) NOT NULL auto_increment COMMENT "id for the items group", + `biblio_id` INT(11) NOT NULL DEFAULT 0 COMMENT "id for the bibliographic record the group belongs to", + `display_order` INT(4) NOT NULL DEFAULT 0 COMMENT "The 'sort order' for item_groups", + `description` MEDIUMTEXT default NULL COMMENT "A group description", + `created_on` TIMESTAMP NULL COMMENT "Time and date the group was created", + `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Time and date of the latest change on the group", + PRIMARY KEY (`item_group_id`), + CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- --- Table structure for table `volume_items` +-- Table structure for table `item_group_items` -- -DROP TABLE IF EXISTS `volume_items`; -CREATE TABLE `volume_items` ( -- information related to bibliographic records in Koha - `id` int(11) NOT NULL auto_increment, -- primary key, unique identifier assigned by Koha - `volume_id` int(11) NOT NULL default 0, -- foreign key making this table a 1 to 1 join from items to volumes - `itemnumber` int(11) NOT NULL default 0, -- foreign key linking this table to the items table - PRIMARY KEY (`id`), - UNIQUE KEY (volume_id,itemnumber), - CONSTRAINT `volume_items_iifk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `volume_items_vifk_1` FOREIGN KEY (`volume_id`) REFERENCES `volumes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +DROP TABLE IF EXISTS `item_group_items`; +CREATE TABLE `item_group_items` ( + `item_group_items_id` int(11) NOT NULL auto_increment COMMENT "id for the group/item link", + `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups", + `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table", + PRIMARY KEY (`item_group_items_id`), + UNIQUE KEY (item_group_id,item_id), + CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `item_group_items_vifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 69a935b0dc..07cc2e8f07 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -199,7 +199,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''), ('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'), ('EnableSearchHistory','0','','Enable or disable search history','YesNo'), -('EnableVolumes','0','','Enable volumes feature','YesNo'), +('EnableItemGroups','0','','Enable the item groups feature','YesNo'), ('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'), ('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'), ('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'), diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index b82c4f48bc..fda6d2dd36 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -49,7 +49,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_items', 'Edit items'), ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'), ( 9, 'delete_all_items', 'Delete all items at once'), - ( 9, 'manage_volumes', 'Create, update and delete volumes, add or remove items from a volume'), + ( 9, 'manage_item_groups', 'Create, update and delete item groups, add or remove items from a item groups'), (10, 'payout', 'Perform account payout action'), (10, 'refund', 'Perform account refund action'), (10, 'discount', 'Perform account discount action'), -- 2.20.1