<?php

global $RBAC;
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
    G::LoadClass('processes');
    $app = new Processes();
    if (!$app->processExists($_POST['form']['PRO_UID'])) {
        echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
        die;
    }
    switch ($_POST['form']['MAIN_DIRECTORY']) {
        case 'mailTemplates':
            $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
            break;
        case 'public':
            $sDirectory = PATH_DATA_PUBLIC . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
            break;
        default:
            die;
            break;
    }
    for ($i = 1; $i <= 5; $i++) {
        if ($_FILES['form']['tmp_name']['FILENAME' . (string) $i] != '') {
            G::uploadFile($_FILES['form']['tmp_name']['FILENAME' . (string) $i], $sDirectory, $_FILES['form']['name']['FILENAME' . (string) $i]);
        }
    }
}
die('<script type="text/javascript">parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');</script>');
Exemplo n.º 2
0
    }
    $result = array();
    if (isset($array->item)) {
        foreach ($array->item as $key => $value) {
            $result[$value->key] = $value->value;
        }
    } else {
        foreach ($array as $key => $value) {
            $result[$value->key] = $value->value;
        }
    }
    return $result;
}
try {
    G::LoadClass('processes');
    $oProcess = new Processes();
    $oProcess->ws_open_public();
    $result = $oProcess->ws_ProcessList();
    $processes[] = array('uid' => 'char', 'name' => 'char', 'age' => 'integer', 'balance' => 'float');
    if ($result->status_code == 0 && isset($result->processes)) {
        foreach ($result->processes as $key => $val) {
            $process = parseItemArray($val);
            $processes[] = $process;
        }
    }
    $_DBArray['processes'] = $processes;
    $_SESSION['_DBArray'] = $_DBArray;
    G::LoadClass('ArrayPeer');
    $c = new Criteria('dbarray');
    $c->setDBArrayTable('processes');
    $G_MAIN_MENU = 'processmaker';
Exemplo n.º 3
0
    public function updateDataUidByArrayUid(array $arrayWorkflowData, array $arrayWorkflowFile, array $arrayUid)
    {
        try {
            $processUidOld = $arrayUid[0]["old_uid"];
            $processUid = $arrayUid[0]["new_uid"];

            //Update TASK.TAS_UID
            foreach ($arrayWorkflowData["tasks"] as $key => $value) {
                $taskUid = $arrayWorkflowData["tasks"][$key]["TAS_UID"];

                foreach ($arrayUid as $value2) {
                    $arrayItem = $value2;

                    if ($arrayItem["old_uid"] == $taskUid) {
                        $arrayWorkflowData["tasks"][$key]["TAS_UID_OLD"] = $taskUid;
                        $arrayWorkflowData["tasks"][$key]["TAS_UID"] = $arrayItem["new_uid"];
                        break;
                    }
                }
            }

            //Update WEB_ENTRY_EVENT.EVN_UID
            if (isset($arrayWorkflowData["webEntryEvent"])) {
                foreach ($arrayWorkflowData["webEntryEvent"] as $key => $value) {
                    $webEntryEventEventUid = $arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"];

                    foreach ($arrayUid as $value2) {
                        $arrayItem = $value2;

                        if ($arrayItem["old_uid"] == $webEntryEventEventUid) {
                            $arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"] = $arrayItem["new_uid"];
                            break;
                        }
                    }
                }
            }

            //Update MESSAGE_EVENT_DEFINITION.EVN_UID
            if (isset($arrayWorkflowData["messageEventDefinition"])) {
                foreach ($arrayWorkflowData["messageEventDefinition"] as $key => $value) {
                    $messageEventDefinitionEventUid = $arrayWorkflowData["messageEventDefinition"][$key]["EVN_UID"];

                    foreach ($arrayUid as $value2) {
                        $arrayItem = $value2;

                        if ($arrayItem["old_uid"] == $messageEventDefinitionEventUid) {
                            $arrayWorkflowData["messageEventDefinition"][$key]["EVN_UID"] = $arrayItem["new_uid"];
                            break;
                        }
                    }
                }
            }

            //Workflow tables
            $workflowData = (object)($arrayWorkflowData);

            $processes = new \Processes();
            $processes->setProcessGUID($workflowData, $processUid);
            $processes->renewAll($workflowData);

            $arrayWorkflowData = (array)($workflowData);

            //Workflow files
            foreach ($arrayWorkflowFile as $key => $value) {
                $arrayFile = $value;

                foreach ($arrayFile as $key2 => $value2) {
                    $file = $value2;

                    $arrayWorkflowFile[$key][$key2]["file_path"] = str_replace($processUidOld, $processUid, (isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
                    $arrayWorkflowFile[$key][$key2]["file_content"] = str_replace($processUidOld, $processUid, $file["file_content"]);
                }
            }

            if (isset($arrayWorkflowData["uid"])) {
                foreach ($arrayWorkflowData["uid"] as $key => $value) {
                    $arrayT = $value;

                    foreach ($arrayT as $key2 => $value2) {
                        $uidOld = $key2;
                        $uid = $value2;

                        foreach ($arrayWorkflowFile as $key3 => $value3) {
                            $arrayFile = $value3;

                            foreach ($arrayFile as $key4 => $value4) {
                                $file = $value4;

                                $arrayWorkflowFile[$key3][$key4]["file_path"] = str_replace($uidOld, $uid, $file["file_path"]);
                                $arrayWorkflowFile[$key3][$key4]["file_content"] = str_replace($uidOld, $uid, $file["file_content"]);
                            }
                        }
                    }
                }
            }

            //Return
            return array($arrayWorkflowData, $arrayWorkflowFile);
        } catch (\Exception $e) {
            self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());

            throw $e;
        }
    }
Exemplo n.º 4
0
            //if($extion[count($extion)-1]=='html' || $extion[count($extion)-1]=='txt'){
            $aData = Array('pro_uid' => $_REQUEST['pro_uid'], 'fcontent' => $fcontent, 'filename' => $_REQUEST['filename']);
            $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_FileEdit', '', $aData);
            G::RenderPage('publish', 'raw');
            // $G_PUBLISH->AddContent( 'view', 'processes/processesFileEditEmail' );
            // G::RenderPage( 'publish', 'blank' );
            break;
        case 'saveFile':
            $_REQUEST['pro_uid'] = $filter->xssFilterHard($_REQUEST['pro_uid']);
            $_REQUEST['filename'] = $filter->xssFilterHard($_REQUEST['filename']);
            global $G_PUBLISH;
            $G_PUBLISH = new Publisher();
            global $RBAC;
            if ( $RBAC->userCanAccess('PM_FACTORY') == 1) {
                G::LoadClass('processes');
                $app = new Processes();
                if (!$app->processExists($_REQUEST['pro_uid'])) {
                    echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
                    die;
                }

                $sDir = "";
                if (isset($_REQUEST['MAIN_DIRECTORY'])) {
                    $_REQUEST['MAIN_DIRECTORY'] = $filter->xssFilterHard($_REQUEST['MAIN_DIRECTORY']);
                    $sDir = $_REQUEST['MAIN_DIRECTORY'];
                }
                switch ($sDir) {
                    case 'mailTemplates':
                        $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
                        G::auditLog('ProcessFileManager','Save template ('.$_REQUEST['filename'].') in process "'.$resultProcess['PRO_TITLE'].'"');
                        break;
Exemplo n.º 5
0
    /**

     * creates a new case impersonating a user who has the proper privileges to create new cases

     *

     * @param string $processId

     * @param string $userId

     * @param string $variables

     * @param string $taskId, must be in the starting group.

     * @return $result will return an object

     */

    public function newCaseImpersonate ($processId, $userId, $variables, $taskId = '')

    {

        try {

            if (is_array( $variables )) {

                if (count( $variables ) > 0) {

                    $c = count( $variables );

                    $Fields = $variables;

                } else {

                    if ($c == 0) {

                        $result = new wsResponse( 10, G::loadTranslation( 'ID_ARRAY_VARIABLES_EMPTY' ) );



                        return $result;

                    }

                }

            } else {

                $result = new wsResponse( 10, G::loadTranslation( 'ID_VARIABLES_PARAM_NOT_ARRAY' ) );



                return $result;

            }



            $processes = new Processes();



            if (! $processes->processExists( $processId )) {

                $result = new wsResponse( 11, G::loadTranslation( 'ID_INVALID_PROCESS' ) . " " . $processId . "!!" );



                return $result;

            }



            $user = new Users();



            if (! $user->userExists( $userId )) {

                $result = new wsResponse( 11, G::loadTranslation( 'ID_USER_NOT_REGISTERED' ) . " " . $userId . "!!" );



                return $result;

            }



            $oCase = new Cases();



            $numTasks = 0;

            if ($taskId != '') {

                $aTasks = $processes->getStartingTaskForUser( $processId, null );

                foreach ($aTasks as $task) {

                    if ($task['TAS_UID'] == $taskId) {

                        $arrayTask[0]['TAS_UID'] = $taskId;

                        $numTasks = 1;

                    }

                }

            } else {

                $arrayTask = $processes->getStartingTaskForUser( $processId, null );

                $numTasks = count( $arrayTask );

            }



            if ($numTasks == 1) {

                $case = $oCase->startCase( $arrayTask[0]['TAS_UID'], $userId );

                $caseId = $case['APPLICATION'];

                $caseNumber = $case['CASE_NUMBER'];



                $oldFields = $oCase->loadCase( $caseId );



                $oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $Fields );



                $up_case = $oCase->updateCase( $caseId, $oldFields );



                $result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ) );



                $result->caseId = $caseId;

                $result->caseNumber = $caseNumber;



                return $result;

            } else {

                if ($numTasks == 0) {

                    $result = new wsResponse( 12, G::loadTranslation( 'ID_NO_STARTING_TASK' ) );



                    return $result;

                }



                if ($numTasks > 1) {

                    $result = new wsResponse( 13, G::loadTranslation( 'ID_MULTIPLE_STARTING_TASKS' ) );



                    return $result;

                }

            }

        } catch (Exception $e) {

            $result = new wsResponse( 100, $e->getMessage() );



            return $result;

        }

    }
list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']);
$sObjectUID = '';
switch ($sValue['OP_OBJ_TYPE']) {
    case 'ANY':
        /*case 'ANY_DYNAFORM':
          case 'ANY_INPUT':
          case 'ANY_OUTPUT':*/
        $sObjectUID = '';
        break;
    case 'DYNAFORM':
        $sObjectUID = $sValue['DYNAFORMS'];
        break;
    case 'INPUT':
        $sObjectUID = $sValue['INPUTS'];
        break;
    case 'OUTPUT':
        $sObjectUID = $sValue['OUTPUTS'];
        break;
}
require_once 'classes/model/ObjectPermission.php';
$oOP = new ObjectPermission();
$aData = array('OP_UID' => G::generateUniqueID(), 'PRO_UID' => $sValue['PRO_UID'], 'TAS_UID' => $sValue['TAS_UID'], 'USR_UID' => (string) $sUserGroup, 'OP_USER_RELATION' => $iRelation, 'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'], 'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'], 'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'], 'OP_OBJ_UID' => $sObjectUID, 'OP_ACTION' => $sValue['OP_ACTION'], 'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS']);
$oOP->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$oOP->save();
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$oProcessMap->getObjectsPermissionsCriteria($sValue['PRO_UID']);
$infoProcess = new Processes();
$resultProcess = $infoProcess->getProcessRow($sValue['PRO_UID']);
$participation = $sValue['OP_PARTICIPATE'] == 1 ? "YES" : "NO";
G::auditLog('ProcessPermissions', 'Add Permission (group or user: '******'|', $sValue['GROUP_USER'])) . ', permission: ' . $sValue['OP_ACTION'] . ', status case: ' . $sValue['OP_CASE_STATUS'] . ', type: ' . $sValue['OP_OBJ_TYPE'] . ', participation required: ' . $participation . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
 switch ($RBAC->userCanAccess('PM_FACTORY')) {
     case -2:
         G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
         G::header('location: ../login/login');
         die;
         break;
     case -1:
         G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
         G::header('location: ../login/login');
         die;
         break;
 }
 //srequire_once 'classes/model/StepTrigger.php';
 G::LoadClass('processMap');
 $oProcessMap = new ProcessMap();
 $infoProcess = new Processes();
 $resultProcess = $infoProcess->getProcessRow($_POST['PRO_UID']);
 switch ($_POST['action']) {
     case 'availableSupervisorDynaforms':
         $oProcessMap->availableSupervisorDynaforms($_POST['PRO_UID']);
         break;
     case 'assignSupervisorDynaform':
         $oProcessMap->assignSupervisorStep($_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID']);
         G::auditLog('AssignSupervisorDynaform', 'Assign Supervisor Dynaform (' . $_POST['DYN_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
         break;
     case 'removeSupervisorDynaform':
         $oProcessMap->removeSupervisorStep($_POST['STEP_UID'], $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'], $_POST['STEP_POSITION']);
         G::auditLog('RemoveSupervisorDynaform', 'Remove Supervisor Dynaform (' . $_POST['DYN_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
         break;
     case 'availableSupervisorInputs':
         $oProcessMap->availableSupervisorInputs($_POST['PRO_UID']);
Exemplo n.º 8
0
    public function import($option = self::IMPORT_OPTION_CREATE_NEW, $optionGroup = self::GROUP_IMPORT_OPTION_CREATE_NEW)
    {
        $this->prepare();

        //Verify data
        switch ($option) {
            case self::IMPORT_OPTION_CREATE_NEW:
                if ($this->targetExists()) {
                    throw new \Exception(
                        \G::LoadTranslation(
                            "ID_IMPORTER_PROJECT_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE",
                            array(implode(
                                "|",
                                array(
                                    self::IMPORT_OPTION_CREATE_NEW,
                                    self::IMPORT_OPTION_OVERWRITE,
                                    self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW,
                                    self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW
                                )
                            ))
                        ),
                        self::IMPORT_STAT_TARGET_ALREADY_EXISTS
                    );
                }
                break;
            case self::IMPORT_OPTION_OVERWRITE:
                break;
            case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
                break;
            case self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW:
                break;
        }

        $processes = new \Processes();

        switch ($optionGroup) {
            case self::GROUP_IMPORT_OPTION_CREATE_NEW:
                $arrayAux = $processes->checkExistingGroups($this->importData["tables"]["workflow"]["groupwfs"]);

                if (is_array($arrayAux) && count($arrayAux) > 0) {
                    throw new \Exception(
                        \G::LoadTranslation(
                            "ID_IMPORTER_GROUP_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE",
                            array(implode(
                                "|",
                                array(
                                    self::GROUP_IMPORT_OPTION_CREATE_NEW,
                                    self::GROUP_IMPORT_OPTION_RENAME,
                                    self::GROUP_IMPORT_OPTION_MERGE_PREEXISTENT
                                )
                            ))
                        ),
                        self::IMPORT_STAT_GROUP_ALREADY_EXISTS
                    );
                }
                break;
            case self::GROUP_IMPORT_OPTION_RENAME:
                $arrayAux = $processes->renameExistingGroups($this->importData["tables"]["workflow"]["groupwfs"]);

                if (is_array($arrayAux) && count($arrayAux) > 0) {
                    $this->importData["tables"]["workflow"]["groupwfs"] = $arrayAux;
                }
                break;
            case self::GROUP_IMPORT_OPTION_MERGE_PREEXISTENT:
                $this->importData["tables"]["workflow"] = (array)($processes->groupwfsUpdateUidByDatabase((object)($this->importData["tables"]["workflow"])));
                break;
        }

        //Import
        $name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"];

        switch ($option) {
            case self::IMPORT_OPTION_CREATE_NEW:
                //Shouldn't generate new UID for all objects
                $generateUid = false;
                break;
            case self::IMPORT_OPTION_OVERWRITE:
                //Shouldn't generate new UID for all objects
                $this->removeProject();

                $generateUid = false;
                break;
            case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
                //Should generate new UID for all objects
                $this->disableProject();

                $name = "New - " . $name . " - " . date("M d, H:i");

                $generateUid = true;
                break;
            case self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW:
                //Should generate new UID for all objects
                $name = \G::LoadTranslation("ID_COPY_OF") . " - " . $name . " - " . date("M d, H:i");

                $generateUid = true;
                break;
        }

        $this->importData["tables"]["bpmn"]["project"][0]["prj_name"] = $name;
        $this->importData["tables"]["bpmn"]["diagram"][0]["dia_name"] = $name;
        $this->importData["tables"]["bpmn"]["process"][0]["pro_name"] = $name;
        $this->importData["tables"]["workflow"]["process"][0]["PRO_TITLE"] = $name;

        if ($this->importData["tables"]["workflow"]["process"][0]["PRO_UPDATE_DATE"] . "" == "") {
            $this->importData["tables"]["workflow"]["process"][0]["PRO_UPDATE_DATE"] = null;
        }

        $this->importData["tables"]["workflow"]["process"] = $this->importData["tables"]["workflow"]["process"][0];

        //Import
        $result = $this->doImport($generateUid);

        //Return
        return $result;
    }
Exemplo n.º 9
0
    public function updateDataUidByArrayUid(array $arrayWorkflowData, array $arrayWorkflowFile, array $arrayUid)
    {
        try {
            $processUidOld = $arrayUid[0]["old_uid"];
            $processUid = $arrayUid[0]["new_uid"];

            //Update Table.Field
            $arrayUpdateTableField = array(
                "tasks"                  => array("fieldname" => "TAS_UID", "oldFieldname" => "TAS_UID_OLD"), //Update TASK.TAS_UID
                "webEntryEvent"          => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), //Update WEB_ENTRY_EVENT.EVN_UID
                "messageEventDefinition" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), //Update MESSAGE_EVENT_DEFINITION.EVN_UID
                "scriptTask"             => array("fieldname" => "ACT_UID", "oldFieldname" => "ACT_UID_OLD"), //Update SCRIPT_TASK.ACT_UID
                "timerEvent"             => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), //Update TIMER_EVENT.EVN_UID
                "emailEvent"             => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD")  //Update EMAIL_EVENT.EVN_UID
            );

            foreach ($arrayUpdateTableField as $key => $value) {
                $table = $key;
                $fieldname = $value["fieldname"];
                $oldFieldname = $value["oldFieldname"];

                if (isset($arrayWorkflowData[$table])) {
                    foreach ($arrayWorkflowData[$table] as $key2 => $value2) {
                        $uid = $arrayWorkflowData[$table][$key2][$fieldname];

                        foreach ($arrayUid as $value3) {
                            $arrayItem = $value3;

                            if ($arrayItem["old_uid"] == $uid) {
                                $arrayWorkflowData[$table][$key2][$fieldname]    = $arrayItem["new_uid"];
                                $arrayWorkflowData[$table][$key2][$oldFieldname] = $uid;
                                break;
                            }
                        }
                    }
                }
            }

            //Workflow tables
            $workflowData = (object)($arrayWorkflowData);

            $processes = new \Processes();
            $processes->setProcessGUID($workflowData, $processUid);
            $processes->renewAll($workflowData);

            $arrayWorkflowData = (array)($workflowData);

            //Workflow files
            foreach ($arrayWorkflowFile as $key => $value) {
                $arrayFile = $value;

                foreach ($arrayFile as $key2 => $value2) {
                    $file = $value2;

                    $arrayWorkflowFile[$key][$key2]["file_path"] = str_replace($processUidOld, $processUid, (isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
                    $arrayWorkflowFile[$key][$key2]["file_content"] = str_replace($processUidOld, $processUid, $file["file_content"]);
                }
            }

            if (isset($arrayWorkflowData["uid"])) {
                foreach ($arrayWorkflowData["uid"] as $key => $value) {
                    $arrayT = $value;

                    foreach ($arrayT as $key2 => $value2) {
                        $uidOld = $key2;
                        $uid = $value2;

                        foreach ($arrayWorkflowFile as $key3 => $value3) {
                            $arrayFile = $value3;

                            foreach ($arrayFile as $key4 => $value4) {
                                $file = $value4;

                                $arrayWorkflowFile[$key3][$key4]["file_path"] = str_replace($uidOld, $uid, $file["file_path"]);
                                $arrayWorkflowFile[$key3][$key4]["file_content"] = str_replace($uidOld, $uid, $file["file_content"]);
                            }
                        }
                    }
                }
            }

            //Return
            return array($arrayWorkflowData, $arrayWorkflowFile);
        } catch (\Exception $e) {
            self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());

            throw $e;
        }
    }
Exemplo n.º 10
0
<?php

sleep(1);
global $RBAC;
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
    if (isset($_SESSION['processes_upload'])) {
        $form = $_SESSION['processes_upload'];
        G::LoadClass('processes');
        $app = new Processes();
        if (!$app->processExists($form['PRO_UID'])) {
            $result = 0;
            $msg = G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
            echo "{'result': {$result}, 'msg':'{$msg}'}";
            die;
        }
        switch ($form['MAIN_DIRECTORY']) {
            case 'mailTemplates':
                $sDirectory = PATH_DATA_MAILTEMPLATES . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
                break;
            case 'public':
                $sDirectory = PATH_DATA_PUBLIC . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
                break;
            default:
                die;
                break;
        }
    }
    if ($_FILES['form']['error'] == "0") {
        G::uploadFile($_FILES['form']['tmp_name'], $sDirectory, $_FILES['form']['name']);
        $msg = "Uploaded (" . round(filesize($sDirectory . $_FILES['form']['name']) / 1024 * 10) / 10 . " kb)";
        $result = 1;
Exemplo n.º 11
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 */
try {
    //load the variables
    G::LoadClass('processes');
    $oProcess = new Processes();
    //  if ( isset ($_POST) ) {
    //  	krumo ( $_POST );
    //  }
    if (isset($_POST['form']['PRO_FILENAME'])) {
        $path = $_POST['form']['PRO_PATH'];
        $filename = $_POST['form']['PRO_FILENAME'];
        $action = $_POST['form']['GROUP_IMPORT_OPTION'];
    } else {
        //save the file, if it's not saved
        if ($_FILES['form']['error']['PROCESS_FILENAME'] == 0) {
            $filename = $_FILES['form']['name']['PROCESS_FILENAME'];
            $path = PATH_DOCUMENT . 'input' . PATH_SEP;
            $tempName = $_FILES['form']['tmp_name']['PROCESS_FILENAME'];
            $action = "none";
            G::uploadFile($tempName, $path, $filename);
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 */
try {
    //load the variables
    G::LoadClass('processes');
    $oProcess = new Processes();
    if (!isset($_POST['form']['IMPORT_OPTION'])) {
        throw new Exception('Please select an option before to continue');
    }
    $option = $_POST['form']['IMPORT_OPTION'];
    $filename = $_POST['form']['PRO_FILENAME'];
    $ObjUid = $_POST['form']['OBJ_UID'];
    $path = PATH_DOCUMENT . 'input' . PATH_SEP;
    $oData = $oProcess->getProcessData($path . $filename);
    $Fields['PRO_FILENAME'] = $filename;
    $sProUid = $oData->process['PRO_UID'];
    $oData->process['PRO_UID_OLD'] = $sProUid;
    //Update the current Process, overwriting all tasks and steps
    if ($option == 1) {
        $oProcess->updateProcessFromData($oData, $path . $filename);
        if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) {
Exemplo n.º 13
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
G::LoadClass('Installer');
$inst = new Installer();
G::LoadClass('processes');
$oProcess = new Processes();
//Get Available autoinstall process
$availableProcess = $inst->getDirectoryFiles(PATH_OUTTRUNK . "autoinstall", "pm");
$path = PATH_OUTTRUNK . "autoinstall" . PATH_SEP;
$message = "";
foreach ($availableProcess as $processfile) {
    $oData = $oProcess->getProcessData($path . $processfile);
    $Fields['PRO_FILENAME'] = $processfile;
    $Fields['IMPORT_OPTION'] = 2;
    $sProUid = $oData->process['PRO_UID'];
    if ($oProcess->processExists($sProUid)) {
        $message .= "{$processfile} - Not imported (process exist)<br>";
    } else {
        $oProcess->createProcessFromData($oData, $path . $processfile);
        $message .= "{$processfile} - OK<br>";
    }
Exemplo n.º 14
0
    /**
     * Verify if doesn't exists the Template in Routing Screen Template
     *
     * @param string $processUid            Unique id of Process
     * @param string $fileName              Name template
     * @param string $fieldNameForException Field name for the exception
     *
     * return void Throw exception if doesn't exists the Template in Routing Screen Template
     */
    public function throwExceptionIfNotExistsRoutingScreenTemplate($processUid, $fileName, $fieldNameForException)
    {
        try {
            \G::LoadClass("processes");

            $arrayFile = \Processes::getProcessFiles($processUid, "mail");
            $flag = 0;

            foreach ($arrayFile as $f) {
                if ($f["filename"] == $fileName) {
                    $flag = 1;
                    break;
                }
            }

            if ($flag == 0) {
                throw new \Exception(\G::LoadTranslation("ID_ROUTING_SCREEN_TEMPLATE_DOES_NOT_EXIST", array($fieldNameForException, $fileName)));
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
Exemplo n.º 15
0
 public function updateDataUidByArrayUid(array $arrayWorkflowData, array $arrayWorkflowFile, array $arrayUid)
 {
     try {
         $processUidOld = $arrayUid[0]["old_uid"];
         $processUid = $arrayUid[0]["new_uid"];
         //Update Table.Field
         $arrayUpdateTableField = array("tasks" => array("fieldname" => "TAS_UID", "oldFieldname" => "TAS_UID_OLD"), "webEntryEvent" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), "messageEventDefinition" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), "scriptTask" => array("fieldname" => "ACT_UID", "oldFieldname" => "ACT_UID_OLD"), "timerEvent" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), "emailEvent" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), "abeConfiguration" => array("fieldname" => "TAS_UID", "oldFieldname" => "TAS_UID_OLD"));
         foreach ($arrayUpdateTableField as $key => $value) {
             $table = $key;
             $fieldname = $value["fieldname"];
             $oldFieldname = $value["oldFieldname"];
             if (isset($arrayWorkflowData[$table])) {
                 foreach ($arrayWorkflowData[$table] as $key2 => $value2) {
                     $uid = $arrayWorkflowData[$table][$key2][$fieldname];
                     foreach ($arrayUid as $value3) {
                         $arrayItem = $value3;
                         if ($arrayItem["old_uid"] == $uid) {
                             $arrayWorkflowData[$table][$key2][$fieldname] = $arrayItem["new_uid"];
                             $arrayWorkflowData[$table][$key2][$oldFieldname] = $uid;
                             break;
                         }
                     }
                 }
             }
         }
         //Workflow tables
         $workflowData = (object) $arrayWorkflowData;
         $processes = new \Processes();
         $processes->setProcessGUID($workflowData, $processUid);
         $processes->renewAll($workflowData);
         $arrayWorkflowData = (array) $workflowData;
         foreach ($arrayWorkflowData["dynaforms"] as $key => $value) {
             if ($arrayWorkflowData["dynaforms"][$key]["DYN_CONTENT"] != "") {
                 $dynaFormContent = $arrayWorkflowData["dynaforms"][$key]["DYN_CONTENT"];
                 foreach ($arrayWorkflowData["uid"] as $value2) {
                     $arrayAux = $value2;
                     foreach ($arrayAux as $key3 => $value3) {
                         $uidOld = $key3;
                         $uid = $value3;
                         $dynaFormContent = str_replace($uidOld, $uid, $dynaFormContent);
                     }
                 }
                 $arrayWorkflowData["dynaforms"][$key]["DYN_CONTENT"] = $dynaFormContent;
             }
         }
         //Workflow files
         foreach ($arrayWorkflowFile as $key => $value) {
             $arrayFile = $value;
             foreach ($arrayFile as $key2 => $value2) {
                 $file = $value2;
                 $arrayWorkflowFile[$key][$key2]["file_path"] = str_replace($processUidOld, $processUid, isset($file["file_path"]) ? $file["file_path"] : $file["filepath"]);
                 $arrayWorkflowFile[$key][$key2]["file_content"] = str_replace($processUidOld, $processUid, $file["file_content"]);
             }
         }
         if (isset($arrayWorkflowData["uid"])) {
             foreach ($arrayWorkflowData["uid"] as $key => $value) {
                 $arrayT = $value;
                 foreach ($arrayT as $key2 => $value2) {
                     $uidOld = $key2;
                     $uid = $value2;
                     foreach ($arrayWorkflowFile as $key3 => $value3) {
                         $arrayFile = $value3;
                         foreach ($arrayFile as $key4 => $value4) {
                             $file = $value4;
                             $arrayWorkflowFile[$key3][$key4]["file_path"] = str_replace($uidOld, $uid, $file["file_path"]);
                             $arrayWorkflowFile[$key3][$key4]["file_content"] = str_replace($uidOld, $uid, $file["file_content"]);
                         }
                     }
                 }
             }
         }
         //Return
         return array($arrayWorkflowData, $arrayWorkflowFile);
     } catch (\Exception $e) {
         self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
         throw $e;
     }
 }
Exemplo n.º 16
0
 /**
  * import process fromLibrary: downloads and imports a process from the ProcessMaker library
  *
  * @param string sessionId : The session ID (which was obtained at login).
  * @param string processId :
  * @param string version :
  * @param string importOption :
  * @param string usernameLibrary : The username to obtain access to the ProcessMaker library.
  * @param string passwordLibrary : The password to obtain access to the ProcessMaker library.
  * @return $eturns will return an object
  */
 public function importProcessFromLibrary($processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '')
 {
     try {
         G::LoadClass('processes');
         //$versionReq = $_GET['v'];
         //. (isset($_GET['s']) ? '&s=' . $_GET['s'] : '')
         $ipaddress = $_SERVER['REMOTE_ADDR'];
         $oProcesses = new Processes();
         $oProcesses->ws_open_public();
         $oProcess = $oProcesses->ws_processGetData($processId);
         if ($oProcess->status_code != 0) {
             throw new Exception($oProcess->message);
         }
         $privacy = $oProcess->privacy;
         $strSession = '';
         if ($privacy != 'FREE') {
             global $sessionId;
             $antSession = $sessionId;
             $oProcesses->ws_open($usernameLibrary, $passwordLibrary);
             $strSession = "&s=" . $sessionId;
             $sessionId = $antSession;
         }
         //downloading the file
         $localPath = PATH_DOCUMENT . 'input' . PATH_SEP;
         G::mk_dir($localPath);
         $newfilename = G::GenerateUniqueId() . '.pm';
         $downloadUrl = PML_DOWNLOAD_URL . '?id=' . $processId . $strSession;
         $oProcess = new Processes();
         $oProcess->downloadFile($downloadUrl, $localPath, $newfilename);
         //getting the ProUid from the file recently downloaded
         $oData = $oProcess->getProcessData($localPath . $newfilename);
         if (is_null($oData)) {
             $data['DOWNLOAD_URL'] = $downloadUrl;
             $data['LOCAL_PATH'] = $localPath;
             $data['NEW_FILENAME'] = $newfilename;
             throw new Exception(G::loadTranslation('ID_ERROR_URL_PROCESS_INVALID', SYS_LANG, $data));
         }
         $sProUid = $oData->process['PRO_UID'];
         $oData->process['PRO_UID_OLD'] = $sProUid;
         //if the process exists, we need to check the $importOption to and re-import if the user wants,
         if ($oProcess->processExists($sProUid)) {
             //Update the current Process, overwriting all tasks and steps
             if ($importOption == 1) {
                 $oProcess->updateProcessFromData($oData, $localPath . $newfilename);
                 //delete the xmlform cache
                 if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) {
                     $oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid);
                     while ($sObjectName = $oDirectory->read()) {
                         if ($sObjectName != '.' && $sObjectName != '..') {
                             $strAux = PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP;
                             $strAux = $strAux . $sProUid . PATH_SEP . $sObjectName;
                             unlink($strAux);
                         }
                     }
                     $oDirectory->close();
                 }
                 $sNewProUid = $sProUid;
             }
             //Disable current Process and create a new version of the Process
             if ($importOption == 2) {
                 $oProcess->disablePreviousProcesses($sProUid);
                 $sNewProUid = $oProcess->getUnusedProcessGUID();
                 $oProcess->setProcessGuid($oData, $sNewProUid);
                 $oProcess->setProcessParent($oData, $sProUid);
                 $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date('M d, H:i');
                 $oProcess->renewAll($oData);
                 $oProcess->createProcessFromData($oData, $localPath . $newfilename);
             }
             //Create a completely new Process without change the current Process
             if ($importOption == 3) {
                 //krumo ($oData); die;
                 $sNewProUid = $oProcess->getUnusedProcessGUID();
                 $oProcess->setProcessGuid($oData, $sNewProUid);
                 $strAux = "Copy of  - " . $oData->process['PRO_TITLE'] . ' - ' . date('M d, H:i');
                 $oData->process['PRO_TITLE'] = $strAux;
                 $oProcess->renewAll($oData);
                 $oProcess->createProcessFromData($oData, $localPath . $newfilename);
             }
             if ($importOption != 1 && $importOption != 2 && $importOption != 3) {
                 throw new Exception(G::loadTranslation('ID_PROCESS_ALREADY_IN_SYSTEM'));
             }
         }
         //finally, creating the process if the process doesn't exist
         if (!$oProcess->processExists($processId)) {
             $oProcess->createProcessFromData($oData, $localPath . $newfilename);
         }
         //show the info after the imported process
         $oProcess = new Processes();
         $oProcess->ws_open_public();
         $processData = $oProcess->ws_processGetData($processId);
         $result->status_code = 0;
         $result->message = G::loadTranslation('ID_COMMAND_EXECUTED_SUCCESSFULLY');
         $result->timestamp = date('Y-m-d H:i:s');
         $result->processId = $processId;
         $result->processTitle = $processData->title;
         $result->category = isset($processData->category) ? $processData->category : '';
         $result->version = $processData->version;
         return $result;
     } catch (Exception $e) {
         $result = new wsResponse(100, $e->getMessage());
         return $result;
     }
 }
Exemplo n.º 17
0
 public function editTaskProperties($sTaskUID = '', $iForm = 1, $iIndex = 0)
 {
     $sw_template = false;
     try {
         switch ($iForm) {
             case 1:
                 $sFilename = 'tasks/tasks_Definition.xml';
                 break;
             case 2:
                 $sFilename = 'tasks/tasks_AssignmentRules.xml';
                 break;
             case 3:
                 $sFilename = 'tasks/tasks_TimingControl.xml';
                 break;
             case 4:
                 $sFilename = 'tasks/tasks_Owner.xml';
                 break;
             case 5:
                 $sFilename = 'tasks/tasks_Permissions.xml';
                 break;
             case 6:
                 $sFilename = 'tasks/tasks_Labels.xml';
                 break;
             case 7:
                 $sFilename = 'tasks/tasks_Notifications.xml';
                 break;
             default:
                 //if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011
                 $oPluginRegistry =& PMPluginRegistry::getSingleton();
                 $activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();
                 $oPM->taskOptions = array();
                 foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) {
                     $id = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName;
                     if ($id == $iForm) {
                         $sFilename = $taskPropertiesInfo->sPage;
                         $sw_template = true;
                     }
                 }
                 //$sFilename = 'tasks/tasks_Owner.xml';
                 break;
         }
         $oTask = new Task();
         $aFields = $oTask->load($sTaskUID);
         $aFields['INDEX'] = $iIndex;
         $aFields['IFORM'] = $iForm;
         $aFields['LANG'] = SYS_LANG;
         /**
          * Task Notifications *
          */
         if ($iForm == 7 || $iForm == 1) {
             G::loadClass('processes');
             $files = Processes::getProcessFiles($aFields['PRO_UID'], 'mail');
             $templates = array();
             $templates[] = 'dummy';
             foreach ($files as $file) {
                 $templates[] = array('FILE' => $file['filename'], 'NAME' => $file['filename']);
             }
             global $_DBArray;
             $_DBArray['_TEMPLATES1'] = $templates;
             $_SESSION['_DBArray'] = $_DBArray;
             if ($iForm == 7) {
                 // Additional configuration
                 G::loadClass('configuration');
                 $oConf = new Configurations();
                 $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aFields['TAS_UID'], '', '');
                 $conf = $oConf->aConfig;
                 if (isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TYPE'])) {
                     $aFields['TAS_DEF_MESSAGE_TYPE'] = $conf['TAS_DEF_MESSAGE_TYPE'];
                     $aFields['TAS_DEF_MESSAGE_TEMPLATE'] = $conf['TAS_DEF_MESSAGE_TEMPLATE'];
                 }
             }
         }
         if ($iForm == 3) {
             //Load Calendar Information
             $calendar = new Calendar();
             $calendarObj = $calendar->getCalendarList(true, true);
             global $_DBArray;
             $_DBArray['availableCalendars'] = $calendarObj['array'];
             $_SESSION['_DBArray'] = $_DBArray;
             $calendarInfo = $calendar->getCalendarFor($sTaskUID, $sTaskUID, $sTaskUID);
             //If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
             $aFields['TAS_CALENDAR'] = $calendarInfo['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo['CALENDAR_UID'] : "";
         }
         if ($iForm == 2) {
             switch ($aFields["TAS_ASSIGN_TYPE"]) {
                 case "SELF_SERVICE":
                     $aFields["TAS_ASSIGN_TYPE"] = !empty($aFields["TAS_GROUP_VARIABLE"]) ? "SELF_SERVICE_EVALUATE" : $aFields["TAS_ASSIGN_TYPE"];
                     break;
             }
         }
         global $G_PUBLISH;
         G::LoadClass('xmlfield_InputPM');
         $G_PUBLISH = new Publisher();
         if ($sw_template) {
             $G_PUBLISH->AddContent('view', $sFilename);
         } else {
             $G_PUBLISH->AddContent('xmlform', 'xmlform', $sFilename, '', $aFields);
         }
         G::RenderPage('publish', 'raw');
         return true;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
 $filename = $_REQUEST["PRO_FILENAME"];
 $processFileType = $_REQUEST["processFileType"];
 $result->ExistGroupsInDatabase = "";
 //"" -Default
 //0 -Dont exist process
 //1 -exist process
 $optionGroupExistInDatabase = isset($_REQUEST["optionGroupExistInDatabase"]) ? $_REQUEST["optionGroupExistInDatabase"] : null;
 $sNewProUid = "";
 $oProcess = new stdClass();
 if ($processFileType != "pm") {
     throw new Exception(G::LoadTranslation("ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR"));
 }
 //load the variables
 if ($processFileType == "pm") {
     G::LoadClass('processes');
     $oProcess = new Processes();
 }
 $path = PATH_DOCUMENT . 'input' . PATH_SEP;
 if ($processFileType == "pm") {
     $oData = $oProcess->getProcessData($path . $filename);
 }
 $importer->throwExceptionIfExistsReservedWordsSql($oData);
 //**cheking if the PRO_CREATE_USER exist**//
 $usrCrtr = $oData->process['PRO_CREATE_USER'];
 $exist = new Users();
 if ($exist->userExists($usrCrtr)) {
     $usrInfo = $exist->getAllInformation($usrCrtr);
     if ($usrInfo['status'] == 'CLOSED') {
         $oData->process['PRO_CREATE_USER'] = $_SESSION['USER_LOGGED'];
     }
 } else {
Exemplo n.º 19
0
    /**

     * Get disabled code

     *

     * return array Return array with disabled code found, array empty otherwise

     */

    public function getDisabledCode()

    {

        try {

            $this->initPropel(true);



            G::LoadClass("processes");



            $process = new Processes();



            //Return

            return $process->getDisabledCode();

        } catch (Exception $e) {

            throw $e;

        }

    }
Exemplo n.º 20
0
    public function editTaskProperties($sTaskUID = '', $iForm = 1, $iIndex = 0)

    {

        $sw_template = false;

        try {

            switch ($iForm) {

                case 1:

                    $sFilename = 'tasks/tasks_Definition.xml';

                    break;

                case 2:

                    $sFilename = 'tasks/tasks_AssignmentRules.xml';

                    break;

                case 3:

                    $sFilename = 'tasks/tasks_TimingControl.xml';

                    break;

                case 4:

                    $sFilename = 'tasks/tasks_Owner.xml';

                    break;

                case 5:

                    $sFilename = 'tasks/tasks_Permissions.xml';

                    break;

                case 6:

                    $sFilename = 'tasks/tasks_Labels.xml';

                    break;

                case 7:

                    $sFilename = 'tasks/tasks_Notifications.xml';

                    break;

                case 8:

                    $sFilename = 'tasks/tasks_Consolidated.xml';

                    break;

                default:

                    //if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011

                    $oPluginRegistry = & PMPluginRegistry::getSingleton();

                    $activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();

                    foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) {

                        $id = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName;

                        if ($id == $iForm) {

                            $sFilename = $taskPropertiesInfo->sPage;

                            $sw_template = true;

                        }

                    }



                    //$sFilename = 'tasks/tasks_Owner.xml';

                    break;

            }

            $oTask = new Task();

            $aFields = $oTask->load($sTaskUID);

            $aFields['INDEX'] = $iIndex;

            $aFields['IFORM'] = $iForm;

            $aFields['LANG'] = SYS_LANG;



            /**

             * Task Notifications *

             */

            if ($iForm == 7 || $iForm == 1) {

                G::loadClass('processes');

                $files = Processes::getProcessFiles($aFields['PRO_UID'], 'mail');



                $templates = array();

                $templates[] = 'dummy';



                foreach ($files as $file) {

                    $templates[] = array('FILE' => $file['filename'], 'NAME' => $file['filename'] );

                }



                global $_DBArray;

                $_DBArray['_TEMPLATES1'] = $templates;

                $_SESSION['_DBArray'] = $_DBArray;



                if ($iForm == 7) {

                    // Additional configuration

                    G::loadClass('configuration');

                    $oConf = new Configurations();

                    $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aFields['TAS_UID'], '', '');

                    $conf = $oConf->aConfig;

                    if (isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TYPE'])) {

                        $aFields['TAS_DEF_MESSAGE_TYPE'] = $conf['TAS_DEF_MESSAGE_TYPE'];

                        $aFields['TAS_DEF_MESSAGE_TEMPLATE'] = $conf['TAS_DEF_MESSAGE_TEMPLATE'];

                    }

                }

            }



            if ($iForm == 3) {

                //Load Calendar Information

                $calendar = new Calendar();

                $calendarObj = $calendar->getCalendarList(true, true);



                global $_DBArray;



                $_DBArray['availableCalendars'] = $calendarObj['array'];



                $_SESSION['_DBArray'] = $_DBArray;



                $calendarInfo = $calendar->getCalendarFor($sTaskUID, $sTaskUID, $sTaskUID);



                //If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar

                $aFields['TAS_CALENDAR'] = $calendarInfo['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo['CALENDAR_UID'] : "";

            }



            if ($iForm == 2) {

                switch ($aFields["TAS_ASSIGN_TYPE"]) {

                    case "SELF_SERVICE":

                        $aFields["TAS_ASSIGN_TYPE"] = (!empty($aFields["TAS_GROUP_VARIABLE"])) ? "SELF_SERVICE_EVALUATE" : $aFields["TAS_ASSIGN_TYPE"];

                        break;

                }

            }



            if ($iForm == 8) {

                $oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($_SESSION["cDhTajE2T2lxSkhqMzZUTXVacWYyNcKwV3A4eWYybDdyb1p3"]["TAS_UID"]);

                if ((is_object($oCaseConsolidated)) && get_class($oCaseConsolidated) == "CaseConsolidated") {

                    require_once ("classes/model/ReportTable.php");



                    $aFields["CON_STATUS"]  = $oCaseConsolidated->getConStatus();

                    $aFields["DYN_UID"]     = $oCaseConsolidated->getDynUid();

                    $aFields["REP_TAB_UID"] = $oCaseConsolidated->getRepTabUid();



                    $oReportTables = new ReportTable();

                    $oReportTables = $oReportTables->load($aFields["REP_TAB_UID"]);

                    if (count($oReportTables)>0) {

                        if ($oReportTables['REP_TAB_STATUS'] == 'ACTIVE') {

                            $aFields["TABLE_NAME"] = $oReportTables['REP_TAB_NAME'];

                            $aFields["TITLE"] = $oReportTables['REP_TAB_TITLE'];

                        }

                    }

                }

                $aFields["PRO_UID"]  = $_SESSION["PROCESS"];

                $aFields["TAS_UID"]  = $_SESSION["cDhTajE2T2lxSkhqMzZUTXVacWYyNcKwV3A4eWYybDdyb1p3"]["TAS_UID"];

                $aFields["SYS_LANG"] = SYS_LANG;

                $aFields['INDEX']    = 0;

                $aFields["TABLE_NAME_DEFAULT"] = "__" . $aFields["TAS_UID"];



                $oCriteria = new Criteria("workflow");

                $del = DBAdapter::getStringDelimiter();



                $oCriteria->setDistinct();

                $oCriteria->addSelectColumn(DynaformPeer::DYN_UID);

                $oCriteria->addSelectColumn(ContentPeer::CON_VALUE);

                

                $aConditions   = array();

                $aConditions[] = array(DynaformPeer::DYN_UID, ContentPeer::CON_ID);

                $aConditions[] = array(ContentPeer::CON_CATEGORY, $del . "DYN_TITLE" . $del);

                $aConditions[] = array(ContentPeer::CON_LANG, $del . "en" . $del);

                $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);

                

                $oCriteria->add(DynaformPeer::PRO_UID, $_SESSION["PROCESS"]);

                $oCriteria->add(DynaformPeer::DYN_TYPE, "grid");

                

                $oCriteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);



                $numRows = DynaformPeer::doCount($oCriteria);

                if ($numRows == 0) {

                    $aFields['TITLE_ALERT'] = G::LoadTranslation('ID_ALERT');

                    $aFields['SUBTITLE_MESSAGE'] = G::LoadTranslation('ID_CONSOLIDATED_DYNAFORM_REQUIRED');

                    $sFilename = 'tasks/tasks_Consolidated_Error.xml';

                }

            }



            global $G_PUBLISH;

            G::LoadClass('xmlfield_InputPM');

            $G_PUBLISH = new Publisher();

            if ($sw_template) {

                $G_PUBLISH->AddContent('view', $sFilename);

            } else {

                $G_PUBLISH->AddContent('xmlform', 'xmlform', $sFilename, '', $aFields);

            }



            G::RenderPage('publish', 'raw');

            return true;

        } catch (Exception $oError) {

            throw ($oError);

        }

    }
Exemplo n.º 21
0
 {
     require_once 'classes/model/Content.php';
     $content = new Content();
     $value = $content->load($Category, '', $Id, $Lang);
     return $value;
 }
 //$oJSON = new Services_JSON();
 $stdObj = Bootstrap::json_decode($_POST['data']);
 if (isset($stdObj->pro_uid)) {
     $sProUid = $stdObj->pro_uid;
 } else {
     throw new Exception(G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED'));
 }
 /* Includes */
 G::LoadClass('processes');
 $oProcess = new Processes();
 $proFields = $oProcess->serializeProcess($sProUid);
 $Fields = $oProcess->saveSerializedProcess($proFields);
 $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP);
 $length = strlen($Fields['PRO_TITLE']) + $pathLength;
 foreach ($Fields as $key => $value) {
     if ($key == 'PRO_TITLE') {
         $Fields[$key] = myTruncate($value, 65, ' ', '...');
     }
     if ($key == 'FILENAME') {
         $Fields[$key] = myTruncate($value, 60, '_', '...pm');
     }
     if ($length >= 250) {
         if ($key == 'FILENAME_LINK') {
             list($file, $rest) = explode('p=', $value);
             list($filenameLink, $rest) = explode('&', $rest);
Exemplo n.º 22
0
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;

try {
	if(empty($_GET)){
		$proUid = Bootstrap::json_decode( $_POST['data']);
		$_GET["pro_uid"] = $proUid->pro_uid;
	}
    if (\BpmnProject::exists($_GET["pro_uid"])) {
        $exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
        $getProjectName = $exporter->truncateName($exporter->getProjectName(),false);

        $version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
        $outputFilename = sprintf("%s-%s.%s", str_replace(" ","_",$getProjectName), $version, "pmx");
        $outputFilename = $exporter->saveExport($outputDir.$outputFilename);
    } else {
        $oProcess = new Processes();
        $proFields = $oProcess->serializeProcess($_GET["pro_uid"]);
        $result = $oProcess->saveSerializedProcess($proFields);
        $outputFilename = $result["FILENAME"];

        rename($outputDir . $outputFilename . "tpm", $outputDir . $outputFilename);
    }
    $response->file_hash = base64_encode($outputFilename);
    $response->success = true;

    /* Render page */
    if (isset( $_REQUEST["processMap"] ) && $_REQUEST["processMap"] == 1) {
    	$link = parse_url($result['FILENAME_LINK']);
    	$result['FILENAME_LINK'] = $link['path'] . '?file_hash=' . $response->file_hash;

    	$G_PUBLISH = new Publisher();
Exemplo n.º 23
0
 /**
  * Change process debug mode
  */
 public function changeDebugMode()
 {
     $ids = explode(',', $_REQUEST['UIDS']);
     G::LoadClass('processes');
     $oProcess = new Processes();
     if (count($ids) > 0) {
         foreach ($ids as $id) {
             $oProcess->changeDebugMode($id);
         }
     }
 }
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 */
try {
    //load the variables
    G::LoadClass('processes');
    $oProcess = new Processes();
    if (!isset($_POST['form']['IMPORT_OPTION'])) {
        throw new Exception('Please select an option before to continue');
    }
    if (!isset($_POST['form']['GROUP_IMPORT_OPTION'])) {
        $action = "none";
    } else {
        $action = $_POST['form']['GROUP_IMPORT_OPTION'];
    }
    $option = $_POST['form']['IMPORT_OPTION'];
    $filename = $_POST['form']['PRO_FILENAME'];
    $ObjUid = $_POST['form']['OBJ_UID'];
    $path = PATH_DOCUMENT . 'input' . PATH_SEP;
    $oData = $oProcess->getProcessData($path . $filename);
    $Fields['PRO_FILENAME'] = $filename;
    $sProUid = $oData->process['PRO_UID'];
Exemplo n.º 25
0
    $oData->process['PRO_UID_OLD'] = $sProUid;
    //print $sProUid;die;
    //if the process exists, we need to ask what kind of re-import the user wants,
    if ($oProcess->processExists($sProUid)) {
        $G_MAIN_MENU = 'processmaker';
        $G_ID_MENU_SELECTED = 'PROCESSES';
        $G_PUBLISH = new Publisher();
        $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'downloadPML_ImportExisting');
        G::RenderPage('publish', 'blank');
        die;
    }
    //creating the process
    $oProcess->createProcessFromData($oData, $localPath . $newfilename);
    //show the info after the imported process
    G::LoadClass('processes');
    $oProcess = new Processes();
    $oProcess->ws_open_public();
    $processData = $oProcess->ws_processGetData($ObjUid);
    $Fields['pro_title'] = $processData->title;
    $Fields['installSteps'] = nl2br($processData->installSteps);
    $Fields['category'] = isset($processData->category) ? $processData->category : '';
    $Fields['version'] = $processData->version;
    $G_MAIN_MENU = 'processmaker';
    $G_ID_MENU_SELECTED = 'PROCESSES';
    $G_PUBLISH = new Publisher();
    $Fields['PRO_UID'] = $sProUid;
    $processmapLink = "processes_Map?PRO_UID={$sProUid}";
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportSucessful', '', $Fields, $processmapLink);
    G::RenderPage('publish', 'blank');
    die;
} catch (Exception $e) {
Exemplo n.º 26
0
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/objectpmView', '', $aFields, '');
     G::RenderPage('publish', 'raw');
     break;
 case 'registerPML':
     $aFields = array();
     $aFields['pro_uid'] = $oData->pro_uid;
     $aFields['link_create_account'] = PML_SERVER;
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/registerPML', '', $aFields, '');
     G::RenderPage('publish', 'raw');
     break;
 case 'loginPML':
     G::LoadClass('processes');
     G::LoadThirdParty('pear/json', 'class.json');
     $oProcesses = new Processes();
     try {
         if ($oProcesses->ws_open($oData->u, $oData->p) == 1) {
             $bExists = true;
         } else {
             $bExists = false;
         }
     } catch (Exception $oException) {
         $bExists = false;
     }
     $oResponse = new stdclass();
     if ($bExists) {
         require_once 'classes/model/Configuration.php';
         $oConfiguration = new Configuration();
         $oConfiguration->create(array('CFG_UID' => 'REGISTER_INFORMATION', 'OBJ_UID' => '', 'CFG_VALUE' => serialize(array('u' => $oData->u, 'p' => $oData->p)), 'PRO_UID' => '', 'USR_UID' => $_SESSION['USER_LOGGED'], 'APP_UID' => ''));
         $oResponse->sLabel = G::LoadTranslation('ID_DOWNLOAD');
        case -2:
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
        default:
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
    }
}
try {
    require_once 'classes/model/ObjectPermission.php';
    $oOP = new ObjectPermission();
    $oOP = ObjectPermissionPeer::retrieveByPK($_GET['OP_UID']);
    $sProcessUID = $oOP->getProUid();
    $oOP->delete();
    $result->success = true;
    $result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
    G::LoadClass('processMap');
    $oProcessMap = new ProcessMap();
    $oProcessMap->getObjectsPermissionsCriteria($sProcessUID);
} catch (Exception $e) {
    $result->success = false;
    $result->msg = $e->getMessage();
}
print G::json_encode($result);
$infoProcess = new Processes();
$resultProcess = $infoProcess->getProcessRow($sProcessUID);
G::auditLog('DeletePermissions', 'Delete Permissions (' . $_GET['OP_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
Exemplo n.º 28
0
    $fields[] = "Hide the case number and the case title in the steps";
}
if (array_key_exists('PRO_SUBPROCESS', $newFields)) {
    $fields[] = "This a sub process";
}
if (array_key_exists('PRO_TRI_DELETED', $newFields)) {
    $fields[] = "Execute a trigger when a case is deleted";
}
if (array_key_exists('PRO_TRI_CANCELED', $newFields)) {
    $fields[] = "Execute a trigger when a case is canceled";
}
if (array_key_exists('PRO_TRI_PAUSED', $newFields)) {
    $fields[] = "Execute a trigger when a case is paused";
}
if (array_key_exists('PRO_TRI_REASSIGNED', $newFields)) {
    $fields[] = "Execute a trigger when a case is reassigned";
}
if (array_key_exists('PRO_TRI_UNPAUSED', $newFields)) {
    $fields[] = "Execute a trigger when a case is unpaused";
}
if (array_key_exists('PRO_TYPE_PROCESS', $newFields)) {
    $fields[] = "Type of process (only owners can edit private processes)";
}
G::auditLog('EditProcess', 'Edit fields (' . implode(', ', $fields) . ') in process "' . $_POST['form']['PRO_TITLE'] . '"');
if (isset($_POST['form']['PRO_UID']) && !empty($_POST['form']['PRO_UID'])) {
    $valuesProcess['PRO_UID'] = $_POST['form']['PRO_UID'];
    $valuesProcess['PRO_UPDATE_DATE'] = date("Y-m-d H:i:s");
    G::LoadClass('processes');
    $infoProcess = new Processes();
    $resultProcess = $infoProcess->updateProcessRow($valuesProcess);
}