View | Details | Raw Unified | Return to bug 4118
Collapse All | Expand All

(-)a/installer/data/mysql/updatedatabase.pl (-6 / +10 lines)
Lines 5718-5728 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5718
$DBversion = '3.09.00.XXX';
5718
$DBversion = '3.09.00.XXX';
5719
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5719
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5720
	$dbh->do("ALTER TABLE statistics ADD COLUMN ccode VARCHAR ( 10 ) NULL AFTER associatedborrower");
5720
	$dbh->do("ALTER TABLE statistics ADD COLUMN ccode VARCHAR ( 10 ) NULL AFTER associatedborrower");
5721
	$dbh->do("UPDATE statistics SET statistics.ccode = ( SELECT items.ccode FROM items WHERE statistics.itemnumber = items.itemnumber )");
5721
	$dbh->do("
5722
	$dbh->do("UPDATE statistics SET statistics.ccode = (
5722
	    UPDATE statistics SET statistics.ccode = ( 
5723
	  SELECT deleteditems.ccode FROM deleteditems
5723
	        SELECT items.ccode FROM items  WHERE statistics.itemnumber = items.itemnumber 
5724
          WHERE statistics.itemnumber = deleteditems.itemnumber
5724
            ) WHERE statistics.type != 'payment' AND statistics.type != 'writeoff'
5725
	  ) WHERE statistics.ccode IS NULL");
5725
        ");
5726
	$dbh->do("
5727
	    UPDATE statistics SET statistics.ccode = (
5728
                SELECT deleteditems.ccode FROM deleteditems WHERE statistics.itemnumber = deleteditems.itemnumber
5729
	    ) WHERE statistics.ccode IS NULL AND statistics.type != 'payment' AND statistics.type != 'writeoff'
5730
        ");
5726
	print "Upgrade done ( Added Collection Code to Statistics table. )\n";
5731
	print "Upgrade done ( Added Collection Code to Statistics table. )\n";
5727
    SetVersion ($DBversion);
5732
    SetVersion ($DBversion);
5728
}
5733
}
5729
- 

Return to bug 4118