Merge branch 'sprint/master_lanzongjun_fixbug' into 'master'
* fix task #60360 See merge request easycorp/zentaopms!4500
This commit is contained in:
@@ -528,6 +528,10 @@ class upgradeModel extends model
|
||||
$this->moveProjectAdmins();
|
||||
$this->addStoryViewPriv();
|
||||
break;
|
||||
case '17_2':
|
||||
$this->addReviewIssusApprovalData();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$this->deletePatch();
|
||||
@@ -6509,6 +6513,46 @@ class upgradeModel extends model
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add review issue approval data.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function addReviewIssusApprovalData()
|
||||
{
|
||||
$reviewIssues = $this->dao->select('id,review,type')->from(TABLE_REVIEWISSUE)
|
||||
->where('type')->eq('review')
|
||||
->andWhere('approval')->eq(0)
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetchAll('review');
|
||||
|
||||
if(empty($reviewIssues)) return false;
|
||||
|
||||
$reviewIds = array_unique(array_column($reviewIssues, 'review'));
|
||||
|
||||
$approvalsPairs = $this->dao->select('objectID, max(id) as approval')->from(TABLE_APPROVAL)
|
||||
->where('objectID')->in($reviewIds)
|
||||
->andWhere('objectType')->eq('review')
|
||||
->andWhere('result')->eq('fail')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->groupBy('objectID')
|
||||
->fetchAll('objectID');
|
||||
|
||||
/* Add approval data. */
|
||||
foreach($reviewIssues as $reviewIssue)
|
||||
{
|
||||
if(!isset($approvalsPairs[$reviewIssue->review]->approval)) continue;
|
||||
$this->dao->update(TABLE_REVIEWISSUE)
|
||||
->set('approval')->eq($approvalsPairs[$reviewIssue->review]->approval)
|
||||
->where('review')->eq($reviewIssue->review)
|
||||
->andWhere('type')->eq('review')
|
||||
->andWhere('approval')->eq(0)
|
||||
->andWhere('deleted')->eq('0')
|
||||
->exec();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Xuan: Add `index` column to all message partition tables.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user