Merged in mcuiza/processmaker/HOR-310 (pull request #3782)

HOR-310
This commit is contained in:
Julio Cesar Laura Avendaño
2016-03-07 17:45:38 -04:00
5 changed files with 198 additions and 11 deletions

View File

@@ -1126,23 +1126,16 @@ class Cases
* @return Fields
*/
public function removeCase($sAppUid)
public function removeCase($sAppUid, $deleteDelegation = true)
{
try {
$this->getExecuteTriggerProcess($sAppUid, 'DELETED');
$oAppDelegation = new AppDelegation();
$oAppDocument = new AppDocument();
//Delete the delegations of a application
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(AppDelegationPeer::APP_UID, $sAppUid);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
while ($aRow2 = $oDataset2->getRow()) {
$oAppDelegation->remove($sAppUid, $aRow2['DEL_INDEX']);
$oDataset2->next();
if($deleteDelegation) {
//Delete the delegations of a application
$this->deleteDelegation($sAppUid);
}
//Delete the documents assigned to a application
$oCriteria2 = new Criteria('workflow');
@@ -1237,6 +1230,9 @@ class Cases
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListParticipatedLastPeer::APP_UID, $sAppUid);
ListParticipatedLastPeer::doDelete($oCriteria);
$oCriteria = new Criteria('workflow');
$oCriteria->add(ListPausedPeer::APP_UID, $sAppUid);
ListPausedPeer::doDelete($oCriteria);
/*----------------------------------********---------------------------------*/
return $result;
} catch (exception $e) {
@@ -7295,5 +7291,19 @@ class Cases
return $processList;
}
public function deleteDelegation($sAppUid)
{
$oAppDelegation = new AppDelegation();
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(AppDelegationPeer::APP_UID, $sAppUid);
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
while ($aRow2 = $oDataset2->getRow()) {
$oAppDelegation->remove($sAppUid, $aRow2['DEL_INDEX']);
$oDataset2->next();
}
}
}