---
 installer/data/mysql/updatedatabase.pl |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index f44c257..8a33590 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3398,6 +3398,18 @@ if (C4::Context->preference("Version") < 
TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.113';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do("ALTER TABLE `statistics` ADD `ccode` VARCHAR( 80 ) NULL ;");
+       $dbh->do("UPDATE statistics SET statistics.ccode = ( SELECT items.ccode 
FROM items WHERE statistics.itemnumber = items.itemnumber )");
+       $dbh->do("UPDATE statistics SET statistics.ccode = ( 
+         SELECT deleteditems.ccode FROM deleteditems
+          WHERE statistics.itemnumber = deleteditems.itemnumber
+         ) WHERE statistics.ccode IS NULL");
+       print "Upgrade done ( Added Category Code to Statistics table. )\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.5.6.5

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to