Bug 3050 - Add an option to upload scanned invoices #3/3
authorJacek Ablewicz <abl@biblos.pk.edu.pl>
Fri, 9 May 2014 09:47:16 +0000 (11:47 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Sun, 25 May 2014 21:14:53 +0000 (21:14 +0000)
(part #3: DB updates + new syspref)

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
installer/data/mysql/kohastructure.sql
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref

index 92ab713..8111305 100644 (file)
@@ -3402,6 +3402,24 @@ CREATE TABLE IF NOT EXISTS marc_modification_template_actions (
   CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
 
+--
+-- Table structure for table `misc_files`
+--
+
+CREATE TABLE IF NOT EXISTS `misc_files` ( -- miscellaneous files attached to records from various tables
+  `file_id` int(11) NOT NULL AUTO_INCREMENT, -- unique id for the file record
+  `table_tag` varchar(255) NOT NULL, -- usually table name, or arbitrary unique tag
+  `record_id` int(11) NOT NULL, -- record id from the table this file is associated to
+  `file_name` varchar(255) NOT NULL, -- file name
+  `file_type` varchar(255) NOT NULL, -- MIME type of the file
+  `file_description` varchar(255) DEFAULT NULL, -- description given to the file
+  `file_content` longblob NOT NULL, -- file content
+  `date_uploaded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- date and time the file was added
+  PRIMARY KEY (`file_id`),
+  KEY `table_tag` (`table_tag`),
+  KEY `record_id` (`record_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
index 8a9625d..c096161 100644 (file)
@@ -1,5 +1,6 @@
 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
 ('AcqCreateItem','ordering','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'),
+('AcqEnableFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to invoice records.','YesNo'),
 ('AcqItemSetSubfieldsWhenReceived','','','Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar")','Free'),
 ('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
 ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'),
index 83ae409..1dfd650 100755 (executable)
@@ -8490,6 +8490,28 @@ if ( CheckVersion($DBversion) ) {
    SetVersion ($DBversion);
 }
 
+$DBversion = "3.15.00.XXX";
+if (CheckVersion($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('AcqEnableFiles','0','If enabled, allows librarians to upload and attach arbitrary files to invoice records.','YesNo')");
+    $dbh->do("
+CREATE TABLE IF NOT EXISTS `misc_files` (
+  `file_id` int(11) NOT NULL AUTO_INCREMENT,
+  `table_tag` varchar(255) NOT NULL,
+  `record_id` int(11) NOT NULL,
+  `file_name` varchar(255) NOT NULL,
+  `file_type` varchar(255) NOT NULL,
+  `file_description` varchar(255) DEFAULT NULL,
+  `file_content` longblob NOT NULL, -- file content
+  `date_uploaded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`file_id`),
+  KEY `table_tag` (`table_tag`),
+  KEY `record_id` (`record_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+    ");
+    print "Upgrade to $DBversion done (Bug 3050 - Add an option to upload scanned invoices)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index b32acdc..ac57f95 100644 (file)
@@ -46,6 +46,12 @@ Acquisitions:
             - Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar").
             - pref: AcqItemSetSubfieldsWhenReceived
         -
+            - pref: AcqEnableFiles
+              choices:
+                  yes: Do
+                  no: "Don't"
+            - enable the ability to upload and attach arbitrary files to invoices.
+        -
             - Set the mapping values for a new order line created from a MARC record in a staged file.
             - pref: MarcFieldsToOrder
               type: textarea