Example #1
0
    /**

     * Process-Files upgrade

     *

     * return void

     */

    public function processFilesUpgrade()

    {

        try {

            if (!defined("PATH_DATA_MAILTEMPLATES")) {

                define("PATH_DATA_MAILTEMPLATES", PATH_DATA_SITE . "mailTemplates" . PATH_SEP);

            }



            if (!defined("PATH_DATA_PUBLIC")) {

                define("PATH_DATA_PUBLIC", PATH_DATA_SITE . "public" . PATH_SEP);

            }



            $this->initPropel(true);



            $filesManager = new \ProcessMaker\BusinessModel\FilesManager();



            $filesManager->processFilesUpgrade();

        } catch (Exception $e) {

            throw $e;

        }

    }
Example #2
0
    public function doImport($generateUid = true)
    {
        $arrayBpmnTables = $this->importData["tables"]["bpmn"];
        $arrayWorkflowTables = $this->importData["tables"]["workflow"];
        $arrayWorkflowFiles = $this->importData["files"]["workflow"];

        //Import BPMN tables
        $result = $this->importBpmnTables($arrayBpmnTables, $generateUid);

        $projectUidOld = $arrayBpmnTables["project"][0]["prj_uid"];
        $projectUid = ($generateUid)? $result[0]["new_uid"] : $result;

        //Import workflow tables
        if ($generateUid) {
            $result[0]["object"]  = "project";
            $result[0]["old_uid"] = $projectUidOld;
            $result[0]["new_uid"] = $projectUid;

            $workflow = new \ProcessMaker\Project\Workflow();

            list($arrayWorkflowTables, $arrayWorkflowFiles) = $workflow->updateDataUidByArrayUid($arrayWorkflowTables, $arrayWorkflowFiles, $result);
        }

        $this->importWfTables($arrayWorkflowTables);

        //Import workflow files
        $this->importWfFiles($arrayWorkflowFiles);

        //Update
        $workflow = \ProcessMaker\Project\Workflow::load($projectUid);

        foreach ($arrayWorkflowTables["tasks"] as $key => $value) {
            $arrayTaskData = $value;

            if (!in_array($arrayTaskData["TAS_TYPE"], array("GATEWAYTOGATEWAY", "WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT", "START-TIMER-EVENT", "INTERMEDIATE-CATCH-TIMER-EVENT", "END-EMAIL-EVENT", "INTERMEDIATE-EMAIL-EVENT"))) {
                $result = $workflow->updateTask($arrayTaskData["TAS_UID"], $arrayTaskData);
            }
        }

        unset($arrayWorkflowTables["process"]["PRO_CREATE_USER"]);
        unset($arrayWorkflowTables["process"]["PRO_CREATE_DATE"]);
        unset($arrayWorkflowTables["process"]["PRO_UPDATE_DATE"]);

        $workflow->update($arrayWorkflowTables["process"]);

        //Process-Files upgrade
        $filesManager = new \ProcessMaker\BusinessModel\FilesManager();

        $filesManager->processFilesUpgrade($projectUid);

        //Return
        return $projectUid;
    }