PM-4435: Bandeja Participated no se actualiza cuando se toman casos de la bandeja Unassigned

.
This commit is contained in:
marcelo.cuiza
2015-12-14 11:50:10 -04:00
parent 933e70165f
commit 613c5d4d11

View File

@@ -48,19 +48,21 @@ class ListParticipatedLast extends BaseListParticipatedLast
$aRow = $dataset->getRow(); $aRow = $dataset->getRow();
$data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME']; $data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME'];
$data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
$data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME']; $data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME'];
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'participated');
} }
} else { } else {
$data['USR_UID'] = $_SESSION['USER_LOGGED']; $getData['USR_UID'] = $_SESSION['USER_LOGGED'];
$row = $this->getRowFromList($data); $getData['APP_UID'] = $data['APP_UID'];
if(is_array($row) && sizeof($row)) { $row = $this->getRowFromList($getData);
$this->remove($row['APP_UID'], $row['USR_UID'], $row['DEL_INDEX'], true); if(is_array($row) && sizeof($row)) {
} $set = array("DEL_CURRENT_USR_USERNAME" => "","DEL_CURRENT_USR_FIRSTNAME" => "","DEL_CURRENT_USR_LASTNAME" => "","APP_TAS_TITLE" => $data['APP_TAS_TITLE']);
$this->updateCurrentUser($row, $set);
}
} }
$users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'participated');
if($this->primaryKeysExists($data)) { if($this->primaryKeysExists($data)) {
return; return;
} }
@@ -159,7 +161,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
* @throws type * @throws type
* *
*/ */
public function remove ($app_uid, $usr_uid, $del_index, $force = false) public function remove ($app_uid, $usr_uid, $del_index)
{ {
try { try {
$flagDelete = false; $flagDelete = false;
@@ -171,23 +173,18 @@ class ListParticipatedLast extends BaseListParticipatedLast
$criteria->add(ListParticipatedLastPeer::USR_UID, $usr_uid); $criteria->add(ListParticipatedLastPeer::USR_UID, $usr_uid);
$criteria->add(ListParticipatedLastPeer::DEL_INDEX, $del_index); $criteria->add(ListParticipatedLastPeer::DEL_INDEX, $del_index);
if(!$this->isTheOne($app_uid, $usr_uid) || $force) { $result = ListParticipatedLastPeer::doDelete($criteria);
$result = ListParticipatedLastPeer::doDelete($criteria); $flagDelete = true;
$flagDelete = true;
}
} else { } else {
$criteria = new Criteria("workflow"); $criteria = new Criteria("workflow");
$criteria->add(ListParticipatedLastPeer::APP_UID, $app_uid); $criteria->add(ListParticipatedLastPeer::APP_UID, $app_uid);
$criteria->add(ListParticipatedLastPeer::USR_UID, $usr_uid); $criteria->add(ListParticipatedLastPeer::USR_UID, $usr_uid);
$rsCriteria = ListParticipatedLastPeer::doSelectRS($criteria); $rsCriteria = ListParticipatedLastPeer::doSelectRS($criteria);
if ($rsCriteria->next()) { if ($rsCriteria->next()) {
$criteria2 = clone $criteria; $criteria2 = clone $criteria;
if(!$this->isTheOne($app_uid, $usr_uid) || $force) { $result = ListParticipatedLastPeer::doDelete($criteria2);
$result = ListParticipatedLastPeer::doDelete($criteria2); $flagDelete = true;
$flagDelete = true;
}
} }
} }
@@ -382,16 +379,21 @@ class ListParticipatedLast extends BaseListParticipatedLast
} }
return false; return false;
} }
public function isTheOne($app_uid, $usr_uid) { public function updateCurrentUser($where, $set)
$criteria = new Criteria("workflow"); {
$criteria->add(ListParticipatedLastPeer::APP_UID, $app_uid); $con = Propel::getConnection('workflow');
$criteria->add(ListParticipatedLastPeer::USR_UID, $usr_uid); //Update - WHERE
$rsCriteria = ListParticipatedLastPeer::doCount($criteria); $criteriaWhere = new Criteria("workflow");
if ($rsCriteria == 1) { $criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $where["APP_UID"], Criteria::EQUAL);
return true; $criteriaWhere->add(ListParticipatedLastPeer::USR_UID, $where["USR_UID"], Criteria::EQUAL);
} $criteriaWhere->add(ListParticipatedLastPeer::DEL_INDEX, $where["DEL_INDEX"], Criteria::EQUAL);
return false; //Update - SET
$criteriaSet = new Criteria("workflow");
foreach($set as $k => $v) {
eval('$criteriaSet->add( ListParticipatedLastPeer::'.$k.',$v, Criteria::EQUAL);');
}
BasePeer::doUpdate($criteriaWhere, $criteriaSet, $con);
} }
} }