Merged in bugfix/HOR-2858 (pull request #5555)

HOR-2858

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2017-05-03 20:25:24 +00:00
committed by Julio Cesar Laura Avendaño
4 changed files with 34 additions and 8 deletions

View File

@@ -3064,8 +3064,8 @@ msgstr "Role"
# TRANSLATION # TRANSLATION
# LABEL/ID_MSG_CANNOT_DELETE_USER # LABEL/ID_MSG_CANNOT_DELETE_USER
#: LABEL/ID_MSG_CANNOT_DELETE_USER #: LABEL/ID_MSG_CANNOT_DELETE_USER
msgid "User cannot be deleted while still assigned to cases." msgid "The user cannot be deleted since it is referenced in a process design and/or has assigned cases."
msgstr "User cannot be deleted while still assigned to cases." msgstr "The user cannot be deleted since it is referenced in a process design and/or has assigned cases."
# TRANSLATION # TRANSLATION
# LABEL/ID_MSG_REMOVE_PLUGIN # LABEL/ID_MSG_REMOVE_PLUGIN

View File

@@ -1954,7 +1954,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_PENDING','en','Pending','2014-01-15') , ( 'LABEL','ID_PENDING','en','Pending','2014-01-15') ,
( 'LABEL','ID_FULL_NAME','en','Full Name','2014-01-15') , ( 'LABEL','ID_FULL_NAME','en','Full Name','2014-01-15') ,
( 'LABEL','ID_ROLE','en','Role','2014-01-15') , ( 'LABEL','ID_ROLE','en','Role','2014-01-15') ,
( 'LABEL','ID_MSG_CANNOT_DELETE_USER','en','User cannot be deleted while still assigned to cases.','2014-10-21') , ( 'LABEL','ID_MSG_CANNOT_DELETE_USER','en','The user cannot be deleted since it is referenced in a process design and/or has assigned cases.','2017-03-22') ,
( 'LABEL','ID_MSG_REMOVE_PLUGIN','en','Are you sure that you want to remove this plugin?','2014-01-15') , ( 'LABEL','ID_MSG_REMOVE_PLUGIN','en','Are you sure that you want to remove this plugin?','2014-01-15') ,
( 'JAVASCRIPT','USERS_REASSIGN','en','This user cannot be deleted because he/she still has some pending tasks. <br/><br/>Do you want to reassign these tasks to another user now?','2014-01-15') , ( 'JAVASCRIPT','USERS_REASSIGN','en','This user cannot be deleted because he/she still has some pending tasks. <br/><br/>Do you want to reassign these tasks to another user now?','2014-01-15') ,
( 'LABEL','LOGIN_VERIFY_MSG','en','Verifying...','2014-01-15') , ( 'LABEL','LOGIN_VERIFY_MSG','en','Verifying...','2014-01-15') ,

View File

@@ -179,17 +179,23 @@ try {
case 'canDeleteUser': case 'canDeleteUser':
G::LoadClass('case'); G::LoadClass('case');
$oProcessMap = new Cases(); $oProcessMap = new Cases();
$USR_UID = $_POST['uUID']; $userUid = $_POST['uUID'];
$total = 0; $total = 0;
$history = 0; $history = 0;
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases('TO_DO', $userUid);
$total += ApplicationPeer::doCount($c); $total += ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases('DRAFT', $userUid);
$total += ApplicationPeer::doCount($c); $total += ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $userUid);
$history += ApplicationPeer::doCount($c); $history += ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID); $c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $userUid);
$history += ApplicationPeer::doCount($c); $history += ApplicationPeer::doCount($c);
//Check if the user is configured in Web Entry
if ($total === 0) {
$webEntry = new \ProcessMaker\BusinessModel\WebEntryEvent();
$total = $webEntry->getWebEntryRelatedToUser($userUid);
}
$response = '{success: true, candelete: '; $response = '{success: true, candelete: ';
$response .= ($total > 0) ? 'false' : 'true'; $response .= ($total > 0) ? 'false' : 'true';
$response .= ', hashistory: '; $response .= ', hashistory: ';

View File

@@ -996,4 +996,24 @@ class WebEntryEvent
throw $e; throw $e;
} }
} }
/**
* This function verify if a user $userUid was configure in a Web Entry and return the total of records
*
* @param string $userUid uid of a user
*
* return integer $total
*/
public function getWebEntryRelatedToUser($userUid)
{
try {
//Get data
$criteria = $this->getWebEntryEventCriteria();
$criteria->add(\WebEntryEventPeer::USR_UID, $userUid, \Criteria::EQUAL);
$total = \WebEntryEventPeer::doCount($criteria);
return $total;
} catch (\Exception $e) {
throw $e;
}
}
} }