function postNote($httpData)
{
    //extract(getExtJSParams());
    $appUid = isset($httpData->appUid) ? $httpData->appUid : '';
    $usrUid = isset($httpData->usrUid) ? $httpData->usrUid : '';
    require_once "classes/model/AppNotes.php";
    $appNotes = new AppNotes();
    $noteContent = addslashes($httpData->noteText);
    $result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
    //return true;
    //die();
    //send the response to client
    @ini_set('implicit_flush', 1);
    ob_start();
    //echo G::json_encode($result);
    @ob_flush();
    @flush();
    @ob_end_flush();
    ob_implicit_flush(1);
    //return true;
    //send notification in background
    $noteRecipientsList = array();
    G::LoadClass('case');
    $oCase = new Cases();
    $p = $oCase->getUsersParticipatedInCase($appUid);
    foreach ($p['array'] as $key => $userParticipated) {
        $noteRecipientsList[] = $key;
    }
    $noteRecipients = implode(",", $noteRecipientsList);
    $appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
}
function postNote()
{
    extract(getExtJSParams());
    if (isset($_REQUEST['appUid']) && trim($_REQUEST['appUid']) != "") {
        $appUid = $_REQUEST['appUid'];
    } else {
        $appUid = $_SESSION['APPLICATION'];
    }
    $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
    require_once "classes/model/AppNotes.php";
    $noteContent = addslashes($_POST['noteText']);
    $appNotes = new AppNotes();
    $response = $appNotes->postNewNote($appUid, $usrUid, $noteContent);
    sendJsonResultGeneric($response, $callback);
}
Exemple #3
0
 /**
  * post Note Action
  * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
  * @return array containg the case notes
  */
 function postNote($httpData)
 {
     //extract(getExtJSParams());
     if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
         $appUid = $httpData->appUid;
     } else {
         $appUid = $_SESSION['APPLICATION'];
     }
     if (!isset($appUid)) {
         throw new Exception('Can\'t resolve the Apllication ID for this request.');
     }
     $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
     require_once "classes/model/AppNotes.php";
     $appNotes = new AppNotes();
     $noteContent = addslashes($httpData->noteText);
     $result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
     // Disabling the controller response because we handle a special behavior
     $this->setSendResponse(false);
     //send the response to client
     @ini_set('implicit_flush', 1);
     ob_start();
     echo G::json_encode($result);
     @ob_flush();
     @flush();
     @ob_end_flush();
     ob_implicit_flush(1);
     //send notification in background
     $noteRecipientsList = array();
     G::LoadClass('case');
     $oCase = new Cases();
     $p = $oCase->getUsersParticipatedInCase($appUid);
     foreach ($p['array'] as $key => $userParticipated) {
         $noteRecipientsList[] = $key;
     }
     $noteRecipients = implode(",", $noteRecipientsList);
     $appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
 }
Exemple #4
0
     break;
 case 'showPauseCaseInput':
     //echo '<input type=button onclick="close_pauseCase()" value="Cancel">';
     $aFields = array();
     $G_PUBLISH = new Publisher();
     $aFields['TIME_STAMP'] = G::getformatedDate(date('Y-m-d'), 'M d, yyyy', SYS_LANG);
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_UnpauseDateInput', '', $aFields);
     G::RenderPage('publish', 'raw');
     break;
 case 'pauseCase':
     // Save the note pause reason
     if ($_POST['NOTE_REASON'] != '') {
         require_once "classes/model/AppNotes.php";
         $appNotes = new AppNotes();
         $noteContent = addslashes($_POST['NOTE_REASON']);
         $result = $appNotes->postNewNote($_POST['APP_UID'], $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_PAUSE']);
     }
     // End save
     $unpauseDate = $_POST['unpausedate'] . ' ' . $_REQUEST['unpauseTime'];
     $oCase = new Cases();
     if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
         $APP_UID = $_POST['APP_UID'];
         $DEL_INDEX = $_POST['DEL_INDEX'];
     } elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
         $APP_UID = $_POST['sApplicationUID'];
         $DEL_INDEX = $_POST['iIndex'];
     } else {
         $APP_UID = $_SESSION['APPLICATION'];
         $DEL_INDEX = $_SESSION['INDEX'];
     }
     $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate);
 public function pauseCase()
 {
     try {
         $unpauseDate = $_REQUEST['unpauseDate'] . ' ' . $_REQUEST['unpauseTime'];
         $oCase = new Cases();
         if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
             $APP_UID = $_POST['APP_UID'];
             $DEL_INDEX = $_POST['DEL_INDEX'];
         } elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
             $APP_UID = $_POST['sApplicationUID'];
             $DEL_INDEX = $_POST['iIndex'];
         } else {
             $APP_UID = $_SESSION['APPLICATION'];
             $DEL_INDEX = $_SESSION['INDEX'];
         }
         // Save the note pause reason
         if ($_REQUEST['NOTE_REASON'] != '') {
             require_once "classes/model/AppNotes.php";
             $appNotes = new AppNotes();
             $noteContent = addslashes($_REQUEST['NOTE_REASON']);
             $appNotes->postNewNote($APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_REQUEST['NOTIFY_PAUSE']);
         }
         // End save
         $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate);
         $app = new Application();
         $caseData = $app->load($APP_UID);
         $data['APP_NUMBER'] = $caseData['APP_NUMBER'];
         $data['UNPAUSE_DATE'] = $unpauseDate;
         $result->success = true;
         $result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data);
     } catch (Exception $e) {
         $result->success = false;
         $result->msg = $e->getMessage();
     }
     echo G::json_encode($result);
 }
Exemple #6
0
    /**
     *
     */
    public function pauseCase($usr_uid, $app_uid, $request_data)
    {
        $result = new \stdclass();

        try {
            $unpauseDate = $request_data['unpauseDate'] . ' '. $request_data['unpauseTime'];
            $oCase = new \Cases();
            $iDelIndex = $oCase->getCurrentDelegation( $app_uid, $usr_uid );
            // Save the note pause reason
            if ($request_data['noteContent'] != '') {
                $request_data['noteContent'] = G::LoadTranslation('ID_CASE_PAUSE_LABEL_NOTE') . ' ' . $request_data['noteContent'];
                $appNotes = new \AppNotes();
                $noteContent = addslashes($request_data['noteContent']);
                $appNotes->postNewNote($app_uid, $usr_uid, $noteContent, $request_data['notifyUser']);
            }
            // End save

            $oCase->pauseCase($app_uid, $iDelIndex, $usr_uid, $unpauseDate);
            $app = new \Application();
            $caseData = $app->load($app_uid);
            $data['APP_NUMBER'] = $caseData['APP_NUMBER'];
            $data['UNPAUSE_DATE'] = $unpauseDate;

            $result->success = true;
            $result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data);
        } catch (\Exception $e) {
            throw $e;
        }
        return $result;
    }