@@ -, +, @@
(stockrotationstages, stockrotationitems): New tables.
userpermissions.
Add Stockrotation menu.
---
.../mysql/atomicupdate/stockrot_tables.sql | 69 +++++++++++++++++++
installer/data/mysql/kohastructure.sql | 54 +++++++++++++++
installer/data/mysql/sysprefs.sql | 4 +-
installer/data/mysql/userflags.sql | 1 +
installer/data/mysql/userpermissions.sql | 2 +
.../prog/en/includes/permissions.inc | 4 ++
.../admin/preferences/circulation.pref | 13 ++++
7 files changed, 146 insertions(+), 1 deletion(-)
create mode 100644 installer/data/mysql/atomicupdate/stockrot_tables.sql
--- a/installer/data/mysql/atomicupdate/stockrot_tables.sql
+++ a/installer/data/mysql/atomicupdate/stockrot_tables.sql
@@ -0,0 +1,69 @@
+-- Stock Rotation Rotas
+
+CREATE TABLE IF NOT EXISTS stockrotationrotas (
+ rota_id int(11) auto_increment, -- Stockrotation rota ID
+ title varchar(100) NOT NULL, -- Title for this rota
+ description text NOT NULL default '', -- Description for this rota
+ cyclical tinyint(1) NOT NULL default 0, -- Should items on this rota keep cycling?
+ active tinyint(1) NOT NULL default 0, -- Is this rota currently active?
+ PRIMARY KEY (`rota_id`),
+ CONSTRAINT `stockrotationrotas_title`
+ UNIQUE (`title`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- Stock Rotation Stages
+
+CREATE TABLE IF NOT EXISTS stockrotationstages (
+ stage_id int(11) auto_increment, -- Unique stage ID
+ position int(11) NOT NULL, -- The position of this stage within its rota
+ rota_id int(11) NOT NULL, -- The rota this stage belongs to
+ branchcode_id varchar(10) NOT NULL, -- Branch this stage relates to
+ duration int(11) NOT NULL default 4, -- The number of days items shoud occupy this stage
+ PRIMARY KEY (`stage_id`),
+ CONSTRAINT `stockrotationstages_rifk`
+ FOREIGN KEY (`rota_id`)
+ REFERENCES `stockrotationrotas` (`rota_id`)
+ ON UPDATE CASCADE ON DELETE CASCADE,
+ CONSTRAINT `stockrotationstages_bifk`
+ FOREIGN KEY (`branchcode_id`)
+ REFERENCES `branches` (`branchcode`)
+ ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- Stock Rotation Items
+
+CREATE TABLE IF NOT EXISTS stockrotationitems (
+ itemnumber_id int(11) NOT NULL, -- Itemnumber to link to a stage & rota
+ stage_id int(11) NOT NULL, -- stage ID to link the item to
+ indemand tinyint(1) NOT NULL default 0, -- Should this item be skipped for rotation?
+ fresh tinyint(1) NOT NULL default 0, -- Flag showing item is only just added to rota
+ PRIMARY KEY (itemnumber_id),
+ CONSTRAINT `stockrotationitems_iifk`
+ FOREIGN KEY (`itemnumber_id`)
+ REFERENCES `items` (`itemnumber`)
+ ON UPDATE CASCADE ON DELETE CASCADE,
+ CONSTRAINT `stockrotationitems_sifk`
+ FOREIGN KEY (`stage_id`)
+ REFERENCES `stockrotationstages` (`stage_id`)
+ ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- System preferences
+
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
+ ('StockRotation','0','If ON, enables the stock rotation module','','YesNo'),
+ ('RotationPreventTransfers','0','If ON, prevent any transfers for items on stock rotation rotas, except for stock rotation transfers','','YesNo');
+
+-- Permissions
+
+INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES
+ (24, 'stockrotation', 'Manage stockrotation operations', 0);
+
+INSERT IGNORE INTO permissions (module_bit, code, description) VALUES
+ (24, 'manage_rotas', 'Create, edit and delete rotas'),
+ (24, 'manage_rota_items', 'Add and remove items from rotas');
+
+-- Notices
+
+INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) VALUES
+ ('circulation', 'SR_SLIP', '', 'Stock Rotation Slip', 0, 'Stockrotation Report', 'Stockrotation report for [% branch.name %]:\r\n\r\n[% IF branch.items.size %][% branch.items.size %] items to be processed for this branch.\r\n[% ELSE %]No items to be processed for this branch\r\n[% END %][% FOREACH item IN branch.items %][% IF item.reason ne \'in-demand\' %]Title: [% item.title %]\r\nAuthor: [% item.author %]\r\nCallnumber: [% item.callnumber %]\r\nLocation: [% item.location %]\r\nBarcode: [% item.barcode %]\r\nOn loan?: [% item.onloan %]\r\nStatus: [% item.reason %]\r\nCurrent Library: [% item.branch.branchname %] [% item.branch.branchcode %]\r\n\r\n[% END %][% END %]', 'email');
--- a/installer/data/mysql/kohastructure.sql
+++ a/installer/data/mysql/kohastructure.sql
@@ -4152,6 +4152,40 @@ CREATE TABLE illrequests (
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+--
+-- Table structure for table `stockrotationrotas`
+--
+
+CREATE TABLE IF NOT EXISTS stockrotationrotas (
+ rota_id int(11) auto_increment, -- Stockrotation rota ID
+ title varchar(100) NOT NULL, -- Title for this rota
+ description text NOT NULL default '', -- Description for this rota
+ cyclical tinyint(1) NOT NULL default 0, -- Should items on this rota keep cycling?
+ active tinyint(1) NOT NULL default 0, -- Is this rota currently active?
+ PRIMARY KEY (`rota_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table `stockrotationstages`
+--
+
+CREATE TABLE IF NOT EXISTS stockrotationstages (
+ stage_id int(11) auto_increment, -- Unique stage ID
+ position int(11) NOT NULL, -- The position of this stage within its rota
+ rota_id int(11) NOT NULL, -- The rota this stage belongs to
+ branchcode_id varchar(10) NOT NULL, -- Branch this stage relates to
+ duration int(11) NOT NULL default 4, -- The number of days items shoud occupy this stage
+ PRIMARY KEY (`stage_id`),
+ CONSTRAINT `stockrotationstages_rifk`
+ FOREIGN KEY (`rota_id`)
+ REFERENCES `stockrotationrotas` (`rota_id`)
+ ON UPDATE CASCADE ON DELETE CASCADE,
+ CONSTRAINT `stockrotationstages_bifk`
+ FOREIGN KEY (`branchcode_id`)
+ REFERENCES `branches` (`branchcode`)
+ ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
--
-- Table structure for table `illrequestattributes`
--
@@ -4202,6 +4236,26 @@ CREATE TABLE `oauth_access_tokens` (
PRIMARY KEY (`access_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+--
+-- Table structure for table `stockrotationitems`
+--
+
+CREATE TABLE IF NOT EXISTS stockrotationitems (
+ itemnumber_id int(11) NOT NULL, -- Itemnumber to link to a stage & rota
+ stage_id int(11) NOT NULL, -- stage ID to link the item to
+ indemand tinyint(1) NOT NULL default 0, -- Should this item be skipped for rotation?
+ fresh tinyint(1) NOT NULL default 0, -- Flag showing item is only just added to rota
+ PRIMARY KEY (itemnumber_id),
+ CONSTRAINT `stockrotationitems_iifk`
+ FOREIGN KEY (`itemnumber_id`)
+ REFERENCES `items` (`itemnumber`)
+ ON UPDATE CASCADE ON DELETE CASCADE,
+ CONSTRAINT `stockrotationitems_sifk`
+ FOREIGN KEY (`stage_id`)
+ REFERENCES `stockrotationstages` (`stage_id`)
+ ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
--- a/installer/data/mysql/sysprefs.sql
+++ a/installer/data/mysql/sysprefs.sql
@@ -611,5 +611,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'),
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
-('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
+('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
+('StockRotation','0',NULL,'If ON, enables the stock rotation module','YesNo'),
+('RotationPreventTransfers','0',NULL,'If ON, prevent any transfers for items on stock rotation rotas, except for stock rotation transfers','YesNo')
;
--- a/installer/data/mysql/userflags.sql
+++ a/installer/data/mysql/userflags.sql
@@ -20,4 +20,5 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES
(21, 'clubs', 'Patron clubs', '0'),
(22,'ill','The Interlibrary Loans Module',0),
(23,'self_check','Self check modules',0)
+(24, 'stockrotation', 'Manage stockrotation operations', 0)
;
--- a/installer/data/mysql/userpermissions.sql
+++ a/installer/data/mysql/userpermissions.sql
@@ -89,4 +89,6 @@ INSERT INTO permissions (module_bit, code, description) VALUES
(21, 'enroll', 'Enroll patrons in clubs'),
(23, 'self_checkin_module', 'Log into the self check-in module'),
(23, 'self_checkout_module', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID')
+ (24, 'manage_rotas', 'Create, edit and delete rotas'),
+ (24, 'manage_rota_items', 'Add and remove items from rotas')
;
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
@@ -21,6 +21,7 @@
[%- CASE 'clubs' -%]Patron clubs
[%- CASE 'ill' -%]Create and modify Interlibrary loan requests
[%- CASE 'self_check' -%]Self check modules
+ [%- CASE 'stockrotation' -%]Manage stockrotation operations
[%- END -%]
[%- END -%]
@@ -118,4 +119,7 @@
[%- CASE 'self_checkin_module' -%]Log into the self check-in module. Note: this permission prevents the patron from using any other OPAC functionality
[%- CASE 'self_checkout_module' -%]Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID
[%- END -%]
+ [%- CASE 'can_add_items_rotas' -%]Add and remove items from rotas
+ [%- CASE 'can_edit_rotas' -%]Create, edit and delete rotas
+ [%- END -%]
[%- END -%]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
@@ -936,6 +936,19 @@ Circulation:
yes: Enable
no: Disable
- "housebound module"
+ Stockrotation module:
+ -
+ - pref: StockRotation
+ choices:
+ yes: Enable
+ no: Disable
+ - "the stock rotation module"
+ -
+ - pref: RotationPreventTransfers
+ choices:
+ yes: Disallow
+ no: Allow
+ - "library transfers on items in stockrotation rotas"
Article Requests:
-
- pref: ArticleRequests
--