From 07c16a300d8bb110d2a7ebe7e66c73a1ea305db2 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Mon, 26 Jan 2015 07:48:07 -0500
Subject: [PATCH] Bug 9303 [QA Followup 3]

---
 Koha/Template/Plugin/Koha.pm           |    1 +
 installer/data/mysql/updatedatabase.pl |   17 ++++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Koha/Template/Plugin/Koha.pm b/Koha/Template/Plugin/Koha.pm
index 5411f75..410d636 100644
--- a/Koha/Template/Plugin/Koha.pm
+++ b/Koha/Template/Plugin/Koha.pm
@@ -58,6 +58,7 @@ sub Version {
                             ? $development
                             : undef
     };
+}
 
 sub Find {
     my ( $self, $rs, $id ) = @_;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index dbb76c8..9037d55 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -9675,20 +9675,23 @@ if(CheckVersion($DBversion)) {
     $dbh->do(q{
         ALTER TABLE borrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0' AFTER privacy
     });
+
     $dbh->do(q{
         ALTER TABLE deletedborrowers ADD privacy_guarantor_checkouts BOOLEAN NOT NULL DEFAULT '0' AFTER privacy
     });
+
     $dbh->do(q{
-        ALTER TABLE old_issues ADD issue_id INT( 11 ) NOT NULL PRIMARY KEY FIRST
+        ALTER TABLE old_issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
     });
+
     $dbh->do(q{
-        ALTER TABLE issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
+        ALTER TABLE old_issues CHANGE issue_id issue_id INT( 11 ) NOT NULL
     });
+
     $dbh->do(q{
-        ALTER TABLE issues
-            DROP INDEX itemnumber_idx,
-            ADD UNIQUE itemnumber_idx ( itemnumber )
+        ALTER TABLE issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
     });
+
     $dbh->do(qq{
         UPDATE issues SET issue_id = issue_id + ( SELECT COUNT(*) FROM old_issues ) ORDER BY issue_id DESC
     });
@@ -9703,7 +9706,7 @@ if(CheckVersion($DBversion)) {
     });
 
     $dbh->do(q{
-        INSERT INTO systempreferences (variable, value, options, explanation, type )
+        INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type )
         VALUES (
             'AllowStaffToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
             'If enabled, library staff can set a patron''s checkouts to be visible to linked patrons from the opac.',  'YesNo'
@@ -9711,7 +9714,7 @@ if(CheckVersion($DBversion)) {
     });
 
     $dbh->do(q{
-        INSERT INTO systempreferences (variable, value, options, explanation, type )
+        INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type )
         VALUES (
             'AllowPatronToSetCheckoutsVisibilityForGuarantor',  '0', NULL,
             'If enabled, the patron can set checkouts to be visible to  his or her guarantor',  'YesNo'
-- 
1.7.2.5