From 8dbddc5ab7db8c00905e83364a3bb3368e6ac6a6 Mon Sep 17 00:00:00 2001 From: Jacek Ablewicz Date: Fri, 9 May 2014 11:47:16 +0200 Subject: [PATCH 3/3] Bug 3050 - Add an option to upload scanned invoices #3/3 (part #3: DB updates + new syspref) Signed-off-by: Paola Rossi --- installer/data/mysql/kohastructure.sql | 18 ++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 22 ++++++++++++++++++++ .../en/modules/admin/preferences/acquisitions.pref | 6 ++++++ 4 files changed, 47 insertions(+) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 92ab713..8111305 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -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 */; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index be2f63f..9c1123e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -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'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 421e772..8996fc7 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8471,6 +8471,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) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref index b32acdc..ac57f95 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref @@ -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 -- 1.7.10.4