Merged latest changes in module Attachments (bug fix on install and cosmetic improvements)

SVN:1.2[1604]
This commit is contained in:
Romain Quetiez
2011-09-23 13:49:26 +00:00
parent c58fd17fc9
commit e95aa6cc69
5 changed files with 24 additions and 13 deletions

View File

@@ -99,11 +99,12 @@ class AttachmentInstaller extends ModuleInstallerAPI
//
// Prerequisite: change null into 0 (workaround to the fact that we cannot use IS NULL in OQL)
SetupWebPage::log_info("Initializing attachment/item_org_id - null to zero");
$sRepair = "UPDATE `Attachment` SET `item_org_id` = 0 WHERE `item_org_id` IS NULL";
$sTableName = MetaModel::DBGetTable('Attachment');
$sRepair = "UPDATE `$sTableName` SET `item_org_id` = 0 WHERE `item_org_id` IS NULL";
CMDBSource::Query($sRepair);
SetupWebPage::log_info("Initializing attachment/item_org_id - zero to the container");
$oSearch = DBObjectSearch::FromOQL('SELECT Attachment WHERE item_org_id = 0');
SetupWebPage::log_info("Initializing attachment/item_org_id - zero to the container");
$oSearch = DBObjectSearch::FromOQL("SELECT Attachment WHERE item_org_id = 0");
$oSet = new DBObjectSet($oSearch);
$iUpdated = 0;
while ($oAttachment = $oSet->Fetch())