From c7f61d9a0da916d2bae978b396ca53b5dfe61585 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 26 Oct 2011 14:17:52 -0400 Subject: [PATCH] Bug 6880- Reason for suggestions do not save The fix for Bug 1883 seems to have lacked the necessary update to the database to add the "patronreason" column to the suggestions table. This patch does so. Signed-off-by: Katrin Fischer Patch adds database update and change to kohastructure. After this patch is applied, the patron's reason for making a suggestion (form in opac) is saved to the database correctly. The reason is also shown in the detail view of the suggestion. Backporting to 3.6.x Signed-off-by: Paul Poulain Backporting to 3.4.x Signed-off-by: Chris Nighswonger --- installer/data/mysql/kohastructure.sql | 21 +++++++++++---------- installer/data/mysql/updatedatabase.pl | 7 +++++++ kohaversion.pl | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e0db81dae3..d55484de7d 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1854,16 +1854,17 @@ CREATE TABLE `suggestions` ( `place` varchar(255) default NULL, `isbn` varchar(30) default NULL, `mailoverseeing` smallint(1) default 0, - `biblionumber` int(11) default NULL, - `reason` text, - budgetid INT(11), - branchcode VARCHAR(10) default NULL, - collectiontitle text default NULL, - itemtype VARCHAR(30) default NULL, - quantity SMALLINT(6) default NULL, - currency VARCHAR(3) default NULL, - price DECIMAL(28,6) default NULL, - total DECIMAL(28,6) default NULL, + `biblionumber` int(11) default NULL, -- foreign key linking the suggestion to the biblio table after the suggestion has been ordered + `reason` text, -- reason for accepting or rejecting the suggestion + `patronreason` text, -- reason for making the suggestion + budgetid INT(11), -- foreign key linking the suggested budget to the aqbudgets table + branchcode VARCHAR(10) default NULL, -- foreign key linking the suggested branch to the branches table + collectiontitle text default NULL, -- collection name for the suggested item + itemtype VARCHAR(30) default NULL, -- suggested item type + quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased + currency VARCHAR(3) default NULL, -- suggested currency for the suggested price + price DECIMAL(28,6) default NULL, -- suggested price + total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency) PRIMARY KEY (`suggestionid`), KEY `suggestedby` (`suggestedby`), KEY `managedby` (`managedby`) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 32d2fd3741..1684044a0e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4458,6 +4458,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.04.07.001"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE `suggestions` ADD `patronreason` TEXT NULL AFTER `reason`"); + print "Upgrade to $DBversion done (Add column to suggestions table to store patrons' reasons for submitting a suggestion. )\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/kohaversion.pl b/kohaversion.pl index e38f4606ee..8e18f5e9c7 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.04.07.000'; + our $VERSION = '3.04.07.001'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5