/** * Save new case note * * @access public * @param string $app_uid, Uid for case * @param array $app_data, Data for case variables * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia */ public function saveCaseNote($app_uid, $usr_uid, $note_content, $send_mail = false) { Validator::isString($app_uid, '$app_uid'); Validator::appUid($app_uid, '$app_uid'); Validator::isString($usr_uid, '$usr_uid'); Validator::usrUid($usr_uid, '$usr_uid'); Validator::isString($note_content, '$note_content'); if (strlen($note_content) > 500) { throw (new \Exception(\G::LoadTranslation("ID_INVALID_MAX_PERMITTED", array($note_content,'500')))); } Validator::isBoolean($send_mail, '$send_mail'); $case = new \Cases(); $caseLoad = $case->loadCase($app_uid); $pro_uid = $caseLoad['PRO_UID']; $tas_uid = \AppDelegation::getCurrentTask($app_uid); $respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' ); $respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' ); if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { throw (new \Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); } $note_content = addslashes($note_content); $appNote = new \AppNotes(); $appNote->addCaseNote($app_uid, $usr_uid, $note_content, intval($send_mail)); }