* Finish task #40118.

This commit is contained in:
Yagami
2021-07-14 16:52:06 +08:00
parent 3b1d7a3e86
commit 7cd35ad185
+26
View File
@@ -112,6 +112,19 @@ class stakeholderModel extends model
}
}
if($stakeholder->objectType == 'program' and $stakeholder->objectID)
{
$programID = $stakeholder->objectID;
/* Update children user view. */
$childPrograms = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('program')->fetchPairs();
$childProjects = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('project')->fetchPairs();
$childProducts = $this->dao->select('id')->from(TABLE_PRODUCT)->where('program')->eq($programID)->fetchPairs();
if(!empty($childPrograms)) $this->user->updateUserView($childPrograms, 'program', $stakeholder->user);
if(!empty($childProjects)) $this->user->updateUserView($childProjects, 'project', $stakeholder->user);
if(!empty($childProducts)) $this->user->updateUserView($childProducts, 'product', $stakeholder->user);
}
return $stakeholderID;
}
return false;
@@ -168,6 +181,19 @@ class stakeholderModel extends model
foreach($products as $productID => $productName) $this->user->updateUserView($productID, 'product', $changedAccounts);
}
if($stakeholder->objectType == 'program' and $stakeholder->objectID)
{
$programID = $stakeholder->objectID;
/* Update children user view. */
$childPrograms = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('program')->fetchPairs();
$childProjects = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('project')->fetchPairs();
$childProducts = $this->dao->select('id')->from(TABLE_PRODUCT)->where('program')->eq($programID)->fetchPairs();
if(!empty($childPrograms)) $this->user->updateUserView($childPrograms, 'program', $stakeholder->user);
if(!empty($childProjects)) $this->user->updateUserView($childProjects, 'project', $stakeholder->user);
if(!empty($childProducts)) $this->user->updateUserView($childProducts, 'product', $stakeholder->user);
}
return $stakeholderList;
}