HOR-773
Error al eliminar el template de un email message event HOR-773 fix error delte template
This commit is contained in:
@@ -5059,6 +5059,12 @@ msgstr "Language deleted successfully!"
|
||||
msgid "There is {0} cases started with this language, delete action canceled!"
|
||||
msgstr "There is {0} cases started with this language, delete action canceled!"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_CANNOT_REMOVE_TEMPLATE_EMAIL_EVENT
|
||||
#: LABEL/ID_CANNOT_REMOVE_TEMPLATE_EMAIL_EVENT
|
||||
msgid "You can not delete the template {0} because it has a relationship with Email Event"
|
||||
msgstr "You can not delete the template {0} because it has a relationship with Email Event"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_TOTAL_CASES
|
||||
#: LABEL/ID_TOTAL_CASES
|
||||
|
||||
@@ -2271,6 +2271,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_DELETE_LANGUAGE','en','Remove','2014-01-15') ,
|
||||
( 'LABEL','ID_LANGUAGE_DELETED_SUCCESSFULLY','en','Language deleted successfully!','2014-01-15') ,
|
||||
( 'LABEL','ID_LANGUAGE_CANT_DELETE','en','There is {0} cases started with this language, delete action canceled!','2014-01-15') ,
|
||||
( 'LABEL','ID_CANNOT_REMOVE_TEMPLATE_EMAIL_EVENT','en','You can not delete the template {0} because it has a relationship with Email Event','2014-01-15') ,
|
||||
( 'LABEL','ID_TOTAL_CASES','en','Total Cases','2014-01-15') ,
|
||||
( 'LABEL','ID_HEARTBEAT_CONFIG','en','Heart Beat','2014-01-15') ,
|
||||
( 'LABEL','ID_PM_HEARTBEAT_SETTINGS_TITLE','en','Heart Beat Configuration','2014-01-15') ,
|
||||
|
||||
@@ -247,16 +247,16 @@ class EmailEvent
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
if($passValidation) {
|
||||
if ($passValidation) {
|
||||
$this->verifyIfEmailEventExists($emailEventUid);
|
||||
|
||||
//Delete file
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$arrayData = $this->getEmailEventDataByUid($pro_uid, $emailEventUid);
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
if(sizeof($arrayData)) {
|
||||
if (sizeof($arrayData)) {
|
||||
$prfUid = $arrayData['PRF_UID'];
|
||||
$filesManager->deleteProcessFilesManager($pro_uid,$prfUid);
|
||||
$filesManager->deleteProcessFilesManager($pro_uid, $prfUid, true);
|
||||
}
|
||||
}
|
||||
//Delete Email event
|
||||
|
||||
@@ -495,7 +495,7 @@ class FilesManager
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function deleteProcessFilesManager($sProcessUID, $prfUid)
|
||||
public function deleteProcessFilesManager($sProcessUID, $prfUid, $verifyingRelationship = false)
|
||||
{
|
||||
try {
|
||||
$path = '';
|
||||
@@ -513,6 +513,22 @@ class FilesManager
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
|
||||
}
|
||||
|
||||
$relationshipEmailEvent = false;
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\EmailEventPeer::PRF_UID);
|
||||
$criteria->add(\EmailEventPeer::PRF_UID, $prfUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \EmailEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
while ($aRow = $rsCriteria->getRow()) {
|
||||
$relationshipEmailEvent = true;
|
||||
$rsCriteria->next();
|
||||
}
|
||||
if ($relationshipEmailEvent && !$verifyingRelationship) {
|
||||
throw new \Exception(\G::LoadTranslation(G::LoadTranslation('ID_CANNOT_REMOVE_TEMPLATE_EMAIL_EVENT',
|
||||
array(end(explode(DIRECTORY_SEPARATOR,$path))))));
|
||||
}
|
||||
|
||||
$sFile = end(explode(DIRECTORY_SEPARATOR,$path));
|
||||
$path = PATH_DATA_MAILTEMPLATES.$sProcessUID.DIRECTORY_SEPARATOR.$sFile;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user