diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po
index 9d7d8877e..c61836c54 100644
--- a/workflow/engine/content/translations/english/processmaker.en.po
+++ b/workflow/engine/content/translations/english/processmaker.en.po
@@ -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
diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql
index 625b3adc3..5d64cdb0f 100644
--- a/workflow/engine/data/mysql/insert.sql
+++ b/workflow/engine/data/mysql/insert.sql
@@ -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.
Do you want to reassign these tasks to another user now?','2014-01-15') ,
( 'LABEL','LOGIN_VERIFY_MSG','en','Verifying...','2014-01-15') ,
diff --git a/workflow/engine/methods/users/users_Ajax.php b/workflow/engine/methods/users/users_Ajax.php
index 5052db1cb..6e3961caf 100644
--- a/workflow/engine/methods/users/users_Ajax.php
+++ b/workflow/engine/methods/users/users_Ajax.php
@@ -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: ';
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php
index 6dffa896b..23b8f8b03 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php
@@ -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;
+ }
+ }
}