@@ -, +, @@ and for clearing a volume for items. --- .../data/mysql/atomicupdate/volumes.perl | 40 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 31 ++++++++++++++ installer/data/mysql/sysprefs.sql | 1 + .../admin/preferences/circulation.pref | 8 +++- 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/volumes.perl --- a/installer/data/mysql/atomicupdate/volumes.perl +++ a/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"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1750,6 +1750,37 @@ CREATE TABLE `patronimage` ( -- information related to patron images CONSTRAINT `patronimage_fk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- 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 `reserves` -- --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -698,6 +698,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','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'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -628,7 +628,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 --