From 04b6ba4077a96d2dceda7d6d41981246ad5f1350 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 12 Sep 2012 12:11:08 -0400 Subject: [PATCH] Bug 4118 - Add Collection Code to Statistics Table - Followup Content-Type: text/plain; charset="utf-8" --- installer/data/mysql/updatedatabase.pl | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index eb4f2fe..b58ea4a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5718,11 +5718,16 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = '3.09.00.XXX'; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("ALTER TABLE statistics ADD COLUMN ccode VARCHAR ( 10 ) NULL AFTER associatedborrower"); - $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"); + $dbh->do(" + UPDATE statistics SET statistics.ccode = ( + SELECT items.ccode FROM items WHERE statistics.itemnumber = items.itemnumber + ) WHERE statistics.type != 'payment' AND statistics.type != 'writeoff' + "); + $dbh->do(" + UPDATE statistics SET statistics.ccode = ( + SELECT deleteditems.ccode FROM deleteditems WHERE statistics.itemnumber = deleteditems.itemnumber + ) WHERE statistics.ccode IS NULL AND statistics.type != 'payment' AND statistics.type != 'writeoff' + "); print "Upgrade done ( Added Collection Code to Statistics table. )\n"; SetVersion ($DBversion); } -- 1.7.2.5