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:
@@ -3064,8 +3064,8 @@ msgstr "Role"
|
||||
# TRANSLATION
|
||||
# LABEL/ID_MSG_CANNOT_DELETE_USER
|
||||
#: LABEL/ID_MSG_CANNOT_DELETE_USER
|
||||
msgid "User cannot be deleted while still assigned to cases."
|
||||
msgstr "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 "The user cannot be deleted since it is referenced in a process design and/or has assigned cases."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_MSG_REMOVE_PLUGIN
|
||||
|
||||
@@ -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_FULL_NAME','en','Full Name','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') ,
|
||||
( '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') ,
|
||||
|
||||
@@ -179,17 +179,23 @@ try {
|
||||
case 'canDeleteUser':
|
||||
G::LoadClass('case');
|
||||
$oProcessMap = new Cases();
|
||||
$USR_UID = $_POST['uUID'];
|
||||
$userUid = $_POST['uUID'];
|
||||
$total = 0;
|
||||
$history = 0;
|
||||
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $userUid);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $userUid);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $userUid);
|
||||
$history += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $userUid);
|
||||
$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 .= ($total > 0) ? 'false' : 'true';
|
||||
$response .= ', hashistory: ';
|
||||
|
||||
@@ -996,4 +996,24 @@ class WebEntryEvent
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user