// Send notifications - Start $oUser = new Users(); $aUser = $oUser->load($_SESSION['USER_LOGGED']); if (trim($aUser['USR_EMAIL']) == '') { $aUser['USR_EMAIL'] = 'info@' . $_SERVER['HTTP_HOST']; } $sFromName = '"' . $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . '" <' . $aUser['USR_EMAIL'] . '>'; try { $oCase->sendNotifications($_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName); } catch (Exception $e) { G::SendTemporalMessage(G::loadTranslation('ID_NOTIFICATION_ERROR') . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%'); } // Send notifications - End // Events - Start $oEvent = new Event(); $oEvent->closeAppEvents($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']); $oCurrentAppDel = AppDelegationPeer::retrieveByPk($_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1); $multipleDelegation = false; // check if there are multiple derivations if (count($_POST['form']['TASKS']) > 1) { $multipleDelegation = true; } // If the case has been delegated if (isset($oCurrentAppDel)) { // if there is just a single derivation the TASK_UID can be set by the delegation data if (!$multipleDelegation) { $aCurrentAppDel = $oCurrentAppDel->toArray(BasePeer::TYPE_FIELDNAME); $oEvent->createAppEvents($aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID']); } else { // else we need to check every task and create the events if it have any foreach ($_POST['form']['TASKS'] as $taskDelegated) {