예제 #1
0
/**
 * this function get the fields that are part of the temporal
 * dynaform file.
 *
 * @name getTemporalFields
 * @author gustavo cruz
 * @access public
 * @param $file - the name of the dynaform file
 * @return invalidFields string
 */
function getTemporalFields($file)
{
    try {
        //$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', 'display:none', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');
        $i = 0;
        $aFields = array();
        $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char');
        $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '_tmp0.xml', '', '', '', 'myxml'));
        $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
        $iMaximun = $oDataset->count();
        while ($aRow = $oDataset->Read()) {
            $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '', 'row__' => $i + 1);
            $i++;
        }
        // print_r($aFields);
        // die;
    } catch (Exception $e) {
    }
    $invalidFields = validateGridConversion($aFields);
    if (count($invalidFields) > 0) {
        return implode(", ", $invalidFields);
    } else {
        return "ok";
    }
}
 public function saveInputDoc($params)
 {
     require_once 'classes/model/InputDocument.php';
     G::LoadClass('processMap');
     $aData = array();
     $aData['PRO_UID'] = $params->PRO_UID;
     $aData['INP_DOC_UID'] = $params->INP_DOC_UID;
     $aData['INP_DOC_TITLE'] = $params->INP_DOC_TITLE;
     $aData['INP_DOC_FORM_NEEDED'] = $params->INP_DOC_FORM_NEEDED;
     if ($aData['INP_DOC_FORM_NEEDED'] != 'VIRTUAL') {
         $aData['INP_DOC_ORIGINAL'] = $params->INP_DOC_ORIGINAL;
     } else {
         $aData['INP_DOC_ORIGINAL'] = 'ORIGINAL';
     }
     $aData['INP_DOC_VERSIONING'] = $params->INP_DOC_VERSIONING;
     $aData['INP_DOC_DESCRIPTION'] = $params->INP_DOC_DESCRIPTION;
     $aData['INP_DOC_DESTINATION_PATH'] = $params->INP_DOC_DESTINATION_PATH;
     $aData['INP_DOC_TAGS'] = $params->INP_DOC_TAGS;
     $oInputDocument = new InputDocument();
     if ($aData['INP_DOC_UID'] == '') {
         unset($aData['INP_DOC_UID']);
         $oInputDocument->create($aData);
         $this->msg = G::LoadTranslation('ID_INPUT_DOC_SUCCESS_NEW');
     } else {
         $oInputDocument->update($aData);
         $this->msg = G::LoadTranslation('ID_INPUT_DOC_SUCCESS_UPDATE');
     }
     //refresh dbarray with the last change in inputDocument
     $oMap = new processMap();
     $oCriteria = $oMap->getInputDocumentsCriteria($aData['PRO_UID']);
     $this->success = true;
 }
예제 #3
0
function AuthenticationBasicHTTP($realm)
{
    if (empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER'])) {
        header('WWW-Authenticate: Basic realm="' . $realm . '"');
        header('HTTP/1.0 401 Unauthorized');
        die('401 Unauthorized');
    }
    global $RBAC;
    $uid = $RBAC->VerifyLogin($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
    if ($uid > 0) {
        // Asign the uid of user to userloggedobj
        $RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
        $res = $RBAC->userCanAccess('PM_WEBDAV');
        if ($res != 1) {
            if ($res == -2) {
                $msg = G::LoadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM');
            } else {
                $msg = G::LoadTranslation('ID_USER_HAVENT_RIGHTS_PAGE');
            }
            header('WWW-Authenticate: Basic realm="' . $realm . '"');
            header('HTTP/1.0 401 ' . $msg);
            die('401 ' . $msg);
            return false;
            die;
        }
        return true;
    }
    header('WWW-Authenticate: Basic realm="' . $realm . '"');
    header('HTTP/1.0 401 Unauthorized');
    die('401 Unauthorized');
    return false;
}
 /**
  * Create record
  *
  * @param string $applicationUid Unique id of Case
  * @param int    $delIndex       Delegation index
  * @param array  $arrayData      Data
  *
  * return void
  */
 public function create($applicationUid, $delIndex, array $arrayData)
 {
     try {
         $cnn = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME);
         try {
             $appAssignSelfServiceValue = new AppAssignSelfServiceValue();
             $appAssignSelfServiceValue->fromArray($arrayData, BasePeer::TYPE_FIELDNAME);
             $appAssignSelfServiceValue->setAppUid($applicationUid);
             $appAssignSelfServiceValue->setDelIndex($delIndex);
             if ($appAssignSelfServiceValue->validate()) {
                 $cnn->begin();
                 $result = $appAssignSelfServiceValue->save();
                 $cnn->commit();
             } else {
                 $msg = "";
                 foreach ($appAssignSelfServiceValue->getValidationFailures() as $validationFailure) {
                     $msg .= ($msg != "" ? "\n" : "") . $validationFailure->getMessage();
                 }
                 throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . ($msg != "" ? "\n" . $msg : ""));
             }
         } catch (Exception $e) {
             $cnn->rollback();
             throw $e;
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
예제 #5
0
 public function create(array $arrayData)
 {
     $cnn = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
     try {
         $this->setCfgUid($arrayData["CFG_UID"]);
         $this->setObjUid($arrayData["OBJ_UID"]);
         $this->setCfgValue(isset($arrayData["CFG_VALUE"]) ? $arrayData["CFG_VALUE"] : "");
         $this->setProUid($arrayData["PRO_UID"]);
         $this->setUsrUid($arrayData["USR_UID"]);
         $this->setAppUid($arrayData["APP_UID"]);
         if ($this->validate()) {
             $cnn->begin();
             $result = $this->save();
             $cnn->commit();
             //Return
             return $result;
         } else {
             $msg = "";
             foreach ($this->getValidationFailures() as $validationFailure) {
                 $msg = $msg . ($msg != "" ? "\n" : "") . $validationFailure->getMessage();
             }
             throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . ($msg != "" ? "\n" . $msg : ""));
         }
     } catch (Exception $e) {
         $cnn->rollback();
         throw $e;
     }
 }
예제 #6
0
 /**
  * CALENDAR
  * getting default list
  * @param string $httpData->PRO_UID (opional)
  */
 public function calendarEdit($httpData)
 {
     global $RBAC;
     //$RBAC->requirePermissions('PM_SETUP_ADVANCE');
     G::LoadClass('configuration');
     G::LoadClass('calendar');
     $CalendarUid = str_replace('"', '', isset($_GET['id']) ? $_GET['id'] : G::GenerateUniqueID());
     $calendarObj = new calendar();
     if (isset($_GET['id']) && $_GET['id'] != "") {
         $fields = $calendarObj->getCalendarInfoE($CalendarUid);
         $fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
     }
     if (!isset($fields['CALENDAR_UID'])) {
         //For a new Calendar
         $fields['CALENDAR_UID'] = $CalendarUid;
         $fields['OLD_NAME'] = '';
         //Default Business Hour
         $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_DAY'] = 7;
         $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_START'] = "09:00";
         $fields['BUSINESS_DAY'][1]['CALENDAR_BUSINESS_END'] = "17:00";
     }
     if (isset($_GET['cp']) && $_GET['cp'] == 1) {
         // Copy Calendar
         $fields['CALENDAR_UID'] = G::GenerateUniqueID();
         $fields['CALENDAR_NAME'] = G::LoadTranslation("ID_COPY_OF") . " " . $fields['CALENDAR_NAME'];
         $fields['OLD_NAME'] = $fields['CALENDAR_NAME'];
     }
     $c = new Configurations();
     $configPage = $c->getConfiguration('additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED']);
     $Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
     $this->includeExtJS('admin/calendarEdit');
     $this->setView('admin/calendarEdit');
     $businessDayArray = array();
     for ($i = 0; $i < sizeof($fields['BUSINESS_DAY']); $i++) {
         $businessDayArray[$i] = $fields['BUSINESS_DAY'][$i + 1];
     }
     $fields['BUSINESS_DAY'] = $businessDayArray;
     //validating if the calendar is new, it means that we don't have the $_GET array
     $fields['HOLIDAY'] = isset($_GET['id']) && $_GET['id'] != '' ? $fields['HOLIDAY'] : array();
     $holidayArray = array();
     for ($i = 0; $i < sizeof($fields['HOLIDAY']); $i++) {
         $holidayArray[$i] = $fields['HOLIDAY'][$i + 1];
     }
     $_GET['id'] = isset($_GET['id']) && $_GET['id'] != '' ? $_GET['id'] : '';
     $fields['HOLIDAY'] = $holidayArray;
     $fields['NEWCALENDAR'] = 'NO';
     if (isset($_GET['id']) && $_GET['id'] == '') {
         $fields['CALENDAR_UID'] = G::GenerateUniqueID();
         $fields['NEWCALENDAR'] = 'YES';
     }
     $this->setJSVar('CALENDAR_UID', $fields['CALENDAR_UID']);
     $this->setJSVar('fields', $fields);
     G::RenderPage('publish', 'extJs');
 }
예제 #7
0
 /**
  * Constructor of the class
  *
  * return void
  */
 public function __construct()
 {
     try {
         $user = new \ProcessMaker\BusinessModel\User();
         $usrUid = $this->getUserId();
         if (!$user->checkPermission($usrUid, "PM_SETUP")) {
             throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($usrUid)));
         }
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }
예제 #8
0
 /**
  * Constructor of the class
  *
  * return void
  */
 public function __construct()
 {
     try {
         $user = new \ProcessMaker\BusinessModel\User();
         $usrUid = $this->getUserId();
         if (!$user->checkPermission($usrUid, "PM_USERS")) {
             throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($usrUid)));
         }
         $this->role = new \ProcessMaker\BusinessModel\Role();
         $this->role->setFormatFieldNameInUppercase(false);
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }
예제 #9
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();
     }
 }
예제 #10
0
 /**
  * Change Sequence with native query
  *
  * @param type $seqName
  * @param type $seqValue
  * @return type
  *
  */
 public function changeSequence($seqName, $seqValue)
 {
     try {
         $con = Propel::getConnection('workflow');
         if ($this->nameExists($seqName)) {
             $sql = "UPDATE SEQUENCES SET SEQ_VALUE = {$seqValue} WHERE SEQ_NAME = '{$seqName}' ";
         } else {
             $sql = "INSERT INTO SEQUENCES (`SEQ_NAME`,`SEQ_VALUE`) VALUES ('{$seqName}', {$seqValue}) ";
         }
         $stmt = $con->createStatement();
         $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
         return $rs;
     } catch (Exception $e) {
         // throw ($e);
         throw new Exception(G::LoadTranslation('ID_ERROR_CHANGE_SEQUENCE_NUMBER'));
     }
 }
예제 #11
0
 public function saveConfigPmGmail($httpData)
 {
     G::LoadClass("pmGoogleApi");
     $pmGoogle = new PMGoogleApi();
     $result = new StdClass();
     $result->success = true;
     if (!empty($httpData->status_pmgmail)) {
         $httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
         $pmGoogle->setStatusService($httpData->status_pmgmail);
         $message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
         $pmGoogle->setTypeAuthentication($httpData->typeAuth);
         if (!empty($httpData->email_service_account)) {
             $pmGoogle->setServiceAccountEmail($httpData->email_service_account);
             $message .= ', ' . G::LoadTranslation('ID_PMG_EMAIL') . ': ' . $httpData->email_service_account;
         }
         if (!empty($_FILES)) {
             if (!empty($_FILES['file_p12']) && $_FILES['file_p12']['error'] != 1) {
                 if ($_FILES['file_p12']['tmp_name'] != '') {
                     G::uploadFile($_FILES['file_p12']['tmp_name'], PATH_DATA_SITE, $_FILES['file_p12']['name']);
                     $pmGoogle->setServiceAccountP12($_FILES['file_p12']['name']);
                     $message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_p12']['name'];
                 }
             } else {
                 if (!empty($_FILES['file_json']) && $_FILES['file_json']['error'] != 1) {
                     if ($_FILES['file_json']['tmp_name'] != '') {
                         G::uploadFile($_FILES['file_json']['tmp_name'], PATH_DATA_SITE, $_FILES['file_json']['name']);
                         $pmGoogle->setAccountJson($_FILES['file_json']['name']);
                         $message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_json']['name'];
                     }
                 } else {
                     $result->success = false;
                     $result->fileError = true;
                     print G::json_encode($result);
                     die;
                 }
             }
         }
     } else {
         $pmGoogle->setStatusService(false);
         $message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE');
     }
     G::auditLog("Update Settings Gmail", $message);
     print G::json_encode($result);
 }
예제 #12
0
function getProcessArray($userUid)
{
    global $oAppCache;
    require_once "classes/model/AppCacheView.php";
    $processes = array();
    $processes[] = array('', G::LoadTranslation('ID_ALL_PROCESS'));
    $cProcess = new Criteria('workflow');
    $cProcess->clearSelectColumns();
    $cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID);
    $cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
    $cProcess->setDistinct(AppCacheViewPeer::PRO_UID);
    $cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE);
    $oDataset = AppCacheViewPeer::doSelectRS($cProcess);
    $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
    $oDataset->next();
    while ($aRow = $oDataset->getRow()) {
        $processes[] = array($aRow['PRO_UID'], $aRow['APP_PRO_TITLE']);
        $oDataset->next();
    }
    return $processes;
}
예제 #13
0
 function getCalendarList($onlyActive = false, $arrayMode = false)
 {
     $Criteria = new Criteria('workflow');
     $Criteria->clearSelectColumns();
     $Criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_UID);
     $Criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_NAME);
     $Criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_CREATE_DATE);
     $Criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_UPDATE_DATE);
     $Criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_DESCRIPTION);
     $Criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_STATUS);
     // $Criteria->addAsColumn('DELETABLE', "IF (CALENDAR_UID <> '00000000000000000000000000000001', '".G::LoadTranslation('ID_DELETE')."','') ");
     $Criteria->addAsColumn('DELETABLE', "CASE WHEN CALENDAR_UID <> '00000000000000000000000000000001' THEN '" . G::LoadTranslation('ID_DELETE') . "' ELSE '' END ");
     // Note: This list doesn't show deleted items (STATUS = DELETED)
     if ($onlyActive) {
         // Show only active. Used on assignment lists
         $Criteria->add(calendarDefinitionPeer::CALENDAR_STATUS, "ACTIVE", CRITERIA::EQUAL);
     } else {
         // Show Active and Inactive calendars. USed in main list
         $Criteria->add(calendarDefinitionPeer::CALENDAR_STATUS, array("ACTIVE", "INACTIVE"), CRITERIA::IN);
     }
     $Criteria->add(calendarDefinitionPeer::CALENDAR_UID, "xx", CRITERIA::NOT_EQUAL);
     if (!$arrayMode) {
         return $Criteria;
     } else {
         $oDataset = calendarDefinitionPeer::doSelectRS($Criteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $calendarA = array(0 => 'dummy');
         $calendarCount = 0;
         while (is_array($aRow = $oDataset->getRow())) {
             $calendarCount++;
             $calendarA[$calendarCount] = $aRow;
             $oDataset->next();
         }
         $return['criteria'] = $Criteria;
         $return['array'] = $calendarA;
         return $return;
     }
 }
function reservedWordsSqlValidate($data)
{
    $arrayAux = array();
    $reservedWordsSql = G::reservedWordsSql();
    foreach ($data->reportTables as $rptIndex => $rptValue) {
        if (in_array(strtoupper($rptValue["REP_TAB_NAME"]), $reservedWordsSql)) {
            $arrayAux[] = $rptValue["REP_TAB_NAME"];
        }
    }
    if (count($arrayAux) > 0) {
        throw new Exception(G::LoadTranslation("ID_PMTABLE_INVALID_NAME", array(implode(", ", $arrayAux))));
    }
    $arrayAux = array();
    foreach ($data->reportTablesVars as $rptIndex => $rptValue) {
        if (in_array(strtoupper($rptValue["REP_VAR_NAME"]), $reservedWordsSql)) {
            $arrayAux[] = $rptValue["REP_VAR_NAME"];
        }
    }
    if (count($arrayAux) > 0) {
        throw new Exception(G::LoadTranslation("ID_PMTABLE_INVALID_FIELD_NAME", array(implode(", ", $arrayAux))));
    }
}
예제 #15
0
 /**
  * Update register device with userUid
  *
  * @param array $request_data
  * @param string $dev_uid
  * @param string $use_uid
  * @author Ronald Quenta <*****@*****.**>
  *
  */
 public function updateDevice($dev_uid, $use_uid, $request_data)
 {
     $arrayData = array();
     $arrayData['USR_UID'] = $use_uid;
     $arrayData['DEV_UID'] = $dev_uid;
     if (isset($request_data['deviceIdToken'])) {
         $arrayData['DEV_REG_ID'] = $request_data['deviceIdToken'];
     }
     if (isset($request_data['sysLanguage'])) {
         $arrayData['SYS_LANG'] = $request_data['sysLanguage'];
     }
     if (isset($request_data['deviceType'])) {
         $arrayData['DEV_TYPE'] = $request_data['deviceType'];
     }
     $oNoti = new \NotificationDevice();
     $response = array();
     if ($oNoti->update($arrayData)) {
         $response["message"] = G::LoadTranslation("ID_RECORD_SAVED_SUCCESFULLY");
         G::auditLog("Update", "Device Save: Device ID (" . $oNoti->getDevUid() . ") ");
     }
     return $response;
 }
예제 #16
0
                 * Description: this was added for the additional database connections */
                G::LoadClass('dbConnections');
                $oDbConnections = new dbConnections($_SESSION['PROCESS']);
                $oDbConnections->loadAdditionalConnections();
                $stepFilename = "{$sNamespace}/{$sStepName}";
                G::evalJScript("\n        if (parent.setCurrent) {\n          parent.setCurrent('" . $_GET['UID'] . "');\n        }");
                $G_PUBLISH->AddContent('content', $stepFilename);
            } else {
                $aMessage['MESSAGE'] = G::loadTranslation('ID_EXTERNAL_STEP_MISSING', SYS_LANG, array("plugin" => $sNamespace));
                $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
            }
            break;
    }
    //Add content content step - End
} catch (Exception $e) {
    G::SendTemporalMessage(G::LoadTranslation('ID_PROCESS_DEF_PROBLEM'), 'error', 'string', 3, 100);
    $aMessage = array();
    $aMessage['MESSAGE'] = $e->getMessage();
    $G_PUBLISH = new Publisher();
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
    G::RenderPage('publish', 'blank');
    die;
}
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile("/jscore/cases/core/cases_Step.js");
$oHeadPublisher->addScriptCode("\n  if (typeof parent != 'undefined') {\n    if (parent.showCaseNavigatorPanel) {\n      parent.showCaseNavigatorPanel('{$sStatus}');\n    }\n\n    if (parent.setCurrent) {\n      parent.setCurrent('" . $_GET['UID'] . "');\n    }\n  }");
G::RenderPage('publish', 'blank');
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
    G::evalJScript('
    if (typeof showdebug != \'undefined\') {
      showdebug();
예제 #17
0
try {
    //Loading data for a Jump request
    if (! isset( $_GET['APP_UID'] ) && isset( $_GET['APP_NUMBER'] )) {
        $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber( $_GET['APP_NUMBER'] );
        $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] );

        //if the application doesn't exist
        if (is_null( $_GET['APP_UID'] )) {
            G::SendMessageText( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ), 'info' );
            G::header( 'location: casesListExtJs' );
            exit();
        }

        //if the application exists but the
        if (is_null( $_GET['DEL_INDEX'] )) {
            G::SendMessageText( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ), 'info' );
            G::header( 'location: casesListExtJs' );
            exit();
        }
        //wrong implemented, need refactored
        //$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ???????
    }

    $sAppUid = $_GET['APP_UID'];
    $iDelIndex = $_GET['DEL_INDEX'];
    $_action = isset( $_GET['action'] ) ? $_GET['action'] : '';

    //loading application data
    $aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
    //  g::pr($aFields);
    //  die;
예제 #18
0
파일: Lists.php 프로젝트: rrsc/processmaker
    /**

     * Get list for Cases

     *

     * @access public

     * @param array $dataList, Data for list

     * @return array

     *

     * @author Brayan Pereyra (Cochalo) <*****@*****.**>

     * @copyright Colosa - Bolivia

    */

    public function getList($listName = 'inbox', $dataList = array(), $total = false)

    {

        Validator::isArray($dataList, '$dataList');

        if (!isset($dataList["userId"])) {

            throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('userId',''))));

        } else {

            Validator::usrUid($dataList["userId"], "userId");

        }



        $userUid = $dataList["userId"];

        $filters["paged"]    = isset( $dataList["paged"] ) ? $dataList["paged"] : true;

        $filters['count']    = isset( $dataList['count'] ) ? $dataList['count'] : true;

        $filters["category"] = isset( $dataList["category"] ) ? $dataList["category"] : "";

        $filters["process"]  = isset( $dataList["process"] ) ? $dataList["process"] : "";

        $filters["search"]   = isset( $dataList["search"] ) ? $dataList["search"] : "";

        $filters["filter"]   = isset( $dataList["filter"] ) ? $dataList["filter"] : "";

        $filters["dateFrom"] = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : "";

        $filters["dateTo"]   = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";



        $filters["start"]    = isset( $dataList["start"] ) ? $dataList["start"] : "0";

        $filters["limit"]    = isset( $dataList["limit"] ) ? $dataList["limit"] : "25";

        $filters["sort"]     = isset( $dataList["sort"] ) ? $dataList["sort"] : "";

        $filters["dir"]      = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";



        $filters["action"]   = isset( $dataList["action"] ) ? $dataList["action"] : "";



        // Select list

        switch ($listName) {

            case 'inbox':

                $list = new \ListInbox();

                $listpeer = 'ListInboxPeer';

                break;

            case 'participated_history':

                $list = new \ListParticipatedHistory();

                $listpeer = 'ListParticipatedHistoryPeer';

                break;

            case 'participated_last':

                $list = new \ListParticipatedLast();

                $listpeer = 'ListParticipatedLastPeer';

                break;

            case 'completed':

                $list = new \ListCompleted();

                $listpeer = 'ListCompletedPeer';

                break;

            case 'paused':

                $list = new \ListPaused();

                $listpeer = 'ListPausedPeer';

                break;

            case 'canceled':

                $list = new \ListCanceled();

                $listpeer = 'ListCanceledPeer';

                break;

            case 'my_inbox':

                $list = new \ListMyInbox();

                $listpeer = 'ListMyInboxPeer';

                break;

            case 'unassigned':

                $list = new \ListUnassigned();

                $listpeer = 'ListUnassignedPeer';

                break;

        }





        // Validate filters

        $filters["start"] = (int)$filters["start"];

        $filters["start"] = abs($filters["start"]);

        if ($filters["start"] != 0) {

            $filters["start"]+1;

        }



        $filters["limit"] = (int)$filters["limit"];

        $filters["limit"] = abs($filters["limit"]);

        if ($filters["limit"] == 0) {

            G::LoadClass("configuration");

            $conf = new \Configurations();

            $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');

            if (isset($generalConfCasesList['casesListRowNumber'])) {

                $filters["limit"] = (int)$generalConfCasesList['casesListRowNumber'];

            } else {

                $filters["limit"] = 25;

            }

        } else {

            $filters["limit"] = (int)$filters["limit"];

        }



        $filters["sort"] = G::toUpper($filters["sort"]);

        $columnsList = $listpeer::getFieldNames(\BasePeer::TYPE_FIELDNAME);

        if (!(in_array($filters["sort"], $columnsList))) {

            $filters["sort"] = '';

        }



        $filters["dir"] = G::toUpper($filters["dir"]);

        if (!($filters["dir"] == 'DESC' || $filters["dir"] == 'ASC')) {

            $filters["dir"] = 'DESC';

        }

        if ($filters["process"] != '') {

            Validator::proUid($filters["process"], '$pro_uid');

        }

        if ($filters["category"] != '') {

            Validator::catUid($filters["category"], '$cat_uid');

        }

        if ($filters["dateFrom"] != '') {

            Validator::isDate($filters["dateFrom"], 'Y-m-d', '$date_from');

        }

        if ($filters["dateTo"] != '') {

            Validator::isDate($filters["dateTo"], 'Y-m-d', '$date_to');

        }



        if ($total) {

            $total = $list->countTotal($userUid, $filters);

            return $total;

        }



        $result = $list->loadList($userUid, $filters);

        if (!empty($result)) {

            foreach ($result as &$value) {

                if (isset($value['DEL_PREVIOUS_USR_UID'])) {

                    $value['PREVIOUS_USR_UID']       = $value['DEL_PREVIOUS_USR_UID'];

                    $value['PREVIOUS_USR_USERNAME']  = $value['DEL_PREVIOUS_USR_USERNAME'];

                    $value['PREVIOUS_USR_FIRSTNAME'] = $value['DEL_PREVIOUS_USR_FIRSTNAME'];

                    $value['PREVIOUS_USR_LASTNAME']  = $value['DEL_PREVIOUS_USR_LASTNAME'];

                }

                if (isset($value['DEL_DUE_DATE'])) {

                    $value['DEL_TASK_DUE_DATE'] = $value['DEL_DUE_DATE'];

                }

                if (isset($value['APP_PAUSED_DATE'])) {

                    $value['APP_UPDATE_DATE']   = $value['APP_PAUSED_DATE'];

                }

                if (isset($value['DEL_CURRENT_USR_USERNAME'])) {

                    $value['USR_USERNAME']      = $value['DEL_CURRENT_USR_USERNAME'];

                    $value['USR_FIRSTNAME']     = $value['DEL_CURRENT_USR_FIRSTNAME'];

                    $value['USR_LASTNAME']      = $value['DEL_CURRENT_USR_LASTNAME'];

                    $value['APP_UPDATE_DATE']   = $value['DEL_DELEGATE_DATE'];

                }

                if (isset($value['APP_STATUS'])) {

                    $value['APP_STATUS_LABEL']  = G::LoadTranslation( "ID_{$value['APP_STATUS']}" );

                }





                //$value = array_change_key_case($value, CASE_LOWER);

            }

        }

        $response = array();

        if ($filters["paged"]) {

            $filtersData = array();

            $filtersData['start']       = $filters["start"];

            $filtersData['limit']       = $filters["limit"];

            $filtersData['sort']        = G::toLower($filters["sort"]);

            $filtersData['dir']         = G::toLower($filters["dir"]);

            $filtersData['cat_uid']     = $filters["category"];

            $filtersData['pro_uid']     = $filters["process"];

            $filtersData['search']      = $filters["search"];

            $filtersData['date_from']   = $filters["dateFrom"];

            $filtersData['date_to']     = $filters["dateTo"];

            $response['filters']        = $filtersData;

            $response['data']           = $result;

            $filtersData['action']      = $filters["action"];

            $response['totalCount']     = $list->countTotal($userUid, $filtersData);

        } else {

            $response = $result;

        }

        return $response;

    }
예제 #19
0
     }
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     if (is_array($aRow) || $_POST['NEW_USERNAME'] == '') {
         $color = 'red';
         $img = '/images/delete.png';
         $dataVar['USER_ID'] = $_POST['NEW_USERNAME'];
         $text = G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', $dataVar);
         $text = $_POST['NEW_USERNAME'] == '' ? G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME') : $text;
         $response['exists'] = true;
     } else {
         $color = 'green';
         $img = '/images/dialog-ok-apply.png';
         $text = G::LoadTranslation('ID_USERNAME_CORRECT');
         $response['exists'] = false;
     }
     $span = '<span style="color: ' . $color . '; font: 9px tahoma,arial,helvetica,sans-serif;">';
     $gif = '<img width="13" height="13" border="0" src="' . $img . '">';
     $response['descriptionText'] = $span . $gif . $text . '</span>';
     echo G::json_encode($response);
     break;
 case "passwordValidate":
     $messageResultLogin = "";
     $password = $_POST["password"];
     $resultLogin = $RBAC->VerifyLogin($_SESSION["USR_USERNAME"], $password);
     if ($resultLogin == $_SESSION["USER_LOGGED"]) {
         $messageResultLogin = "******";
     } else {
         $messageResultLogin = "******";
예제 #20
0
     $aOD = $oOutputDocument->load($aFields['DOC_UID']);
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(AppDelegationPeer::APP_UID, $aFields['APP_UID']);
     $oCriteria->add(AppDelegationPeer::DEL_INDEX, $aFields['DEL_INDEX']);
     $oDataset = AppDelegationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     $oTask = new Task();
     $aTask = $oTask->load($aRow['TAS_UID']);
     $aFields['ORIGIN'] = $aTask['TAS_TITLE'];
     require_once 'classes/model/Users.php';
     $oUser = new Users();
     $aUser = $oUser->load($aFields['USR_UID']);
     $aFields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
     $aFields['VIEW'] = G::LoadTranslation('ID_OPEN');
     $aFields['FILE1'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand();
     $aFields['FILE2'] = 'cases_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand();
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_ViewAnyOutputDocument', '', G::array_merges($aOD, $aFields), '');
     G::RenderPage('publish', 'raw');
     break;
 case 'showDynaformList':
     $oCase = new Cases();
     global $G_PUBLISH;
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_AllDynaformsList', $oCase->getallDynaformsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']));
     G::RenderPage('publish', 'raw');
     break;
 case 'showDynaform':
     $G_PUBLISH = new Publisher();
예제 #21
0
    public function loadList($usr_uid, $filters = array(), $callbackRecord = null)
    {
        $criteria = new Criteria();

        $criteria->addSelectColumn(ListInboxPeer::APP_UID);
        $criteria->addSelectColumn(ListInboxPeer::DEL_INDEX);
        $criteria->addSelectColumn(ListInboxPeer::USR_UID);
        $criteria->addSelectColumn(ListInboxPeer::TAS_UID);
        $criteria->addSelectColumn(ListInboxPeer::PRO_UID);
        $criteria->addSelectColumn(ListInboxPeer::APP_NUMBER);
        $criteria->addSelectColumn(ListInboxPeer::APP_STATUS);
        $criteria->addSelectColumn(ListInboxPeer::APP_TITLE);
        $criteria->addSelectColumn(ListInboxPeer::APP_PRO_TITLE);
        $criteria->addSelectColumn(ListInboxPeer::APP_TAS_TITLE);
        $criteria->addSelectColumn(ListInboxPeer::APP_UPDATE_DATE);
        $criteria->addSelectColumn(ListInboxPeer::DEL_PREVIOUS_USR_UID);
        $criteria->addSelectColumn(ListInboxPeer::DEL_PREVIOUS_USR_USERNAME);
        $criteria->addSelectColumn(ListInboxPeer::DEL_PREVIOUS_USR_FIRSTNAME);
        $criteria->addSelectColumn(ListInboxPeer::DEL_PREVIOUS_USR_LASTNAME);
        $criteria->addSelectColumn(ListInboxPeer::DEL_DELEGATE_DATE);
        $criteria->addSelectColumn(ListInboxPeer::DEL_INIT_DATE);
        $criteria->addSelectColumn(ListInboxPeer::DEL_DUE_DATE);
        $criteria->addSelectColumn(ListInboxPeer::DEL_PRIORITY);
        $criteria->add( ListInboxPeer::USR_UID, $usr_uid, Criteria::EQUAL );
        self::loadFilters($criteria, $filters);

        $sort  = (!empty($filters['sort'])) ? $filters['sort'] : "LIST_INBOX.APP_UPDATE_DATE";
        $dir   = isset($filters['dir']) ? $filters['dir'] : "ASC";
        $start = isset($filters['start']) ? $filters['start'] : "0";
        $limit = isset($filters['limit']) ? $filters['limit'] : "25";
        $paged = isset($filters['paged']) ? $filters['paged'] : 1;

        if ($filters['action'] == 'draft') {
            $criteria->add( ListInboxPeer::APP_STATUS, 'DRAFT', Criteria::EQUAL );
        } else {
            $criteria->add( ListInboxPeer::APP_STATUS, 'TO_DO', Criteria::EQUAL );
        }

        if ($dir == "DESC") {
            $criteria->addDescendingOrderByColumn($sort);
        } else {
            $criteria->addAscendingOrderByColumn($sort);
        }

        if ($paged == 1) {
            $criteria->setLimit( $limit );
            $criteria->setOffset( $start );
        }

        $dataset = ListInboxPeer::doSelectRS($criteria, Propel::getDbConnection('workflow_ro') );
        $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $data = array();
        $aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
        while ($dataset->next()) {
            $aRow = (is_null($callbackRecord))? $dataset->getRow() : $callbackRecord($dataset->getRow());

            $aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
            $data[] = $aRow;
        }
        return $data;
    }
예제 #22
0
function getProcessList()
{
    G::LoadClass('case');
    G::LoadClass('process');
    G::LoadClass('calendar');
    $calendar = new Calendar();
    $oProcess = new Process();
    $oCase = new Cases();
    //Get ProcessStatistics Info
    $start = 0;
    $limit = '';
    $proData = $oProcess->getAllProcesses($start, $limit, null, null, false, true);
    $bCanStart = $oCase->canStartCase($_SESSION['USER_LOGGED']);
    if ($bCanStart) {
        $processListInitial = $oCase->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category');
        $processList = array();
        foreach ($processListInitial as $key => $procInfo) {
            if (isset($procInfo['pro_uid'])) {
                if (trim($procInfo['cat']) == "") {
                    $procInfo['cat'] = "_OTHER_";
                }
                $processList[$procInfo['catname']][$procInfo['value']] = $procInfo;
            }
        }
        ksort($processList);
        foreach ($processList as $key => $processInfo) {
            ksort($processList[$key]);
        }
        if (!isset($_REQUEST['node'])) {
            $node = 'root';
        } else {
            $node = $_REQUEST['node'];
        }
        foreach ($proData as $key => $proInfo) {
            $proData[$proInfo['PRO_UID']] = $proInfo;
        }
        $processListTree = array();
        if (1) {
            foreach ($processList as $key => $processInfo) {
                $tempTree['text'] = $key;
                $tempTree['id'] = G::encryptOld($key);
                $tempTree['cls'] = 'folder';
                $tempTree['draggable'] = true;
                $tempTree['optionType'] = "category";
                //$tempTree['allowDrop']=false;
                $tempTree['singleClickExpand'] = true;
                if ($key != "No Category") {
                    $tempTree['expanded'] = true;
                } else {
                    //$tempTree ['expanded'] = false;
                    $tempTree['expanded'] = true;
                }
                $tempTreeChildren = array();
                foreach ($processList[$key] as $keyChild => $processInfoChild) {
                    //print_r($processInfo);
                    $tempTreeChild['text'] = htmlentities($keyChild, ENT_QUOTES, 'UTF-8');
                    //ellipsis ( $keyChild, 50 );
                    //$tempTree['text']=$key;
                    $tempTreeChild['id'] = G::encryptOld($keyChild);
                    $tempTreeChild['draggable'] = true;
                    $tempTreeChild['leaf'] = true;
                    $tempTreeChild['icon'] = '/images/icon.trigger.png';
                    $tempTreeChild['allowChildren'] = false;
                    $tempTreeChild['optionType'] = "startProcess";
                    $tempTreeChild['pro_uid'] = $processInfoChild['pro_uid'];
                    $tempTreeChild['tas_uid'] = $processInfoChild['uid'];
                    $processInfoChild['myInbox'] = 0;
                    $processInfoChild['totalInbox'] = 0;
                    if (isset($proData[$processInfoChild['pro_uid']])) {
                        $tempTreeChild['otherAttributes'] = array_merge($processInfoChild, $proData[$processInfoChild['pro_uid']], $calendar->getCalendarFor($_SESSION['USER_LOGGED'], $processInfoChild['pro_uid'], $processInfoChild['uid']));
                        $tempTreeChild['otherAttributes']['PRO_TAS_TITLE'] = str_replace(")", "", str_replace("(", "", trim(str_replace($tempTreeChild['otherAttributes']['PRO_TITLE'], "", $tempTreeChild['otherAttributes']["value"]))));
                        $tempTreeChild['qtip'] = $tempTreeChild['otherAttributes']['PRO_DESCRIPTION'];
                        //$tempTree['cls']='file';
                        $tempTreeChildren[] = $tempTreeChild;
                    }
                }
                $tempTree['children'] = $tempTreeChildren;
                $processListTree[] = $tempTree;
            }
        } else {
            foreach ($processList[$node] as $key => $processInfo) {
                //print_r($processInfo);
                $tempTree['text'] = $key;
                //ellipsis ( $key, 50 );
                //$tempTree['text']=$key;
                $tempTree['id'] = $key;
                $tempTree['draggable'] = true;
                $tempTree['leaf'] = true;
                $tempTree['icon'] = '/images/icon.trigger.png';
                $tempTree['allowChildren'] = false;
                $tempTree['optionType'] = "startProcess";
                $tempTree['pro_uid'] = $processInfo['pro_uid'];
                $tempTree['tas_uid'] = $processInfo['uid'];
                $processInfo['myInbox'] = 0;
                $processInfo['totalInbox'] = 0;
                $tempTree['otherAttributes'] = array_merge($processInfo, $proData[$processInfo['pro_uid']], $calendar->getCalendarFor($processInfo['uid'], $processInfo['uid'], $processInfo['uid']));
                $tempTree['otherAttributes']['PRO_TAS_TITLE'] = str_replace(")", "", str_replace("(", "", trim(str_replace($tempTree['otherAttributes']['PRO_TITLE'], "", $tempTree['otherAttributes']["value"]))));
                $tempTree['qtip'] = $tempTree['otherAttributes']['PRO_DESCRIPTION'];
                //$tempTree['cls']='file';
                $processListTree[] = $tempTree;
            }
        }
        $processList = $processListTree;
    } else {
        $processList['success'] = 'failure';
        $processList['message'] = G::LoadTranslation('ID_USER_PROCESS_NOT_START');
    }
    print G::json_encode($processList);
    die;
}
예제 #23
0
 function getProcessArray($action, $userUid)
 {
     global $oAppCache;
     $processes = array();
     $processes[] = array("", G::LoadTranslation("ID_ALL_PROCESS"));
     switch ($action) {
         case "simple_search":
         case "search":
             //In search action, the query to obtain all process is too slow, so we need to query directly to
             //process and content tables, and for that reason we need the current language in AppCacheView.
             G::loadClass("configuration");
             $oConf = new Configurations();
             $oConf->loadConfig($x, "APP_CACHE_VIEW_ENGINE", "", "", "", "");
             $appCacheViewEngine = $oConf->aConfig;
             $lang = isset($appCacheViewEngine["LANG"]) ? $appCacheViewEngine["LANG"] : "en";
             $cProcess = new Criteria("workflow");
             $cProcess->clearSelectColumns();
             $cProcess->addSelectColumn(ProcessPeer::PRO_UID);
             $cProcess->addSelectColumn(ContentPeer::CON_VALUE);
             $del = DBAdapter::getStringDelimiter();
             $conds = array();
             $conds[] = array(ProcessPeer::PRO_UID, ContentPeer::CON_ID);
             $conds[] = array(ContentPeer::CON_CATEGORY, $del . "PRO_TITLE" . $del);
             $conds[] = array(ContentPeer::CON_LANG, $del . $lang . $del);
             $cProcess->addJoinMC($conds, Criteria::LEFT_JOIN);
             $cProcess->add(ProcessPeer::PRO_STATUS, "ACTIVE");
             $oDataset = ProcessPeer::doSelectRS($cProcess);
             $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataset->next();
             while ($aRow = $oDataset->getRow()) {
                 $processes[] = array($aRow["PRO_UID"], $aRow["CON_VALUE"]);
                 $oDataset->next();
             }
             return $processes;
             break;
         case "consolidated":
         default:
             $cProcess = $oAppCache->getToDoListCriteria($userUid);
             //fast enough
             break;
     }
     $cProcess->clearSelectColumns();
     $cProcess->setDistinct();
     $cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID);
     $cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
     $oDataset = AppCacheViewPeer::doSelectRS($cProcess);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $processes[] = array($aRow["PRO_UID"], $aRow["APP_PRO_TITLE"]);
         $oDataset->next();
     }
     return $processes;
 }
예제 #24
0
 public function getValidateSelfService($data)
 {
     $paused = false;
     $data = array_change_key_case($data, CASE_LOWER);
     $sTaskUID = $data['act_uid'];
     $caseType = isset($data['case_type']) ? $data['case_type'] == 'assigned' ? $data['case_type'] : 'unassigned' : 'unassigned';
     $response = new \stdclass();
     $oCriteria = new \Criteria();
     $arrayCondition = array();
     $arrayCondition[] = array(\AppDelegationPeer::APP_UID, \AppDelayPeer::APP_UID);
     $arrayCondition[] = array(\AppDelegationPeer::DEL_INDEX, \AppDelayPeer::APP_DEL_INDEX);
     $oCriteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
     $oCriteria->add(\AppDelegationPeer::TAS_UID, $sTaskUID);
     $oCriteria->add(\AppDelayPeer::APP_DISABLE_ACTION_USER, "0");
     $oResult = \AppDelegationPeer::doSelectOne($oCriteria);
     if (!empty($oResult)) {
         $paused = true;
     }
     $response->paused = $paused;
     $oCriteria = new \Criteria();
     $oCriteria->add(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
     $oCriteria->add(\AppDelegationPeer::TAS_UID, $sTaskUID);
     if ($caseType == 'unassigned') {
         $oCriteria->add(\AppDelegationPeer::USR_UID, "", \Criteria::EQUAL);
     }
     $oApplication = \AppDelegationPeer::doSelectOne($oCriteria);
     $response->result = true;
     if (!empty($oApplication) || $paused) {
         $response->result = false;
         $response->message = G::LoadTranslation('ID_CURRENT_ASSING_TYPE_WITH_CASES');
     }
     return $response;
 }
예제 #25
0
 private function _default()
 {
     require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
     // put full path to Smarty.class.php
     global $G_ENABLE_BLANK_SKIN;
     //menu
     global $G_PUBLISH;
     global $G_MAIN_MENU;
     global $G_SUB_MENU;
     global $G_MENU_SELECTED;
     global $G_SUB_MENU_SELECTED;
     global $G_ID_MENU_SELECTED;
     global $G_ID_SUB_MENU_SELECTED;
     G::verifyPath(PATH_SMARTY_C, true);
     G::verifyPath(PATH_SMARTY_CACHE, true);
     $smarty = new Smarty();
     $oHeadPublisher =& headPublisher::getSingleton();
     $smarty->compile_dir = PATH_SMARTY_C;
     $smarty->cache_dir = PATH_SMARTY_CACHE;
     $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
     //To setup en extJS Theme for this Skin
     G::LoadClass('serverConfiguration');
     $oServerConf =& serverConf::getSingleton();
     $extSkin = $oServerConf->getProperty("extSkin");
     if (!$extSkin) {
         $extSkin = array();
     }
     $extSkin[SYS_SKIN] = "xtheme-gray";
     $oServerConf->setProperty("extSkin", $extSkin);
     //End of extJS Theme setup
     if (isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN) {
         $smarty->template_dir = $this->layoutFileBlank['dirname'];
         $smarty->force_compile = $this->forceTemplateCompile;
         $smarty->display($layoutFileBlank['basename']);
     } else {
         $smarty->template_dir = $this->layoutFile['dirname'];
         $meta = null;
         $header = null;
         if (preg_match("/^.*\\(.*MSIE (\\d+)\\..+\\).*\$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) {
             $ie = intval($arrayMatch[1]);
             if ($ie == 10) {
                 $ie = 8;
                 $meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE={$ie}\" />";
             }
         }
         if (isset($oHeadPublisher)) {
             if (defined('SYS_SYS')) {
                 $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : '';
             }
             $header = $oHeadPublisher->printHeader();
             $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName);
         }
         $smarty->assign("meta", $meta);
         $smarty->assign("header", $header);
         $footer = '';
         if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) {
             $freeOfChargeText = "";
             if (!defined('SKIP_FREE_OF_CHARGE_TEXT')) {
                 $freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Colosa and its Certified Partners.";
             }
             if (class_exists('pmLicenseManager')) {
                 $freeOfChargeText = "";
             }
             $fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
             if (file_exists($fileFooter)) {
                 $footer .= file_get_contents($fileFooter);
             } else {
                 $fileFooter = PATH_SKIN_ENGINE . SYS_SKIN . PATH_SEP . 'footer.html';
                 if (file_exists($fileFooter)) {
                     $footer .= file_get_contents($fileFooter);
                 } else {
                     $fileFooter = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
                     if (file_exists($fileFooter)) {
                         $footer .= file_get_contents($fileFooter);
                     } else {
                         $footer .= "<br />Copyright &copy; 2003-" . date('Y') . " <a href=\"http://www.colosa.com\" alt=\"Colosa, Inc.\" target=\"_blank\">Colosa, Inc.</a> All rights reserved.<br /> {$freeOfChargeText} " . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
                     }
                 }
             }
         }
         $oMenu = new Menu();
         $menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED);
         $smarty->assign('menus', $menus);
         $oSubMenu = new Menu();
         $subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu', $G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
         $smarty->assign('subMenus', $subMenus);
         if (!defined('NO_DISPLAY_USERNAME')) {
             define('NO_DISPLAY_USERNAME', 0);
         }
         if (NO_DISPLAY_USERNAME == 0) {
             $switch_interface = isset($_SESSION['user_experience']) && $_SESSION['user_experience'] == 'SWITCHABLE';
             $smarty->assign('user_logged', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
             $smarty->assign('tracker', SYS_COLLECTION == 'tracker' ? $G_PUBLISH->Parts[0]['File'] != 'tracker/login' ? true : '' : '');
             $smarty->assign('switch_interface', $switch_interface);
             $smarty->assign('switch_interface_label', G::LoadTranslation('ID_SWITCH_INTERFACE'));
             $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : '');
             $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : '');
             $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT'));
             $smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : '');
             $uws = isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '' ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING');
             $smarty->assign('workspace_label', $uws);
             G::LoadClass("configuration");
             $conf = new Configurations();
             $conf->getFormats();
             if (defined('SYS_SYS')) {
                 $smarty->assign('udate', $conf->getSystemDate(date('Y-m-d H:i:s')));
             } else {
                 $smarty->assign('udate', G::getformatedDate(date('Y-m-d H:i:s'), 'M d, yyyy', SYS_LANG));
             }
             $name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'], ENT_QUOTES, 'UTF-8') : '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
             $smarty->assign('user', $name);
         }
         if (class_exists('pmLicenseManager')) {
             $pmLicenseManagerO =& pmLicenseManager::getSingleton();
             $expireIn = $pmLicenseManagerO->getExpireIn();
             $expireInLabel = $pmLicenseManagerO->getExpireInLabel();
             //if($expireIn<=30){
             if ($expireInLabel != "") {
                 $smarty->assign('msgVer', '<label class="textBlack">' . $expireInLabel . '</label>&nbsp;&nbsp;');
             }
             //}
         }
         if (defined('SYS_SYS')) {
             $logout = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
         } else {
             $logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
         }
         $smarty->assign('linklogout', $logout);
         $smarty->assign('footer', $footer);
         $smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html');
         $smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html');
         G::LoadClass('replacementLogo');
         $oLogoR = new replacementLogo();
         if (defined("SYS_SYS")) {
             $aFotoSelect = $oLogoR->getNameLogo(isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
             if (is_array($aFotoSelect)) {
                 $sFotoSelect = trim($aFotoSelect['DEFAULT_LOGO_NAME']);
                 $sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']);
             }
         }
         if (class_exists('PMPluginRegistry')) {
             $oPluginRegistry =& PMPluginRegistry::getSingleton();
             if (isset($sFotoSelect) && $sFotoSelect != '' && !strcmp($sWspaceSelect, SYS_SYS)) {
                 $sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect);
                 $sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo);
             } else {
                 $sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
             }
         } else {
             $sCompanyLogo = '/images/processmaker.logo.jpg';
         }
         $smarty->assign('logo_company', $sCompanyLogo);
         $smarty->force_compile = $this->forceTemplateCompile;
         $smarty->display($this->layoutFile['basename']);
     }
 }
예제 #26
0
 /**
  * Verify the InputDoc extension, cheking the file name extension (.pdf, .ppt) and the file content.
  *
  *
  *
  */
 public function verifyInputDocExtension($InpDocAllowedFiles, $fileName, $filesTmpName)
 {
     // Initialize variables
     $res = new stdclass();
     $allowedTypes = array_map('G::getRealExtension', explode(',', $InpDocAllowedFiles));
     // If required extension is *.* don't validate
     if (in_array('*', $allowedTypes)) {
         $res->status = true;
         return $res;
     }
     // Get the file extension
     $aux = pathinfo($fileName);
     $fileExtension = isset($aux['extension']) ? strtolower($aux['extension']) : '';
     // If no valid extension finish (unnecesary check file content)
     $validExtension = in_array($fileExtension, $allowedTypes);
     if (!$validExtension) {
         $res->status = false;
         $res->message = G::LoadTranslation('ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION') . ' ' . $fileName;
         return $res;
     }
     // If not enabled fileinfo extension finish validation
     if (!extension_loaded('fileinfo')) {
         $res->status = true;
         return $res;
     }
     // If enabled fileinfo extension check the content
     $finfo = new finfo(FILEINFO_MIME_TYPE);
     $mimeType = $finfo->file($filesTmpName);
     $docType = explode('/', $mimeType);
     // If is a empty file finish validation
     if ($docType[1] == 'x-empty') {
         $res->status = true;
         return $res;
     }
     // Check file content
     foreach ($allowedTypes as $allowedType) {
         switch ($allowedType) {
             case 'xls':
                 if ($docType[1] == 'vnd.ms-excel' || $fileExtension == 'xls' && $docType[1] == 'plain') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'doc':
                 if ($docType[1] == 'msword' || $fileExtension == 'doc' && $docType[1] == 'html') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'ppt':
                 if ($docType[1] == 'vnd.ms-office') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'docx':
             case 'pptx':
             case 'xlsx':
                 if ($docType[1] == 'zip') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'exe':
             case 'wmv':
                 if ($docType[1] == 'octet-stream') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'jpg':
                 if ($docType[1] == 'jpeg') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'mp3':
                 if ($docType[1] == 'mpeg') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'rar':
                 if ($docType[1] == 'x-rar') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'txt':
             case 'pm':
                 if ($docType[1] == 'plain') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'htm':
             case 'html':
                 if ($docType[1] == 'html') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'po':
                 if ($docType[1] == 'x-po') {
                     $res->status = true;
                     return $res;
                 }
                 break;
             case 'pdf':
             case 'png':
             case 'jpeg':
             case 'gif':
             case 'zip':
             case 'mp4':
                 if ($docType[1] == $allowedType) {
                     $res->status = true;
                     return $res;
                 }
                 break;
             default:
                 if ($validExtension) {
                     $res->status = true;
                     return $res;
                 }
                 break;
         }
     }
     // If content don't match return error
     $res->status = false;
     $res->message = G::LoadTranslation('ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION') . ' ' . $fileName;
     return $res;
 }
예제 #27
0
$oMenu->load("setup");
$items = array();
$menuTypes = array_unique($oMenu->Types);
foreach ($menuTypes as $i => $v) {
    if ($v == "admToolsContent") {
        unset($menuTypes[$i]);
        break;
    }
}
//sort($menuTypes);
$tabItems = array();
$i = 0;
foreach ($menuTypes as $menuType) {
    $tabItems[$i] = new stdclass();
    $tabItems[$i]->id = $menuType;
    $LABEL_TRANSLATION = G::LoadTranslation("ID_" . strtoupper($menuType));
    if (substr($LABEL_TRANSLATION, 0, 2) !== "**") {
        $title = $LABEL_TRANSLATION;
    } else {
        $title = str_replace("_", " ", ucwords($menuType));
    }
    $tabItems[$i]->title = $title;
    $i++;
}
///////
$tabActive = "";
if ($adminSelected != null) {
    foreach ($oMenu->Options as $i => $option) {
        if ($oMenu->Id[$i] == $adminSelected) {
            $tabActive = in_array($oMenu->Types[$i], array("", "admToolsContent")) ? "plugins" : $oMenu->Types[$i];
            break;
예제 #28
0
    function getNextAssignedUser ($tasInfo)

    {

        //$oUser = new Users();

        $nextAssignedTask = $tasInfo['NEXT_TASK'];

        $lastAssigned = $tasInfo['NEXT_TASK']['TAS_LAST_ASSIGNED'];

        $sTasUid = $tasInfo['NEXT_TASK']['TAS_UID'];



        //// to do: we can increase the LOCATION by COUNTRY, STATE and LOCATION

        ///* Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */

        //$assignLocation = '';

        //if ($tasInfo['NEXT_TASK']['TAS_ASSIGN_LOCATION'] == 'TRUE') {

        //    $oUser->load( $tasInfo['USER_UID'] );

        //    krumo( $oUser->getUsrLocation() );

        //    //to do: assign for location

        //    //$assignLocation = " AND USR_LOCATION = " . $oUser->Fields['USR_LOCATION'];

        //}

        ///* End - Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */



        $uidUser = '';

        switch ($nextAssignedTask['TAS_ASSIGN_TYPE']) {

            case 'BALANCED':

                $users = $this->getAllUsersFromAnyTask( $sTasUid );

                if (is_array( $users ) && count( $users ) > 0) {

                    //to do apply any filter like LOCATION assignment

                    $uidUser = $users[0];

                    $i = count( $users ) - 1;

                    while ($i > 0) {

                        if ($lastAssigned < $users[$i]) {

                            $uidUser = $users[$i];

                        }

                        $i --;

                    }

                } else {

                    throw (new Exception( G::LoadTranslation( 'ID_NO_USERS' ) ));

                }

                $userFields = $this->getUsersFullNameFromArray( $uidUser );

                break;

            case 'STATIC_MI':

            case 'CANCEL_MI':

            case 'MANUAL':

                $users = $this->getAllUsersFromAnyTask( $sTasUid );

                $userFields = $this->getUsersFullNameFromArray( $users );

                break;

            case 'EVALUATE':

                $AppFields = $this->case->loadCase( $tasInfo['APP_UID'] );

                $variable = str_replace( '@@', '', $nextAssignedTask['TAS_ASSIGN_VARIABLE'] );

                if (isset( $AppFields['APP_DATA'][$variable] )) {

                    if ($AppFields['APP_DATA'][$variable] != '') {

                        $value = $this->checkReplacedByUser( $AppFields['APP_DATA'][$variable] );

                        $userFields = $this->getUsersFullNameFromArray( $value );

                        if (is_null( $userFields )) {

                            throw (new Exception( "Task doesn't have a valid user in variable $variable." ));

                        }

                    } else {

                        throw (new Exception( "Task doesn't have a valid user in variable $variable." ));

                    }

                } else {

                    throw (new Exception( "Task doesn't have a valid user in variable $variable or this variable doesn't exist." ));

                }

                break;

            case 'REPORT_TO':

                //default error user when the reportsTo is not assigned to that user

                //look for USR_REPORTS_TO to this user

                $userFields['USR_UID'] = '';

                $userFields['USR_FULLNAME'] = 'Current user does not have a valid Reports To user';

                $userFields['USR_USERNAME'] = '******';

                $userFields['USR_FIRSTNAME'] = '';

                $userFields['USR_LASTNAME'] = '';

                $userFields['USR_EMAIL'] = '';



                //get the report_to user & its full info

                $useruid = ($tasInfo["USER_UID"] != "")? $this->checkReplacedByUser($this->getDenpendentUser($tasInfo["USER_UID"])) : "";



                if (isset( $useruid ) && $useruid != '') {

                    $userFields = $this->getUsersFullNameFromArray( $useruid );

                }



                // if there is no report_to user info, throw an exception indicating this

                if (! isset( $userFields ) || $userFields['USR_UID'] == '') {

                    throw (new Exception( G::LoadTranslation( 'ID_MSJ_REPORSTO' ) )); // "The current user does not have a valid Reports To user.  Please contact administrator.") ) ;

                }

                break;

            case 'SELF_SERVICE':

                //look for USR_REPORTS_TO to this user

                $userFields['USR_UID'] = '';

                $userFields['USR_FULLNAME'] = '<b>' . G::LoadTranslation( 'ID_UNASSIGNED' ) . '</b>';

                $userFields['USR_USERNAME'] = '******' . G::LoadTranslation( 'ID_UNASSIGNED' ) . '</b>';

                $userFields['USR_FIRSTNAME'] = '';

                $userFields['USR_LASTNAME'] = '';

                $userFields['USR_EMAIL'] = '';

                break;

            default:

                throw (new Exception( 'Invalid Task Assignment method for Next Task ' ));

        }

        return $userFields;

    }
예제 #29
0
 /**
  * Delete case
  *
  * @copyright Colosa - Bolivia
  *
  * @url DELETE /case/:app_uid/delete
  *
  * @param string $app_uid {@min 32}{@max 32}
  */
 public function doDeleteCases($app_uid)
 {
     try {
         $oCase = new \Cases();
         $oCase->removeCase( $app_uid );
         $result = array (
             "message" => \G::LoadTranslation( "ID_COMMAND_EXECUTED_SUCCESSFULLY" )
         );
     } catch (\Exception $e) {
         throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
     }
     return $result;
 }
예제 #30
0
    case -1:
        G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
        G::header('location: ../login/login');
        die;
        break;
}
if (isset($_POST['form']['BTN_CANCEL'])) {
    header("Location: ../cases/main");
    die;
}
/* Includes */
G::LoadClass('case');
$oCase = new Cases();
$sAppUid = $_SESSION['APPLICATION'];
$iDelIndex = $_SESSION['INDEX'];
$oAppDelegation = new AppDelegation();
$aDelegation = $oAppDelegation->load($sAppUid, $iDelIndex);
//if there are no user in the delegation row, this case is still in selfservice
if ($aDelegation['USR_UID'] == "") {
    $oCase->setCatchUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED']);
} else {
    G::SendMessageText(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), 'error');
}
die('<script type="text/javascript">
      if (window.parent.frames.length != 0) {
        parent.location = "open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
      }
      else {
        window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
      }
      </script>');