Bugzilla – Attachment 74197 Details for
Bug 11897
Stock Rotation for Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11897: Add Stock Rotation atomic update schema.
Bug-11897-Add-Stock-Rotation-atomic-update-schema.patch (text/plain), 11.99 KB, created by
Martin Renvoize (ashimema)
on 2018-04-16 08:11:11 UTC
(
hide
)
Description:
Bug 11897: Add Stock Rotation atomic update schema.
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-04-16 08:11:11 UTC
Size:
11.99 KB
patch
obsolete
>From 38cfff5a4195dca970e18fb323a4fce72836fb67 Mon Sep 17 00:00:00 2001 >From: Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com> >Date: Mon, 17 Oct 2016 18:20:44 +0200 >Subject: [PATCH] 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> >--- > .../data/mysql/atomicupdate/stockrot_tables.sql | 62 ++++++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 54 +++++++++++++++++++ > installer/data/mysql/sysprefs.sql | 4 +- > installer/data/mysql/userflags.sql | 1 + > installer/data/mysql/userpermissions.sql | 2 + > .../intranet-tmpl/prog/en/includes/permissions.inc | 4 ++ > .../en/modules/admin/preferences/circulation.pref | 13 +++++ > 7 files changed, 139 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/stockrot_tables.sql > >diff --git a/installer/data/mysql/atomicupdate/stockrot_tables.sql b/installer/data/mysql/atomicupdate/stockrot_tables.sql >new file mode 100644 >index 0000000000..8469d20ca7 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/stockrot_tables.sql >@@ -0,0 +1,62 @@ >+-- 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`) >+) 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 >+ (23, 'stockrotation', 'Manage stockrotation operations', 0); >+ >+INSERT IGNORE INTO permissions (module_bit, code, description) VALUES >+ (23, 'can_edit_rotas', 'Create, edit and delete rotas'), >+ (23, 'can_add_items_rotas', 'Add and remove items from rotas'); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 52f0922967..eaf36f8036 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -4120,6 +4120,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` > -- >@@ -4158,6 +4192,26 @@ CREATE TABLE library_groups ( > UNIQUE KEY title ( title ) > ) 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 */; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index d443b3f216..3ed8e916e4 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -608,5 +608,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') > ; >diff --git a/installer/data/mysql/userflags.sql b/installer/data/mysql/userflags.sql >index 3e8f5dc244..7d185bed22 100644 >--- a/installer/data/mysql/userflags.sql >+++ b/installer/data/mysql/userflags.sql >@@ -21,4 +21,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) > ; >diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql >index 2ea387e8a5..82b1dc8b2a 100644 >--- a/installer/data/mysql/userpermissions.sql >+++ b/installer/data/mysql/userpermissions.sql >@@ -85,4 +85,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, 'can_edit_rotas', 'Create, edit and delete rotas'), >+ (24, 'can_add_items_rotas', 'Add and remove items from rotas') > ; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index 78f4995c23..80a7c8a3c7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -22,6 +22,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 -%] > >@@ -115,4 +116,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 -%] >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 8ec6a6b5b6..aba5c0ab0a 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 >@@ -901,6 +901,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 >-- >2.14.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11897
:
25887
|
58207
|
58208
|
58209
|
58210
|
58211
|
58212
|
58213
|
58214
|
58215
|
58216
|
58217
|
58218
|
58219
|
58280
|
58281
|
58687
|
58692
|
58693
|
58694
|
58695
|
58696
|
60175
|
60715
|
61825
|
61826
|
61827
|
61828
|
61829
|
61830
|
61831
|
61832
|
61833
|
61834
|
61835
|
61836
|
61837
|
61838
|
61839
|
61885
|
62730
|
62750
|
62751
|
62752
|
62753
|
62754
|
62755
|
62756
|
62757
|
62758
|
62759
|
62760
|
62761
|
62762
|
62763
|
62764
|
62765
|
62766
|
62767
|
63063
|
63064
|
63065
|
63066
|
63067
|
63068
|
63069
|
63070
|
63071
|
63072
|
63073
|
63074
|
63075
|
63076
|
63077
|
63078
|
63079
|
63080
|
63114
|
64850
|
64851
|
65715
|
65716
|
65717
|
65718
|
65719
|
65720
|
65721
|
65722
|
65723
|
65724
|
65725
|
65726
|
65727
|
65728
|
65729
|
65730
|
65731
|
65732
|
65733
|
65734
|
65735
|
65736
|
65737
|
65738
|
65739
|
65740
|
65741
|
65742
|
65743
|
65744
|
65745
|
65746
|
65747
|
65748
|
65749
|
65750
|
65751
|
65752
|
65753
|
65754
|
65755
|
65756
|
65757
|
65758
|
66381
|
70496
|
70497
|
70498
|
70499
|
70500
|
70501
|
70502
|
70503
|
70504
|
70505
|
70506
|
70507
|
70508
|
70509
|
70510
|
70511
|
70512
|
70513
|
70514
|
70515
|
70516
|
70517
|
70518
|
70519
|
70520
|
70521
|
70522
|
70523
|
70524
|
72124
|
72125
|
72126
|
72127
|
72128
|
74003
|
74004
|
74005
|
74006
|
74007
|
74008
|
74010
|
74011
|
74012
|
74013
|
74014
|
74015
|
74016
|
74017
|
74197
|
74198
|
74199
|
74200
|
74201
|
74202
|
74203
|
74204
|
74205
|
74206
|
74319
|
74320
|
74360
|
74459
|
74460
|
74461
|
74462
|
74463
|
74464
|
74465
|
74466
|
74467
|
74468
|
74469
|
74470
|
75409
|
75410
|
75411
|
75412
|
75413
|
75414
|
75415
|
75416
|
75417
|
75418
|
75419
|
75420
|
76121
|
76122
|
76123
|
76124
|
76125
|
76126
|
76127
|
76128
|
76129
|
76130
|
76131
|
76132
|
76133
|
76134
|
76135
|
76144
|
76706
|
76707
|
76708
|
76709
|
76710
|
77623
|
77624
|
77625
|
77626
|
78387
|
78388
|
78389
|
78390
|
78391
|
78392
|
78393
|
78394
|
78404
|
78405
|
78406
|
78407
|
78408
|
79040
|
79041
|
79042
|
79043
|
79044
|
79738
|
79739
|
79740
|
79741
|
79742
|
79746
|
79747
|
79748
|
79749
|
79750
|
79964
|
79965
|
79966
|
79967
|
79968
|
79969
|
79970
|
79971
|
79972
|
79973
|
79974
|
79975
|
80068
|
80087
|
80088
|
80089
|
80090
|
80091
|
80092
|
80093
|
80094
|
80095
|
80096
|
80097
|
80098
|
80099
|
80100
|
80118
|
80260
|
80261
|
80262
|
80263
|
80264
|
80265
|
80266
|
80267
|
80268
|
80269
|
80270
|
80271
|
80272
|
80273
|
80274
|
80275
|
80289
|
80298
|
80299
|
80300