From 6061a316d78ac85df94d58d49b77212ab3fc2f17 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 5 Dec 2019 08:54:49 -0500 Subject: [PATCH] Bug 24857: Update Database We have a partner that needs Volume Level Holds. This is a feature that some ILSs have that allows the creation of volumes at the bibliographic level, with items being optionally assigned to a given volume. This facilitates the ability to place holds at a volume level, rather than on a specific item or any available item on a record. Test Plan: 1) Apply the patches for this bug 2) Run updatedatabase.pl 3) Restart all the things! 4) Enable the new syspref EnableVolumes 5) Browse to detail.pl for a record with items 6) Note the new volumes tab 7) Test creating, editing and deleting volumes 8) On the Holdings tab, select one or more items using the checkboxes 8) Note new selection options for setting a volume for items, and for clearing a volume for items. 9) Test adding and clearing the volume set for items Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Rebecca Coert Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/volumes.perl | 40 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 31 ++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../admin/preferences/circulation.pref | 8 +++- 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/volumes.perl diff --git a/installer/data/mysql/atomicupdate/volumes.perl b/installer/data/mysql/atomicupdate/volumes.perl new file mode 100644 index 0000000000..7f60669fe8 --- /dev/null +++ b/installer/data/mysql/atomicupdate/volumes.perl @@ -0,0 +1,40 @@ +$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'); + }); + + 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 02cf864ddd..58c8546e1a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1807,6 +1807,37 @@ CREATE TABLE `club_fields` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `volumes` +-- + +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 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `volume_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 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `club_holds` -- diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 59db857ca6..a3ffb6d6ec 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -721,6 +721,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'), ('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'), ('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'), +('EnableVolumes','0','','Enable volumes feature','YesNo'), ('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'), ('viewLabeledMARC','0','','Allow display of labeled MARC view of bibiographic records','YesNo'), ('viewMARC','1','','Allow display of MARC view of bibiographic records','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index fc07ec1ed6..78752c3311 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -660,7 +660,13 @@ Circulation: - 'the last patron to return an item. This setting is independent of the opacreadinghistory and AnonymousPatron system preferences.' Holds policy: - - - In the staff interface, split the holds queue into separate tables by + - pref: EnableVolumes + choices: + yes: Enable + no: "Don't enable" + - volumes feature to allow collecting groups of items on a record into volumes. + - + - In the staff client, split the holds queue into separate tables by - pref: HoldsSplitQueue choices: nothing: nothing -- 2.33.0