Bug 11897: Add Stock Rotation atomic update schema.
* installer/data/mysql/atomicupdate/stockrot_tables.sql: New file. * installer/data/mysql/kohastructure.sql (stockrotationrotas) (stockrotationstages, stockrotationitems): New tables. * installer/data/mysql/sysprefs.sql: Add Stockrotation sysprefs. * installer/data/mysql/userflags.sql: Add Stockrotaiton userflag. * installer/data/mysql/userpermissions.sql: Add Stockrotation userpermissions. * koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref: Add Stockrotation menu. Signed-off-by: Kathleen Milne <kathleen.milne@cne-siar.gov.uk> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
58314233f7
commit
5088e3084d
8 changed files with 149 additions and 2 deletions
69
installer/data/mysql/atomicupdate/stockrot_tables.sql
Normal file
69
installer/data/mysql/atomicupdate/stockrot_tables.sql
Normal file
|
@ -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=utf8mb4 COLLATE=utf8mb4_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=utf8mb4 COLLATE=utf8mb4_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=utf8mb4 COLLATE=utf8mb4_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');
|
|
@ -176,8 +176,9 @@ INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`
|
|||
('circulation', 'AR_SLIP', '', 'Article request - print slip', 0, 'Article request', 'Article request:\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nTitle: <<biblio.title>>\r\nBarcode: <<items.barcode>>\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\n', 'print'),
|
||||
('circulation', 'AR_PROCESSING', '', 'Article request - processing', 0, 'Article request processing', 'Dear <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>),\r\n\r\nWe are now processing your request for an article from <<biblio.title>> (<<items.barcode>>).\r\n\r\nArticle requested:\r\nTitle: <<article_requests.title>>\r\nAuthor: <<article_requests.author>>\r\nVolume: <<article_requests.volume>>\r\nIssue: <<article_requests.issue>>\r\nDate: <<article_requests.date>>\r\nPages: <<article_requests.pages>>\r\nChapters: <<article_requests.chapters>>\r\nNotes: <<article_requests.patron_notes>>\r\n\r\nThank you!', 'email'),
|
||||
('circulation', 'CHECKOUT_NOTE', '', 'Checkout note on item set by patron', '0', 'Checkout note', '<<borrowers.firstname>> <<borrowers.surname>> has added a note to the item <<biblio.title>> - <<biblio.author>> (<<biblio.biblionumber>>).','email');
|
||||
|
||||
INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`)
|
||||
VALUES
|
||||
('circulation', 'ACCOUNT_PAYMENT', '', 'Account payment', 0, 'Account payment', '[%- USE Price -%]\r\nA payment of [% credit.amount * -1 | $Price %] has been applied to your account.\r\n\r\nThis payment affected the following fees:\r\n[%- FOREACH o IN offsets %]\r\nDescription: [% o.debit.description %]\r\nAmount paid: [% o.amount * -1 | $Price %]\r\nAmount remaining: [% o.debit.amountoutstanding | $Price %]\r\n[% END %]', 'email', 'default'),
|
||||
('circulation', 'ACCOUNT_WRITEOFF', '', 'Account writeoff', 0, 'Account writeoff', '[%- USE Price -%]\r\nAn account writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.\r\n\r\nThis writeoff affected the following fees:\r\n[%- FOREACH o IN offsets %]\r\nDescription: [% o.debit.description %]\r\nAmount paid: [% o.amount * -1 | $Price %]\r\nAmount remaining: [% o.debit.amountoutstanding | $Price %]\r\n[% END %]', 'email', 'default');
|
||||
INSERT 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');
|
||||
|
|
|
@ -4197,7 +4197,7 @@ CREATE TABLE library_groups (
|
|||
description MEDIUMTEXT NULL DEFAULT NULL, -- Longer explanation of the group, if necessary
|
||||
ft_hide_patron_info tinyint(1) NOT NULL DEFAULT 0, -- Turn on the feature "Hide patron's info" for this group
|
||||
ft_search_groups_opac tinyint(1) NOT NULL DEFAULT 0, -- Use this group for staff side search groups
|
||||
ft_search_groups_staff tinyint(1) NOT NULL DEFAULT 0, -- Use this group for opac side search groups
|
||||
ft_search_groups_staff tinyint(1) NOT NULL DEFAULT 0, -- Use this group for opac side search groups
|
||||
created_on TIMESTAMP NULL, -- Date and time of creation
|
||||
updated_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Date and time of last
|
||||
PRIMARY KEY id ( id ),
|
||||
|
@ -4238,6 +4238,60 @@ CREATE TABLE `circulation_rules` (
|
|||
UNIQUE (`branchcode`,`categorycode`,`itemtype`,`rule_name`)
|
||||
) 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=utf8mb4 COLLATE=utf8mb4_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=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=utf8mb4 COLLATE=utf8mb4_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 */;
|
||||
|
|
|
@ -486,6 +486,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
|
|||
('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'),
|
||||
('RisExportAdditionalFields', '', NULL , 'Define additional RIS tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea'),
|
||||
('RoutingListAddReserves','0','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'),
|
||||
('RotationPreventTransfers','0',NULL,'If ON, prevent any transfers for items on stock rotation rotas, except for stock rotation transfers','YesNo'),
|
||||
('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'),
|
||||
('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'),
|
||||
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
|
||||
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
|
||||
|
@ -532,6 +534,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
|
|||
('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the Staff client','Integer'),
|
||||
('StaticHoldsQueueWeight','0',NULL,'Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective','Integer'),
|
||||
('StatisticsFields','location|itype|ccode', NULL, 'Define Fields (from the items table) used for statistics members','Free'),
|
||||
('StockRotation','0',NULL,'If ON, enables the stock rotation module','YesNo'),
|
||||
('StoreLastBorrower','0','','If ON, the last borrower to return an item will be stored in items.last_returned_by','YesNo'),
|
||||
('SubfieldsToAllowForRestrictedBatchmod','','Define a list of subfields for which edition is authorized when items_batchmod_restricted permission is enabled, separated by spaces. Example: 995\$f 995\$h 995\$j',NULL,'Free'),
|
||||
('SubfieldsToAllowForRestrictedEditing','','Define a list of subfields for which edition is authorized when edit_items_restricted permission is enabled, separated by spaces. Example: 995\$f 995\$h 995\$j',NULL,'Free'),
|
||||
|
|
|
@ -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)
|
||||
;
|
||||
|
|
|
@ -90,4 +90,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')
|
||||
;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
[%- CASE 'clubs' -%]<span>Patron clubs</span>
|
||||
[%- CASE 'ill' -%]<span>Create and modify Interlibrary loan requests</span>
|
||||
[%- CASE 'self_check' -%]<span>Self check modules</span>
|
||||
[%- CASE 'stockrotation' -%]<span>Manage stockrotation operations</span>
|
||||
[%- END -%]
|
||||
[%- END -%]
|
||||
|
||||
|
@ -119,4 +120,7 @@
|
|||
[%- CASE 'self_checkin_module' -%]<span>Log into the self check-in module. Note: this permission prevents the patron from using any other OPAC functionality</span>
|
||||
[%- CASE 'self_checkout_module' -%]<span>Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID</span>
|
||||
[%- END -%]
|
||||
[%- CASE 'can_add_items_rotas' -%]<span>Add and remove items from rotas</span>
|
||||
[%- CASE 'can_edit_rotas' -%]<span>Create, edit and delete rotas</span>
|
||||
[%- END -%]
|
||||
[%- END -%]
|
||||
|
|
|
@ -950,6 +950,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
|
||||
|
|
Loading…
Reference in a new issue