Bug 7317: Add SQL templates & sysprefs.
authorAlex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
Thu, 22 Sep 2016 14:20:14 +0000 (16:20 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 9 Nov 2017 14:26:56 +0000 (11:26 -0300)
* installer/data/mysql/atomicupdate/ill_tables.sql: New file.
* installer/data/mysql/kohastructure.sql: Add tables.
* installer/data/mysql/sysprefs.sql: Add sysprefs.
* installer/data/mysql/userflags.sql: Add userflags.
* koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref:
  Add sysprefs to UI.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/ill_tables.sql [new file with mode: 0644]
installer/data/mysql/kohastructure.sql
installer/data/mysql/sysprefs.sql
installer/data/mysql/userflags.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref

diff --git a/installer/data/mysql/atomicupdate/ill_tables.sql b/installer/data/mysql/atomicupdate/ill_tables.sql
new file mode 100644 (file)
index 0000000..cab65f2
--- /dev/null
@@ -0,0 +1,55 @@
+-- ILL Requests
+
+CREATE TABLE illrequests (
+    illrequest_id serial PRIMARY KEY,           -- ILL request number
+    borrowernumber integer DEFAULT NULL,        -- Patron associated with request
+    biblio_id integer DEFAULT NULL,             -- Potential bib linked to request
+    branchcode varchar(50) NOT NULL,            -- The branch associated with the request
+    status varchar(50) DEFAULT NULL,            -- Current Koha status of request
+    placed date DEFAULT NULL,                   -- Date the request was placed
+    replied date DEFAULT NULL,                  -- Last API response
+    updated timestamp DEFAULT CURRENT_TIMESTAMP -- Last modification to request
+      ON UPDATE CURRENT_TIMESTAMP,
+    completed date DEFAULT NULL,                -- Date the request was completed
+    medium varchar(30) DEFAULT NULL,            -- The Koha request type
+    accessurl varchar(500) DEFAULT NULL,        -- Potential URL for accessing item
+    cost varchar(20) DEFAULT NULL,              -- Cost of request
+    notesopac text DEFAULT NULL,                -- Patron notes attached to request
+    notesstaff text DEFAULT NULL,               -- Staff notes attached to request
+    orderid varchar(50) DEFAULT NULL,           -- Backend id attached to request
+    backend varchar(20) DEFAULT NULL,           -- The backend used to create request
+    CONSTRAINT `illrequests_bnfk`
+      FOREIGN KEY (`borrowernumber`)
+      REFERENCES `borrowers` (`borrowernumber`)
+      ON UPDATE CASCADE ON DELETE CASCADE,
+    CONSTRAINT `illrequests_bcfk_2`
+      FOREIGN KEY (`branchcode`)
+      REFERENCES `branches` (`branchcode`)
+      ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- ILL Request Attributes
+
+CREATE TABLE illrequestattributes (
+    illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number
+    type varchar(200) NOT NULL,                 -- API ILL property name
+    value text NOT NULL,                        -- API ILL property value
+    PRIMARY KEY  (`illrequest_id`,`type`),
+    CONSTRAINT `illrequestattributes_ifk`
+      FOREIGN KEY (illrequest_id)
+      REFERENCES `illrequests` (`illrequest_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
+       ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo');
+
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
+       ('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea');
+
+-- Userflags
+
+INSERT INTO userflags (bit,flag,flagdesc,defaulton)
+VALUES (22,'ill','The Interlibrary Loans Module',0);
index 36481ad..4f2bd98 100644 (file)
@@ -4126,6 +4126,55 @@ CREATE TABLE IF NOT EXISTS club_fields (
   CONSTRAINT club_fields_ibfk_4 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
+--
+-- Table structure for table `illrequests`
+--
+
+DROP TABLE IF EXISTS `illrequests`;
+CREATE TABLE illrequests (
+    illrequest_id serial PRIMARY KEY,           -- ILL request number
+    borrowernumber integer DEFAULT NULL,        -- Patron associated with request
+    biblio_id integer DEFAULT NULL,             -- Potential bib linked to request
+    branchcode varchar(50) NOT NULL,            -- The branch associated with the request
+    status varchar(50) DEFAULT NULL,            -- Current Koha status of request
+    placed date DEFAULT NULL,                   -- Date the request was placed
+    replied date DEFAULT NULL,                  -- Last API response
+    updated timestamp DEFAULT CURRENT_TIMESTAMP -- Last modification to request
+      ON UPDATE CURRENT_TIMESTAMP,
+    completed date DEFAULT NULL,                -- Date the request was completed
+    medium varchar(30) DEFAULT NULL,            -- The Koha request type
+    accessurl varchar(500) DEFAULT NULL,        -- Potential URL for accessing item
+    cost varchar(20) DEFAULT NULL,              -- Cost of request
+    notesopac text DEFAULT NULL,                -- Patron notes attached to request
+    notesstaff text DEFAULT NULL,               -- Staff notes attached to request
+    orderid varchar(50) DEFAULT NULL,           -- Backend id attached to request
+    backend varchar(20) DEFAULT NULL,           -- The backend used to create request
+    CONSTRAINT `illrequests_bnfk`
+      FOREIGN KEY (`borrowernumber`)
+      REFERENCES `borrowers` (`borrowernumber`)
+      ON UPDATE CASCADE ON DELETE CASCADE,
+    CONSTRAINT `illrequests_bcfk_2`
+      FOREIGN KEY (`branchcode`)
+      REFERENCES `branches` (`branchcode`)
+      ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Table structure for table `illrequestattributes`
+--
+
+DROP TABLE IF EXISTS `illrequestattributes`;
+CREATE TABLE illrequestattributes (
+    illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number
+    type varchar(200) NOT NULL,                 -- API ILL property name
+    value text NOT NULL,                        -- API ILL property value
+    PRIMARY KEY  (`illrequest_id`,`type`),
+    CONSTRAINT `illrequestattributes_ifk`
+      FOREIGN KEY (illrequest_id)
+      REFERENCES `illrequests` (`illrequest_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 */;
index 51203f0..e54e2ae 100644 (file)
@@ -200,6 +200,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('IDreamBooksResults','0','','Display IDreamBooks.com rating in search results','YesNo'),
 ('IDreamBooksReviews','0','','Display book review snippets from IDreamBooks.com','YesNo'),
 ('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
+('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
+('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'),
 ('ILS-DI','0','','Enables ILS-DI services at OPAC.','YesNo'),
 ('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),
 ('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'),
index cf2adff..854e882 100644 (file)
@@ -18,5 +18,6 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES
 (18,'coursereserves','Course reserves',0),
 (19, 'plugins', 'Koha plugins', '0'),
 (20, 'lists', 'Lists', 0),
-(21, 'clubs', 'Patron clubs', '0')
+(21, 'clubs', 'Patron clubs', '0'),
+(22,'ill','The Interlibrary Loans Module',0)
 ;
index 2e8dce7..d9d5e49 100644 (file)
@@ -65,6 +65,19 @@ Administration:
               choices:
                   yes: "The logged-in library"
                   no: "All libraries"
+    Interlibrary Loans:
+        -
+            - pref: ILLModule
+              default: 0
+              choices:
+                  yes: Enable
+                  no: Disable
+            - the interlibrary loans module (master switch).
+        -
+            - "Adding text will enable the copyright clearance stage in request creation. The text you enter will be the text displayed."
+            - pref: ILLModuleCopyrightClearance
+              type: textarea
+              class: long
     Login options:
         -
             - "Inactivity timeout in seconds to automatically log out users: "