From 4706023c3df00289ddae57949f6a6535806cb631 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@biblibre.com>
Date: Mon, 29 Sep 2014 15:54:34 +0200
Subject: [PATCH] [PASSED QA] Bug 13006: suggestions.mailoverseeing cans be
 removed

The DB field suggestions.mailoverseeing does not seem to be in used.
It cans be removed.

Actually it has never been in used.

Test plan:
git grep mailoverseeing
should not return relevant results.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests, updates kohastructure and includes a database update.
Also made some tests in the suggestions module.
---
 installer/data/mysql/kohastructure.sql                          | 1 -
 installer/data/mysql/ru-RU/optional/sample_user_suggestions.sql | 4 ++--
 installer/data/mysql/uk-UA/optional/sample_user_suggestions.sql | 4 ++--
 installer/data/mysql/updatedatabase.pl                          | 8 ++++++++
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index aeeba17..f2bca0a 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2169,7 +2169,6 @@ CREATE TABLE `suggestions` ( -- purchase suggestions
   `publicationyear` smallint(6) default 0,
   `place` varchar(255) default NULL, -- publication place of the suggested item
   `isbn` varchar(30) default NULL, -- isbn of the suggested item
-  `mailoverseeing` smallint(1) default 0,
   `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
diff --git a/installer/data/mysql/ru-RU/optional/sample_user_suggestions.sql b/installer/data/mysql/ru-RU/optional/sample_user_suggestions.sql
index 4cf2675..170c8e1 100644
--- a/installer/data/mysql/ru-RU/optional/sample_user_suggestions.sql
+++ b/installer/data/mysql/ru-RU/optional/sample_user_suggestions.sql
@@ -1,4 +1,4 @@
 TRUNCATE suggestions;
 
-INSERT INTO `suggestions` (`suggestionid`, `suggestedby`, `managedby`, `STATUS`, `note`, `author`, `title`, `copyrightdate`, `publishercode`, `date`, `volumedesc`, `publicationyear`, `place`, `isbn`, `mailoverseeing`, `biblionumber`, `reason`) 
-VALUES (1,0,NULL,'ASKED','нужна для УКЕ','','Мифы нашего времени',2008,'Часы','2008-05-01 08:02:26',NULL,NULL,NULL,NULL,0,0,NULL);
+INSERT INTO `suggestions` (`suggestionid`, `suggestedby`, `managedby`, `STATUS`, `note`, `author`, `title`, `copyrightdate`, `publishercode`, `date`, `volumedesc`, `publicationyear`, `place`, `isbn`, `biblionumber`, `reason`)
+VALUES (1,0,NULL,'ASKED','нужна для УКЕ','','Мифы нашего времени',2008,'Часы','2008-05-01 08:02:26',NULL,NULL,NULL,NULL,0,NULL);
diff --git a/installer/data/mysql/uk-UA/optional/sample_user_suggestions.sql b/installer/data/mysql/uk-UA/optional/sample_user_suggestions.sql
index 5b5a1f1..f676343 100644
--- a/installer/data/mysql/uk-UA/optional/sample_user_suggestions.sql
+++ b/installer/data/mysql/uk-UA/optional/sample_user_suggestions.sql
@@ -1,4 +1,4 @@
 TRUNCATE suggestions;
 
-INSERT INTO `suggestions` (`suggestionid`, `suggestedby`, `managedby`, `STATUS`, `note`, `author`, `title`, `copyrightdate`, `publishercode`, `date`, `volumedesc`, `publicationyear`, `place`, `isbn`, `mailoverseeing`, `biblionumber`, `reason`) 
-VALUES (1,0,NULL,'ASKED','потрібна для УКЕ','','Міфи нашого часу',2008,'Час','2008-05-01 08:02:26',NULL,NULL,NULL,NULL,0,0,NULL);
+INSERT INTO `suggestions` (`suggestionid`, `suggestedby`, `managedby`, `STATUS`, `note`, `author`, `title`, `copyrightdate`, `publishercode`, `date`, `volumedesc`, `publicationyear`, `place`, `isbn`, `biblionumber`, `reason`)
+VALUES (1,0,NULL,'ASKED','потрібна для УКЕ','','Міфи нашого часу',2008,'Час','2008-05-01 08:02:26',NULL,NULL,NULL,NULL,0,NULL);
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index d6b7d24..2109edb 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -8800,6 +8800,14 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = '3.17.00.XXX';
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        ALTER TABLE suggestions DROP COLUMN mailoverseeing;
+    });
+    print "Upgrade to $DBversion done (Bug 13006: Drop column suggestion.mailoverseeing)";
+    SetVersion($DBversion);
+}
 
 =head1 FUNCTIONS
 
-- 
1.9.1