From d74bea82e0f21b326f56266196b114eaa2c3d4b9 Mon Sep 17 00:00:00 2001 From: Jake Deery Date: Mon, 1 Dec 2025 14:52:32 +0000 Subject: [PATCH] Bug 14962: On Display atomicupdate - DO NOT PUSH --- .../mysql/atomicupdate/temporary_shelves.pl | 112 ++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 + installer/data/mysql/mandatory/userflags.sql | 3 +- .../data/mysql/mandatory/userpermissions.sql | 8 +- 4 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/temporary_shelves.pl diff --git a/installer/data/mysql/atomicupdate/temporary_shelves.pl b/installer/data/mysql/atomicupdate/temporary_shelves.pl new file mode 100644 index 00000000000..368a3dc6920 --- /dev/null +++ b/installer/data/mysql/atomicupdate/temporary_shelves.pl @@ -0,0 +1,112 @@ +use Modern::Perl; + +return { + bug_number => "", + description => "Add display tables for display module", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Create displays table + unless ( TableExists('displays') ) { + $dbh->do( + q{ + CREATE TABLE IF NOT EXISTS `displays` ( + `display_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique id for the display', + `display_name` varchar(255) DEFAULT NULL COMMENT 'the name of the display', + `start_date` date DEFAULT NULL COMMENT 'the start date of the display (optional)', + `end_date` date DEFAULT NULL COMMENT 'the end date of the display (optional)', + `enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'determines whether the display is active', + `display_location` varchar(80) DEFAULT NULL COMMENT 'the shelving location for the display (optional)', + `display_code` varchar(80) DEFAULT NULL COMMENT 'the collection code for the display (optional)', + `display_branch` varchar(10) DEFAULT NULL COMMENT 'a new home branch for the item to have while on display (optional)', + `display_holding_branch` varchar(10) DEFAULT NULL COMMENT 'a new holding branch for the item to have while on display (optional)', + `display_itype` varchar(10) DEFAULT NULL COMMENT 'a new itype for the item to have while on display (optional)', + `staff_note` mediumtext DEFAULT NULL COMMENT 'staff note for the display', + `public_note` mediumtext DEFAULT NULL COMMENT 'public note for the display', + `display_days` int(11) DEFAULT NULL COMMENT 'default number of days items will remain on display', + `display_return_over` enum('yes - any library','yes - except at home library','no') NOT NULL DEFAULT 'no' COMMENT 'should the item be removed from the display when it is returned', + PRIMARY KEY (`display_id`), + KEY `display_branch` (`display_branch`), + KEY `display_holding_branch` (`display_holding_branch`), + KEY `display_itype` (`display_itype`), + CONSTRAINT `displays_ibfk_1` FOREIGN KEY (`display_branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `displays_ibfk_2` FOREIGN KEY (`display_holding_branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `displays_ibfk_3` FOREIGN KEY (`display_itype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci + } + ); + + say $out "Added new table 'displays'"; + } + + # Create display_items table + unless ( TableExists('display_items') ) { + $dbh->do( + q{ + CREATE TABLE IF NOT EXISTS `display_items` ( + `display_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + `display_id` int(11) NOT NULL COMMENT 'foreign key to link to displays.display_id', + `itemnumber` int(11) DEFAULT NULL COMMENT 'items.itemnumber for the item on display', + `biblionumber` int(11) DEFAULT NULL COMMENT 'biblio.biblionumber for the bibliographic record on display', + `date_added` date DEFAULT NULL COMMENT 'the date the item was added to the display', + `date_remove` date DEFAULT NULL COMMENT 'the date the item should be removed from the display', + PRIMARY KEY (`display_item_id`), + UNIQUE KEY `display_items_uniq` (`display_id`,`itemnumber`), + KEY `display_id` (`display_id`), + KEY `itemnumber` (`itemnumber`), + KEY `biblionumber` (`biblionumber`), + CONSTRAINT `display_items_ibfk_1` FOREIGN KEY (`display_id`) REFERENCES `displays` (`display_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `display_items_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `display_items_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci + } + ); + + say $out "Added new table 'display_items'"; + } + + # Add UseDisplayModule system preference + $dbh->do( + q{ + INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) + VALUES ('UseDisplayModule', '0', NULL, 'Enable the display module for managing item displays.', 'YesNo') + } + ); + say $out "Added UseDisplayModule system preference"; + + # Add displays user flag + $dbh->do( + q{ + INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) + VALUES (31, 'displays', 'Display module', 0) + } + ); + say $out "Added displays user flag"; + + # Add display permissions + $dbh->do( + q{ + INSERT IGNORE INTO permissions (module_bit, code, description) VALUES + (31, 'add_display', 'Add displays'), + (31, 'edit_display', 'Edit displays'), + (31, 'delete_display', 'Delete displays'), + (31, 'add_items_to_display', 'Add items to displays'), + (31, 'add_items_to_display_from_any_libraries', 'Add items to displays from any libraries'), + (31, 'remove_items_from_display', 'Remove items from displays') + } + ); + say $out "Added display permissions"; + + # Add ft_display_group column to library_groups table + unless ( column_exists( 'library_groups', 'ft_display_group' ) ) { + $dbh->do( + q{ + ALTER TABLE library_groups + ADD COLUMN `ft_display_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Use this group to identify libraries that can share display items' AFTER `ft_local_float_group` + } + ); + say $out "Added ft_display_group column to library_groups table"; + } + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 35a5d15dd8f..983dc98915a 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -225,6 +225,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('DisplayClearScreenButton','no','no|issueslip|issueqslip','If set to ON, a clear screen button will appear on the circulation page.','Choice'), ('displayFacetCount','0',NULL,NULL,'YesNo'), ('DisplayIconsXSLT','1','','If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages.','YesNo'), +('DisplayItemsLog','1',NULL,'If ON, log create/edit/delete actions on display items.','YesNo'), ('DisplayLibraryFacets', 'holding', 'home|holding|both', 'Defines which library facets to display.', 'Choice'), ('DisplayMultiItemHolds','0','','Display the ability to place holds on different items at the same time in staff interface and OPAC','YesNo'), ('DisplayMultiPlaceHold','1','','Display the ability to place multiple holds or not','YesNo'), @@ -868,6 +869,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UseCirculationDesks','0','','Use circulation desks with circulation.','YesNo'), ('UseControlNumber','0','','If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','YesNo'), ('UseCourseReserves','0',NULL,'Enable the course reserves feature.','YesNo'), +('UseDisplayModule','0',NULL,'Enable the display module for managing item displays.','YesNo'), ('useDaysMode','Calendar','Calendar|Days|Datedue|Dayweek','Choose the method for calculating due date: select Calendar, Datedue or Dayweek to use the holidays module, and Days to ignore the holidays module','Choice'), ('useDefaultReplacementCost', '0', NULL, 'default replacement cost defined in item type', 'YesNo'), ('useDischarge','0','','Allows librarians to discharge borrowers and borrowers to request a discharge','YesNo'), diff --git a/installer/data/mysql/mandatory/userflags.sql b/installer/data/mysql/mandatory/userflags.sql index 0a30014f66b..d6af0d0f4a9 100644 --- a/installer/data/mysql/mandatory/userflags.sql +++ b/installer/data/mysql/mandatory/userflags.sql @@ -28,5 +28,6 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (28, 'erm', 'Manage electronic resources', 0), (29, 'loggedinlibrary', 'Change logged in library', 0), (30, 'preservation', 'Preservation module', 0), -(31, 'sip2', 'SIP2 module', 0) +(31, 'sip2', 'SIP2 module', 0), +(32, 'displays', 'Display module', 0) ; diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 34b868d2d53..2492df4fc5a 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -169,5 +169,11 @@ INSERT INTO permissions (module_bit, code, description) VALUES (25, 'cashup', 'Perform cash register cashup action'), (25, 'takepayment', 'Access the point of sale page and take payments'), (26, 'manage_problem_reports', 'Manage OPAC problem reports'), - (27, 'manage_recalls', 'Manage recalls for patrons') + (27, 'manage_recalls', 'Manage recalls for patrons'), + (31, 'add_display', 'Add displays'), + (31, 'edit_display', 'Edit displays'), + (31, 'delete_display', 'Delete displays'), + (31, 'add_items_to_display', 'Add items to displays'), + (31, 'add_items_to_display_from_any_libraries', 'Add items to displays from any libraries'), + (31, 'remove_items_from_display', 'Remove items from displays') ; -- 2.50.1 (Apple Git-155)