Example #1
0
 function deleteCase($params)
 {
     $ainfoCase = array();
     try {
         $applicationUID = isset($_POST['APP_UID']) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
         $app = new Application();
         $caseData = $app->load($applicationUID);
         $data['APP_NUMBER'] = $caseData['APP_NUMBER'];
         $oCase = new Cases();
         $oCase->removeCase($applicationUID);
         $this->success = true;
         $this->msg = G::LoadTranslation('ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data);
     } catch (Exception $e) {
         $this->success = false;
         $this->msg = $e->getMessage();
     }
 }
Example #2
0
         G::LoadSystem($sDataBase);
         $oDataBase = new database();
         $sConcat = $oDataBase->concatString("U.USR_LASTNAME", "' '", "U.USR_FIRSTNAME");
     }
     $sSQL = "   SELECT\n                                    TU.USR_UID AS USR_UID, " . $sConcat . " AS USR_FULLNAME\n                                FROM\n                                    TASK_USER AS TU\n                                    LEFT JOIN\n                                    USERS AS U\n                                    ON (\n                                        TU.USR_UID = U.USR_UID\n                                    )\n                                WHERE\n                                    TU.TAS_UID     = '" . $_POST['TAS_UID'] . "' AND\n                                    TU.TU_TYPE     = 1 AND\n                                    TU.TU_RELATION = 1 AND\n                                    U.USR_STATUS   = 1";
     $oDataset = $oSession->Execute($sSQL);
     while ($aRow = $oDataset->Read()) {
         $sAux .= '<option value="' . $aRow['USR_UID'] . '">' . $aRow['USR_FULLNAME'] . '</option>';
     }
     $sAux .= '</select>';
     echo $sAux;
     break;
 case 'EVALUATE':
     G::LoadClass('application');
     $oApplication = new Application(new DBConnection());
     $oApplication->load($_SESSION['APPLICATION']);
     $sUser = '';
     if ($_POST['TAS_ASSIGN_VARIABLE'] != '') {
         if (isset($oApplication->Fields['APP_DATA'][str_replace('@@', '', $_POST['TAS_ASSIGN_VARIABLE'])])) {
             $sUser = $oApplication->Fields['APP_DATA'][str_replace('@@', '', $_POST['TAS_ASSIGN_VARIABLE'])];
         }
     }
     if ($sUser != '') {
         G::LoadClass('user');
         $oUser = new User(new DBConnection());
         $oUser->load($sUser);
         echo $oUser->Fields['USR_FIRSTNAME'] . ' ' . $oUser->Fields['USR_LASTNAME'] . '<input type="hidden" name="form[TASKS][1][USR_UID]" id="form[TASKS][1][USR_UID]" value="' . $sUser . '">';
     } else {
         echo '<strong>Error: </strong>' . $_POST['TAS_ASSIGN_VARIABLE'] . ' ' . G::LoadTranslation('ID_EMPTY');
         echo '<input type="hidden" name="_ERROR_" id="_ERROR_" value="">';
     }
Example #3
0
    function getDerivatedCases ($sParentUid, $sDelIndexParent)

    {

        $oCriteria = new Criteria( 'workflow' );

        $cases = array ();

        $derivation = array ();

        //get the child delegations , of parent delIndex

        $children = array ();

        $oCriteria->clearSelectColumns();

        $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );

        $oCriteria->add( AppDelegationPeer::APP_UID, $sParentUid );

        $oCriteria->add( AppDelegationPeer::DEL_PREVIOUS, $sDelIndexParent );

        $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );

        $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

        $oDataset->next();

        $aRow = $oDataset->getRow();

        while (is_array( $aRow )) {

            $children[] = $aRow['DEL_INDEX'];



            $oDataset->next();

            $aRow = $oDataset->getRow();

        }



        //foreach child , get the info of their derivations and subprocesses

        foreach ($children as $keyChild => $child) {

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->clearSelectColumns();

            $oCriteria->addSelectColumn( SubApplicationPeer::APP_UID );

            $oCriteria->addSelectColumn( AppDelegationPeer::APP_UID );

            $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );

            $oCriteria->addSelectColumn( AppDelegationPeer::PRO_UID );

            $oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );

            $oCriteria->addSelectColumn( AppDelegationPeer::USR_UID );

            $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );

            $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );

            $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );



            $oCriteria->add( SubApplicationPeer::APP_PARENT, $sParentUid );

            $oCriteria->add( SubApplicationPeer::DEL_INDEX_PARENT, $child );

            $oCriteria->addJoin( SubApplicationPeer::APP_UID, AppDelegationPeer::APP_UID );

            $oCriteria->addJoin( AppDelegationPeer::USR_UID, UsersPeer::USR_UID );

            $oDataset = SubApplicationPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $aRow = $oDataset->getRow();

            while (is_array( $aRow )) {

                $oProcess = new Process();

                $proFields = $oProcess->load( $aRow['PRO_UID'] );

                $oCase = new Application();

                $appFields = $oCase->load( $aRow['APP_UID'] );

                $oTask = new Task();

                $tasFields = $oTask->load( $aRow['TAS_UID'] );

                $derivation[] = array ('processId' => $aRow['PRO_UID'],'processTitle' => $proFields['PRO_TITLE'],'caseId' => $aRow['APP_UID'],'caseNumber' => $appFields['APP_NUMBER'],'taskId' => $aRow['TAS_UID'],'taskTitle' => $tasFields['TAS_TITLE'],'userId' => $aRow['USR_UID'],'userName' => $aRow['USR_USERNAME'],'userFullname' => $aRow['USR_FIRSTNAME'] . ' ' . $aRow['USR_LASTNAME']

                );



                $oDataset->next();

                $aRow = $oDataset->getRow();

            }

        }



        return $derivation;

    }
Example #4
0
    public function reactivateCase($sApplicationUID, $iIndex, $user_logged)

    {

        $oApplication = new Application();

        $aFields = $oApplication->load(

                (isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION'])

        );

        $aFields['APP_STATUS'] = 'TO_DO';

        $oApplication->update($aFields);

        $this->ReactivateCurrentDelegation($sApplicationUID, $iIndex);

        $c = new Criteria('workflow');

        $c->clearSelectColumns();

        $c->addSelectColumn(AppDelayPeer::APP_DELAY_UID);



        $c->add(AppDelayPeer::APP_UID, $sApplicationUID);

        $c->add(AppDelayPeer::PRO_UID, $aFields['PRO_UID']);

        $c->add(AppDelayPeer::APP_DEL_INDEX, $iIndex);

        $c->add(AppDelayPeer::APP_TYPE, 'CANCEL');

        $c->add(AppDelayPeer::APP_DISABLE_ACTION_USER, 0);

        $c->add(AppDelayPeer::APP_DISABLE_ACTION_DATE, null, Criteria::ISNULL);



        $oDataset = AppDelayPeer::doSelectRS($c);

        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $oDataset->next();

        $aRow = $oDataset->getRow();

        //var_dump($aRow);

        $aFields = array();

        $aFields['APP_DELAY_UID'] = $aRow['APP_DELAY_UID'];

        $aFields['APP_DISABLE_ACTION_USER'] = $user_logged;

        $aFields['APP_DISABLE_ACTION_DATE'] = date('Y-m-d H:i:s');



        $delay = new AppDelay();

        $delay->update($aFields);

        //$this->ReactivateCurrentDelegation($sApplicationUID);

        $con = Propel::getConnection('workflow');

        $sql = "UPDATE APP_THREAD SET APP_THREAD_STATUS = 'OPEN' WHERE APP_UID =  '$sApplicationUID' " .

                " AND DEL_INDEX  ='$iIndex' ";

        $stmt = $con->createStatement();

        $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);



        //update searchindex

        if ($this->appSolr != null) {

            $this->appSolr->updateApplicationSearchIndex($sApplicationUID);

        }

    }
Example #5
0
 public function reactivateCase()
 {
     try {
         $applicationUID = isset($_POST['APP_UID']) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
         $delIndex = isset($_POST['DEL_INDEX']) ? $_POST['DEL_INDEX'] : $_SESSION['INDEX'];
         $app = new Application();
         $caseData = $app->load($applicationUID);
         $data['APP_NUMBER'] = $caseData['APP_NUMBER'];
         $oCase = new Cases();
         $oCase->reactivateCase($applicationUID, $delIndex, $_SESSION['USER_LOGGED']);
         $result->success = true;
         $result->msg = G::LoadTranslation('ID_CASE_REACTIVATED_SUCCESSFULLY', SYS_LANG, $data);
     } catch (Exception $e) {
         $result->success = false;
         $result->msg = $e->getMessage();
     }
     print G::json_encode($result);
 }
Example #6
0
    $tasks = $task->load($_SESSION['TASK']);
    $result->data = $case->getUsersToReassign($_SESSION['TASK'], $_SESSION['USER_LOGGED'], $tasks['PRO_UID']);
    print G::json_encode($result);
}
if ($actionAjax == 'reassignCase') {
    $APP_UID = $_REQUEST["APP_UID"];
    $DEL_INDEX = $_REQUEST["DEL_INDEX"];
    $_SESSION['APPLICATION'] = $APP_UID;
    $_SESSION['INDEX'] = $DEL_INDEX;
    $cases = new Cases();
    $user = new Users();
    $app = new Application();
    $TO_USR_UID = $_POST['USR_UID'];
    try {
        $cases->reassignCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $TO_USR_UID);
        $caseData = $app->load($_SESSION['APPLICATION']);
        $userData = $user->load($TO_USR_UID);
        //print_r($caseData);
        $data['APP_NUMBER'] = $caseData['APP_NUMBER'];
        $data['USER'] = $userData['USR_LASTNAME'] . ' ' . $userData['USR_FIRSTNAME'];
        //TODO change with the farmated username from environment conf
        $result->status = 0;
        $result->msg = G::LoadTranslation('ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data);
    } catch (Exception $e) {
        $result->status = 1;
        $result->msg = $e->getMessage();
    }
    print G::json_encode($result);
}
if ($actionAjax == 'showHistoryMessage') {
    ?>
     }
     G::RenderPage('publish', 'raw');
     break;
 case "SendMessage":
     require_once 'classes/model/Application.php';
     $sessionId = $frm["SESSION_ID"];
     $from = $frm["FROM"];
     $to = $frm["TO_EMAIL"];
     $cc = isset($frm["CC_MAIL"]) ? $frm["CC_MAIL"] : '';
     $bcc = isset($frm["BCC_MAIL"]) ? $frm["BCC_MAIL"] : '';
     $caseId = $frm["CASE_ID"];
     $subject = $frm["SUBJECT"];
     $message = $frm["MESSAGE"];
     // getting the proUid variable
     $oCases = new Application();
     $oCases->load($caseId);
     $proUid = $oCases->getProUid();
     $caseNumber = $oCases->getAppNumber();
     // generating the path for the template msj
     $templateFile = PATH_DB . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'tempTemplate.hml';
     // generating the file adding the msj variable
     $messageBody = "message for case: " . $caseNumber . "<br>" . $message;
     file_put_contents($templateFile, $messageBody);
     $params = array('sessionId' => $sessionId, 'caseId' => $caseId, 'from' => $from, 'to' => $to, 'cc' => $cc, 'bcc' => $bcc, 'subject' => $subject, 'template' => 'tempTemplate.hml');
     $result = $client->__SoapCall('sendMessage', array($params));
     $G_PUBLISH = new Publisher();
     $fields['status_code'] = $result->status_code;
     $fields['message'] = $result->message;
     $fields['time_stamp'] = $result->timestamp;
     if ($result->status_code == 9) {
         $_SESSION['WS_SESSION_ID'] = '';
Example #8
0
         $sConcat = $oDataBase->concatString("U.USR_LASTNAME", "' '", "U.USR_FIRSTNAME");
     }
     $sSQL = "   SELECT\n                                    TU.USR_UID AS USR_UID, " . $sConcat . " AS USR_FULLNAME\n                                FROM\n                                    TASK_USER AS TU\n                                    LEFT JOIN\n                                    USERS AS U\n                                    ON (\n                                        TU.USR_UID = U.USR_UID\n                                    )\n                                WHERE\n                                    TU.TAS_UID     = '" . $_POST['TAS_UID'] . "' AND\n                                    TU.TU_TYPE     = 1 AND\n                                    TU.TU_RELATION = 1 AND\n                                    U.USR_STATUS   = 1";
     $oDataset = $oSession->Execute($sSQL);
     while ($aRow = $oDataset->Read()) {
         $sAux .= '<option value="' . $aRow['USR_UID'] . '">' . $aRow['USR_FULLNAME'] . '</option>';
     }
     $sAux .= '</select>';
     echo $sAux;
     break;
 case 'EVALUATE':
     $TAS_ASSIGN_VARIABLE = $filter->xssFilterHard($_POST['TAS_ASSIGN_VARIABLE']);
     $APPLICATION = $filter->xssFilterHard($_SESSION['APPLICATION']);
     G::LoadClass('application');
     $oApplication = new Application(new DBConnection());
     $oApplication->load($APPLICATION);
     $sUser = '';
     if ($TAS_ASSIGN_VARIABLE != '') {
         if (isset($oApplication->Fields['APP_DATA'][str_replace('@@', '', $TAS_ASSIGN_VARIABLE)])) {
             $sUser = $oApplication->Fields['APP_DATA'][str_replace('@@', '', $TAS_ASSIGN_VARIABLE)];
         }
     }
     if ($sUser != '') {
         G::LoadClass('user');
         $oUser = new User(new DBConnection());
         $oUser->load($sUser);
         echo $oUser->Fields['USR_FIRSTNAME'] . ' ' . $oUser->Fields['USR_LASTNAME'] . '<input type="hidden" name="form[TASKS][1][USR_UID]" id="form[TASKS][1][USR_UID]" value="' . $sUser . '">';
     } else {
         $ID_EMPTY = $filter->xssFilterHard(G::LoadTranslation('ID_EMPTY'));
         echo '<strong>Error: </strong>' . $TAS_ASSIGN_VARIABLE . ' ' . $ID_EMPTY;
         echo '<input type="hidden" name="_ERROR_" id="_ERROR_" value="">';
    $res = $obj->create();
} catch (Exception $e) {
    //#14
    $t->isa_ok($e, 'PropelException', 'create() return error when APP_UID is not defined');
    //#15
    $t->like($e->getMessage(), "%Unable to execute INSERT statement%", 'getAppTitle() return Error in getAppTitle, the APP_UID cant be blank');
}
//create
try {
    $obj = new Application();
    $appUid = $obj->create('1');
    //#16
    $t->isa_ok($appUid, 'string', 'create(), creates a new application');
    //#17
    $t->is(strlen($appUid), 14, 'create(), creates a new application, Guid lenth=14 chars');
    $res = $obj->load($appUid);
    //#18
    $t->isa_ok($res, 'array', 'load(), loads a new application');
    //#19
    $t->is($res['APP_UID'], $appUid, 'load(), loads a new application, valid APP_UID');
    //#20
    $t->is($res['APP_FINISH_DATE'], '1902-01-01 00:00:00', 'load(), loads a new application, valid FINISH_DATE');
    //#21
    $t->like($res['APP_TITLE'], '%#%', 'load(), loads a new application, valid APP_TITLE');
    //#22
    $t->is($res['APP_PARENT'], '', 'load(), loads a new application, valid APP_PARENT');
} catch (Exception $e) {
    $t->like($e->getMessage(), "%Unable to execute INSERT statement%", 'create() return Error in getAppTitle, the APP_UID cant be blank');
}
//update with empty
try {
Example #10
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;
    }
Example #11
0
 /**
  * Cancel case
  *
  * @param string caseUid : ID of the case.
  * @param int delIndex : Delegation index of the case.
  * @param string userUid : The unique ID of the user who will cancel the case.
  * @return $result will return an object
  */
 public function cancelCase($caseUid, $delIndex, $userUid)
 {
     $g = new G();
     try {
         $g->sessionVarSave();
         $_SESSION["APPLICATION"] = $caseUid;
         $_SESSION["INDEX"] = $delIndex;
         $_SESSION["USER_LOGGED"] = $userUid;
         if (empty($caseUid)) {
             $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid");
             $g->sessionVarRestore();
             return $result;
         }
         if (empty($delIndex)) {
             $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " delIndex");
             $g->sessionVarRestore();
             return $result;
         }
         if (empty($userUid)) {
             $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid");
             $g->sessionVarRestore();
             return $result;
         }
         $oApplication = new Application();
         $aFields = $oApplication->load($caseUid);
         if ($aFields['APP_STATUS'] == 'DRAFT') {
             $result = new wsResponse(100, G::LoadTranslation("ID_CASE_IN_STATUS") . " DRAFT");
             $g->sessionVarRestore();
             return $result;
         }
         $case = new Cases();
         $case->cancelCase($caseUid, $delIndex, $userUid);
         //Response
         $res = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
         $result = array("status_code" => $res->status_code, "message" => $res->message, "timestamp" => $res->timestamp);
         $g->sessionVarRestore();
         return $result;
     } catch (Exception $e) {
         $result = new wsResponse(100, $e->getMessage());
         $g->sessionVarRestore();
         return $result;
     }
 }
Example #12
0
function __autoload($class)
{
    if (!Application::load($class)) {
        die("Could not locate class: {$class}");
    }
}