PM-4021: 0019012: Self Service error en bandeja de participados

.

.
This commit is contained in:
marcelo.cuiza
2015-12-01 17:27:50 -04:00
parent fbc839b9f9
commit ab5443eb56
2 changed files with 58 additions and 23 deletions

View File

@@ -36,7 +36,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
$data['APP_STATUS'] = $aRow['APP_STATUS']; $data['APP_STATUS'] = $aRow['APP_STATUS'];
if ($data['USR_UID'] != 'SELF_SERVICES') { if ($data['USR_UID'] != 'SELF_SERVICES') {
if($data['USR_UID'] != ''){ if($data['USR_UID'] != '') {
$criteria = new Criteria(); $criteria = new Criteria();
$criteria->addSelectColumn(UsersPeer::USR_USERNAME); $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
@@ -49,11 +49,17 @@ class ListParticipatedLast extends BaseListParticipatedLast
$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'];
}
} else {
$data['USR_UID'] = $_SESSION['USER_LOGGED'];
$row = $this->getRowFromList($data);
if(is_array($row) && sizeof($row)) {
$this->remove($row['APP_UID'], $row['USR_UID'], $row['DEL_INDEX'], true);
}
}
$users = new Users(); $users = new Users();
$users->refreshTotal($data['USR_UID'], 'add', 'participated'); $users->refreshTotal($data['USR_UID'], 'add', 'participated');
}
}
if($this->primaryKeysExists($data)) { if($this->primaryKeysExists($data)) {
return; return;
@@ -153,7 +159,7 @@ class ListParticipatedLast extends BaseListParticipatedLast
* @throws type * @throws type
* *
*/ */
public function remove ($app_uid, $usr_uid, $del_index) public function remove ($app_uid, $usr_uid, $del_index, $force = false)
{ {
try { try {
$flagDelete = false; $flagDelete = false;
@@ -165,7 +171,9 @@ 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 {
@@ -178,9 +186,9 @@ class ListParticipatedLast extends BaseListParticipatedLast
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;
} }
} }
@@ -360,5 +368,32 @@ class ListParticipatedLast extends BaseListParticipatedLast
} }
return false; return false;
} }
public function getRowFromList($data) {
$criteria = new Criteria("workflow");
$criteria->add(ListParticipatedLastPeer::APP_UID, $data['APP_UID']);
$criteria->add(ListParticipatedLastPeer::USR_UID, $data['USR_UID']);
$dataset = ListParticipatedLastPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
if(is_array($aRow)) {
if(sizeof($aRow)) {
return $aRow;
}
}
return false;
}
public function isTheOne($app_uid, $usr_uid) {
$criteria = new Criteria("workflow");
$criteria->add(ListParticipatedLastPeer::APP_UID, $app_uid);
$criteria->add(ListParticipatedLastPeer::USR_UID, $usr_uid);
$rsCriteria = ListParticipatedLastPeer::doCount($criteria);
if ($rsCriteria == 1) {
return true;
}
return false;
}
} }

View File

@@ -581,7 +581,7 @@ Ext.onReady ( function() {
//Render Full Name //Render Full Name
full_name = function(v, x, s) { full_name = function(v, x, s) {
if (s.data.USR_UID) { if (s.data.USR_UID && s.data.USR_USERNAME) {
return _FNF(s.data.USR_USERNAME, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME); return _FNF(s.data.USR_USERNAME, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME);
} }
else { else {