From 88ce26128a5cd14d56eabd1d0be23831ed645f87 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 7 Oct 2015 12:22:12 -0400 Subject: [PATCH] Bug 14610 - Add ability to place article requests in Koha - Update database Article Requests are somewhat similar to holds, but are not requests for an item to check out. Instead, article requests are requests for a photocopy of a particular section of a book ( most often ). This is very common in academic libraries where researchers may request a copy of a single article found in a journal. This patch set adds the ability to place article requests in Koha. It allows the control of what can be requested via the circulation rules. Since article requests of electronic resources are not outside the realm of possibility, the feature will check not only the items for requstability, but the record itself as well ( i.e. both items.itype and biblio.itemtype ). Article requests can be placed for patrons from the opac and staff intranet and can be viewed in most areas where holds are viewed ( e.g. patron details, record details, etc ). There is a script to view article requests in progress within the circulation module. Article requests can be Open ( i.e. new ), In Processing, Completed, or Canceled. The status of a given request can be updated from this script. Test Plan: 1) Apply the patch set 2) Run updatedatabase.pl 3) Enable the system preference ArticleRequests 4) Set up some required fields in: ArticleRequestsMandatoryFields ArticleRequestsMandatoryFieldsItemsOnly ArticleRequestsMandatoryFieldsRecordOnly 5) Edit your circ rules, set article requests to 'yes' for something 6) Test the ability to add an article request from the opac ( required fields enforced ) 7) Test the ability to add an article request from the staff interface ( required fields no enforced ) 8) Note you can choose item level or record level requests 9) Change the rule to "record only" 10) Repeat 6 and 7 11) Note you cannot choose items 12) Change the rule to "item only" 13) Repeat 6 and 7 14) Note you must choose an item 15) Note that the 'new request' message is queued for each new request 16) Browse to /cgi-bin/koha/circ/article-requests.pl 17) Note requests are split by pickup branch 18) Test slip printing via the "Print slip" action 19) Process request vai "Process request" action 20) Note an email notice is queued for patron 21) Refresh /cgi-bin/koha/circ/article-requests.pl 22) Note request has moved to "processing" tab. 23) Complete request with "Complete request" action 24) Note message is queued for patron 25) Cancel a request, add cancelation note. 26) Note message is queued for patron Signed-off-by: Jennifer Schmidt --- installer/data/mysql/atomicupdate/bug_14610.sql | 43 ++++++++++++++++++++ .../data/mysql/en/mandatory/sample_notices.sql | 7 +++ installer/data/mysql/kohastructure.sql | 32 +++++++++++++++ installer/data/mysql/sysprefs.sql | 4 ++ 4 files changed, 86 insertions(+), 0 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_14610.sql diff --git a/installer/data/mysql/atomicupdate/bug_14610.sql b/installer/data/mysql/atomicupdate/bug_14610.sql new file mode 100644 index 0000000..68d763b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_14610.sql @@ -0,0 +1,43 @@ +ALTER TABLE `issuingrules` ADD `article_requests` ENUM( 'no', 'yes', 'bib_only', 'item_only' ) NOT NULL DEFAULT 'no'; + +INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES + ('ArticleRequests', '1', NULL, 'Enables the article request feature', 'YesNo'), + ('ArticleRequestsMandatoryFields', '', NULL, 'Comma delimited list of required fields for bibs where article requests rule = ''yes''', 'multiple'), + ('ArticleRequestsMandatoryFieldsItemsOnly', '', NULL, 'Comma delimited list of required fields for bibs where article requests rule = ''item_only''', 'multiple'), + ('ArticleRequestsMandatoryFieldsRecordOnly', '', NULL, 'Comma delimited list of required fields for bibs where article requests rule = ''bib_only''', 'multiple'); + +CREATE TABLE IF NOT EXISTS `article_requests` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `borrowernumber` int(11) NOT NULL, + `biblionumber` int(11) NOT NULL, + `itemnumber` int(11) DEFAULT NULL, + `branchcode` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `title` text, + `author` text, + `volume` text, + `issue` text, + `date` text, + `pages` text, + `chapters` text, + `status` enum('OPEN','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'OPEN', + `notes` text, + `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated_on` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `borrowernumber` (`borrowernumber`), + KEY `biblionumber` (`biblionumber`), + KEY `itemnumber` (`itemnumber`), + KEY `branchcode` (`branchcode`), + CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES +('circulation', 'AR_CANCELED', '', 'Article Request - Email - Canceled', 0, 'Article Request Canceled', '<> <> (<>)\r\n\r\nYour request for an article from <> (<>) has been canceled for the following reason:\r\n\r\n<>\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n', 'email'), +('circulation', 'AR_COMPLETED', '', 'Article Request - Email - Completed', 0, 'Article Request Completed', '<> <> (<>)\r\n\r\nWe are have completed your request for an article from <> (<>).\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n\r\nYou may pick your article up at <>.\r\n\r\nThank you!', 'email'), +('circulation', 'AR_OPEN', '', 'Article Request - Email - Open', 0, 'Article Request Recieved', '<> <> (<>)\r\n\r\nWe have received your request for an article from <> (<>).\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n\r\n\r\nThank you!', 'email'), +('circulation', 'AR_PRINT', '', 'Article Request - Print Slip', 0, 'Test', 'Article Request:\r\n\r\n<> <> (<>)\r\n\r\nTitle: <>\r\nBarcode: <>\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n', 'print'), +('circulation', 'AR_PROCESSING', '', 'Article Request - Email - Processing', 0, 'Article Request Processing', '<> <> (<>)\r\n\r\nWe are now processing your request for an article from <> (<>).\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n\r\nThank you!', 'email'); + diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql index f20d9d3..ffba9dc 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ b/installer/data/mysql/en/mandatory/sample_notices.sql @@ -156,3 +156,10 @@ Your library.' INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type) VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <> <>,\n\n The order <> (<>) has been received.\n\nYour library.', 'email'), ('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <> <> <>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<>','email'); + +INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES +('circulation', 'AR_CANCELED', '', 'Article Request - Email - Canceled', 0, 'Article Request Canceled', '<> <> (<>)\r\n\r\nYour request for an article from <> (<>) has been canceled for the following reason:\r\n\r\n<>\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n', 'email'), + ('circulation', 'AR_COMPLETED', '', 'Article Request - Email - Completed', 0, 'Article Request Completed', '<> <> (<>)\r\n\r\nWe are have completed your request for an article from <> (<>).\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n\r\nYou may pick your article up at <>.\r\n\r\nThank you!', 'email'), + ('circulation', 'AR_OPEN', '', 'Article Request - Email - Open', 0, 'Article Request Recieved', '<> <> (<>)\r\n\r\nWe have received your request for an article from <> (<>).\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n\r\n\r\nThank you!', 'email'), + ('circulation', 'AR_PRINT', '', 'Article Request - Print Slip', 0, 'Test', 'Article Request:\r\n\r\n<> <> (<>)\r\n\r\nTitle: <>\r\nBarcode: <>\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n', 'print'), + ('circulation', 'AR_PROCESSING', '', 'Article Request - Email - Processing', 0, 'Article Request Processing', '<> <> (<>)\r\n\r\nWe are now processing your request for an article from <> (<>).\r\n\r\nArticle requested:\r\nTitle: <>\r\nAuthor: <>\r\nVolume: <>\r\nIssue: <>\r\nDate: <>\r\nPages: <>\r\nChapters: <>\r\n\r\nThank you!', 'email'); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 3a30585..9b601a5 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3580,6 +3580,38 @@ CREATE TABLE `localization` ( UNIQUE KEY `entity_code_lang` (`entity`,`code`,`lang`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +-- +-- Table structure for table 'article_requests' +-- + +CREATE TABLE `article_requests` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `borrowernumber` int(11) NOT NULL, + `biblionumber` int(11) NOT NULL, + `itemnumber` int(11) DEFAULT NULL, + `branchcode` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `title` text, + `author` text, + `volume` text, + `issue` text, + `date` text, + `pages` text, + `chapters` text, + `status` enum('OPEN','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'OPEN', + `notes` text, + `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated_on` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `borrowernumber` (`borrowernumber`), + KEY `biblionumber` (`biblionumber`), + KEY `itemnumber` (`itemnumber`), + KEY `branchcode` (`branchcode`), + CONSTRAINT `article_requests_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `article_requests_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `article_requests_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `article_requests_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE 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 5d4910e..fc41655 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -40,6 +40,10 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AmazonLocale','US','US|CA|DE|FR|JP|UK','Use to set the Locale of your Amazon.com Web Services','Choice'), ('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'), ('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for Suggestion and reading history privacy',''), +('ArticleRequests', '0', NULL, 'Enables the article request feature', 'YesNo'), +('ArticleRequestsMandatoryFields', '', NULL, 'Comma delimited list of required fields for bibs where article requests rule = ''yes''', 'multiple'), +('ArticleRequestsMandatoryFieldsItemsOnly', '', NULL, 'Comma delimited list of required fields for bibs where article requests rule = ''item_only''', 'multiple'), +('ArticleRequestsMandatoryFieldsRecordOnly', '', NULL, 'Comma delimited list of required fields for bibs where article requests rule = ''bib_only''', 'multiple'), ('AuthDisplayHierarchy','0','','Display authority hierarchies','YesNo'), ('AuthoritiesLog','1',NULL,'If ON, log edit/create/delete actions on authorities.','YesNo'), ('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'), -- 1.7.2.5