This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-03-08 09:56:08 -04:00
parent 099d056cd0
commit 2e79581a30
6 changed files with 89 additions and 75 deletions

View File

@@ -233,8 +233,8 @@ try {
define('DB_PASS', $DB_PASS); define('DB_PASS', $DB_PASS);
} }
if (!defined('SYS_SKIN')) { if (!defined('SYS_SKIN')) {
$conf = new Configurations(); $config = System::getSystemConfiguration();
define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', '')); define('SYS_SKIN', $config['default_skin']);
} }
$dateSystem = date('Y-m-d H:i:s'); $dateSystem = date('Y-m-d H:i:s');

View File

@@ -1325,16 +1325,16 @@ function run_clear_dyn_content_history_data($args, $opts)
* @param array $opts * @param array $opts
* *
* @return void * @return void
* @see workflow/engine/bin/tasks/cliWorkspaces.php CLI::taskRun()
*/ */
function run_sync_forms_with_info_from_input_documents($args, $opts) { function run_sync_forms_with_info_from_input_documents($args, $opts) {
if (count($args) === 1) { if (count($args) === 1) {
//This variable is not defined and does not involve its value in this //This variable is not defined and does not involve its value in this
//task, it is removed at the end of the method. //task, it is removed at the end of the method.
$_SERVER['REQUEST_URI'] = ''; $_SERVER['REQUEST_URI'] = '';
if (!defined('SYS_SKIN')) { if (!defined('SYS_SKIN')) {
$conf = new Configurations(); $config = System::getSystemConfiguration();
define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', '')); define('SYS_SKIN', $config['default_skin']);
} }
CLI::logging('Sync JSON definition of the Forms with Input Documents information from workspace: ' . pakeColor::colorize($args[0], 'INFO') . "\n"); CLI::logging('Sync JSON definition of the Forms with Input Documents information from workspace: ' . pakeColor::colorize($args[0], 'INFO') . "\n");
$workspaceTools = new WorkspaceTools($args[0]); $workspaceTools = new WorkspaceTools($args[0]);

View File

@@ -2,13 +2,14 @@
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use ProcessMaker\BusinessModel\Process as BmProcess;
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
use ProcessMaker\BusinessModel\Process as BmProcess;
use ProcessMaker\Core\Installer; use ProcessMaker\Core\Installer;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Plugins\Adapters\PluginAdapter; use ProcessMaker\Plugins\Adapters\PluginAdapter;
use ProcessMaker\Project\Adapter\BpmnWorkflow;
use ProcessMaker\Util\FixReferencePath; use ProcessMaker\Util\FixReferencePath;
/** /**
@@ -3739,53 +3740,62 @@ class WorkspaceTools
CLI::logging("|--> Clean data in table " . OauthRefreshTokensPeer::TABLE_NAME . " rows " . $refreshToken . "\n"); CLI::logging("|--> Clean data in table " . OauthRefreshTokensPeer::TABLE_NAME . " rows " . $refreshToken . "\n");
} }
/**
* Migrate the Intermediate throw Email Event to Dummy task, specify the workspaces.
* The processes in this workspace will be updated.
*
* @param string $workspaceName
* @see workflow/engine/bin/tasks/cliWorkspaces.php::run_migrate_itee_to_dummytask()
* @see workflow/engine/classes/WorkspaceTools.php->upgradeDatabase()
* @link https://wiki.processmaker.com/3.3/processmaker_command#migrate-itee-to-dummytask
*/
public function migrateIteeToDummytask($workspaceName) public function migrateIteeToDummytask($workspaceName)
{ {
$this->initPropel(true); $this->initPropel(true);
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspaceName); $config = System::getSystemConfiguration('', '', $workspaceName);
$conf = new Configurations(); G::$sysSys = $workspaceName;
\G::$sysSys = $workspaceName; G::$pathDataSite = PATH_DATA . "sites" . PATH_SEP . G::$sysSys . PATH_SEP;
\G::$pathDataSite = PATH_DATA . "sites" . PATH_SEP . \G::$sysSys . PATH_SEP; G::$pathDocument = PATH_DATA . 'sites' . DIRECTORY_SEPARATOR . $workspaceName . DIRECTORY_SEPARATOR . 'files';
\G::$pathDocument = PATH_DATA . 'sites' . DIRECTORY_SEPARATOR . $workspaceName . DIRECTORY_SEPARATOR . 'files'; G::$memcachedEnabled = $config['memcached'];
\G::$memcachedEnabled = $arraySystemConfiguration['memcached']; G::$pathDataPublic = G::$pathDataSite . "public" . PATH_SEP;
\G::$pathDataPublic = \G::$pathDataSite . "public" . PATH_SEP; G::$sysSkin = $config['default_skin'];
\G::$sysSkin = $conf->getConfiguration('SKIN_CRON', ''); if (is_file(G::$pathDataSite . PATH_SEP . ".server_info")) {
if (is_file(\G::$pathDataSite . PATH_SEP . ".server_info")) { $serverInfo = file_get_contents(G::$pathDataSite . PATH_SEP . ".server_info");
$serverInfo = file_get_contents(\G::$pathDataSite . PATH_SEP . ".server_info");
$serverInfo = unserialize($serverInfo); $serverInfo = unserialize($serverInfo);
$envHost = $serverInfo["SERVER_NAME"]; $envHost = $serverInfo["SERVER_NAME"];
$envPort = ($serverInfo["SERVER_PORT"] . "" != "80") ? ":" . $serverInfo["SERVER_PORT"] : ""; $envPort = ($serverInfo["SERVER_PORT"] . "" != "80") ? ":" . $serverInfo["SERVER_PORT"] : "";
if (!empty($envPort) && strpos($envHost, $envPort) === false) { if (!empty($envPort) && strpos($envHost, $envPort) === false) {
$envHost = $envHost . $envPort; $envHost = $envHost . $envPort;
} }
\G::$httpHost = $envHost; G::$httpHost = $envHost;
} }
//Search All process //Search All process
$oCriteria = new Criteria("workflow"); $criteria = new Criteria("workflow");
$oCriteria->addSelectColumn(ProcessPeer::PRO_UID); $criteria->addSelectColumn(ProcessPeer::PRO_UID);
$oCriteria->addSelectColumn(ProcessPeer::PRO_ITEE); $criteria->addSelectColumn(ProcessPeer::PRO_ITEE);
$oCriteria->add(ProcessPeer::PRO_ITEE, '0', Criteria::EQUAL); $criteria->add(ProcessPeer::PRO_ITEE, '0', Criteria::EQUAL);
$rsCriteria = ProcessPeer::doSelectRS($oCriteria); $resultSet = ProcessPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $resultSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$message = "-> Migrating the Intermediate Email Event \n"; $message = "-> Migrating the Intermediate Email Event \n";
CLI::logging($message); CLI::logging($message);
while ($rsCriteria->next()) { while ($resultSet->next()) {
$row = $rsCriteria->getRow(); $row = $resultSet->getRow();
$prj_uid = $row['PRO_UID']; $prjUid = $row['PRO_UID'];
$bpmnProcess = new Process(); $process = new Process();
if ($bpmnProcess->isBpmnProcess($prj_uid)) { if ($process->isBpmnProcess($prjUid)) {
$project = new \ProcessMaker\Project\Adapter\BpmnWorkflow(); $project = new BpmnWorkflow();
$diagram = $project->getStruct($prj_uid); $diagram = $project->getStruct($prjUid);
$res = $project->updateFromStruct($prj_uid, $diagram); $project->updateFromStruct($prjUid, $diagram);
$bpmnProcess->setProUid($prj_uid); $process->setProUid($prjUid);
$oProcess = new Process(); $updateProcess = new Process();
$aProcess['PRO_UID'] = $prj_uid; $updateProcessData = [];
$aProcess['PRO_ITEE'] = '1'; $updateProcessData['PRO_UID'] = $prjUid;
if ($oProcess->processExists($prj_uid)) { $updateProcessData['PRO_ITEE'] = '1';
$oProcess->update($aProcess); if ($updateProcess->processExists($prjUid)) {
$updateProcess->update($updateProcessData);
} }
$message = " Process updated " . $bpmnProcess->getProTitle() . "\n"; $message = " Process updated " . $process->getProTitle() . "\n";
CLI::logging($message); CLI::logging($message);
} }
} }

View File

@@ -28,11 +28,11 @@
// //
// License: LGPL, see LICENSE // License: LGPL, see LICENSE
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Util\ElementTranslation; use ProcessMaker\Util\ElementTranslation;
/** /**
* ProcessMaker has made a number of its PHP functions available be used in triggers and conditions. * ProcessMaker has made a number of its PHP functions available be used in triggers and conditions.
* Most of these functions are wrappers for internal functions used in Gulliver, which is the development framework * Most of these functions are wrappers for internal functions used in Gulliver, which is the development framework
@@ -3470,38 +3470,26 @@ function PMFGetNextDerivationInfo($caseUid, $delIndex)
* @param string | $skin = null | Skin | The skin * @param string | $skin = null | Skin | The skin
* *
* @return string | $url | Direct case link | Returns the direct case link, FALSE otherwise * @return string | $url | Direct case link | Returns the direct case link, FALSE otherwise
* @link https://wiki.processmaker.com/3.2/Direct_Case_Link
*/ */
function PMFCaseLink($caseUid, $workspace = null, $language = null, $skin = null) function PMFCaseLink($caseUid, $workspace = null, $language = null, $skin = null)
{ {
try { try {
$case = new \ProcessMaker\BusinessModel\Cases(); $case = new BusinessModelCases();
$arrayApplicationData = $case->getApplicationRecordByPk($caseUid, [], false); $arrayApplicationData = $case->getApplicationRecordByPk($caseUid, [], false);
if ($arrayApplicationData === false) { if ($arrayApplicationData === false) {
return false; return false;
} }
$conf = new Configurations();
$envSkin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', ''); $workspace = !empty($workspace) ? $workspace : config("system.workspace");
$workspace = (!empty($workspace)) ? $workspace : config("system.workspace"); $language = !empty($language) ? $language : SYS_LANG;
$language = (!empty($language)) ? $language : SYS_LANG; if (empty($skin)) {
$skin = (!empty($skin)) ? $skin : $envSkin; $config = System::getSystemConfiguration();
$skin = defined("SYS_SKIN") ? SYS_SKIN : $config['default_skin'];
}
$uri = '/sys' . $workspace . '/' . $language . '/' . $skin . '/cases/opencase/' . $caseUid; $uri = '/sys' . $workspace . '/' . $language . '/' . $skin . '/cases/opencase/' . $caseUid;
$link = System::getServerProtocolHost() . $uri;
$envHost = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : SERVER_NAME;
$envProtocol = defined("REQUEST_SCHEME") && REQUEST_SCHEME === "https";
if (isset($_SERVER['SERVER_PORT'])) {
$envPort = ($_SERVER['SERVER_PORT'] != "80") ? ":" . $_SERVER['SERVER_PORT'] : "";
} else if (defined('SERVER_PORT')) {
$envPort = (SERVER_PORT . "" != "80") ? ":" . SERVER_PORT : "";
} else {
$envPort = "";
}
if (!empty($envPort) && strpos($envHost, $envPort) === false) {
$envHost = $envHost . $envPort;
}
$link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . $uri;
return $link; return $link;
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;

View File

@@ -1597,11 +1597,25 @@ class System
* Get server main path (protocol + host + port + workspace + lang + skin). * Get server main path (protocol + host + port + workspace + lang + skin).
* *
* @return string * @return string
* @see ProcessMaker\BusinessModel\ProjectUser->projectWsUserCanStartTask()
* @see ProcessMaker\BusinessModel\ProjectUser->userLogin()
* @see ProcessMaker\BusinessModel\WebEntry->getWebEntryDataFromRecord()
* @see ProcessMaker\BusinessModel\WebEntryEvent->getGeneratedLink()
* @see ProcessMaker\Core\System\ActionsByEmailCoreClass->sendActionsByEmail()
* @see ProcessMaker\Core\System\webEntryProxy->checkCredentials()
* @see ProcessMaker\Core\System\webEntryProxy->save()
* @see workflow/engine/classes/ProcessMap.php ProcessMap->listNewWebEntry()
* @see workflow/engine/classes/ProcessMap.php ProcessMap->webEntry()
* @see workflow/engine/controllers/caseSchedulerProxy.php caseSchedulerProxy->checkCredentials()
* @see workflow/engine/methods/cases/cases_SchedulerValidateUser.php
* @see workflow/engine/methods/processes/processes_webEntryGenerate.php
* @see workflow/engine/methods/processes/processes_webEntryValidate.php
* @see workflow/engine/methods/processes/webEntry_Val_Assig.php
*/ */
public static function getServerMainPath() public static function getServerMainPath()
{ {
$conf = new Configurations(); $config = self::getSystemConfiguration();
$skin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', ''); $skin = defined("SYS_SKIN") ? SYS_SKIN : $config['default_skin'];
return self::getServerProtocolHost() . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . $skin; return self::getServerProtocolHost() . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . $skin;
} }

View File

@@ -2,17 +2,18 @@
namespace ProcessMaker\Util; namespace ProcessMaker\Util;
use Configurations;
use Criteria;
use ResultSet;
use FieldsPeer;
use ReportTablePeer;
use CaseConsolidatedCorePeer;
use ConsolidatedCases;
use AdditionalTablesPeer;
use PmTable;
use ReportVarPeer;
use AdditionalTables; use AdditionalTables;
use AdditionalTablesPeer;
use CaseConsolidatedCorePeer;
use Configurations;
use ConsolidatedCases;
use Criteria;
use FieldsPeer;
use PmTable;
use ProcessMaker\Core\System;
use ReportTablePeer;
use ReportVarPeer;
use ResultSet;
use stdClass; use stdClass;
/** /**
@@ -73,6 +74,7 @@ class FixReferencePath
* @param string $directory * @param string $directory
* @param string $pathData * @param string $pathData
* @return void * @return void
* @see workflow/engine/classes/WorkspaceTools.php WorkspaceTools->fixReferencePathFiles()
*/ */
public function runProcess($directory, $pathData) public function runProcess($directory, $pathData)
{ {
@@ -81,8 +83,8 @@ class FixReferencePath
//task, it is removed at the end of the method. //task, it is removed at the end of the method.
$_SERVER["REQUEST_URI"] = ""; $_SERVER["REQUEST_URI"] = "";
if (!defined("SYS_SKIN")) { if (!defined("SYS_SKIN")) {
$conf = new Configurations(); $config = System::getSystemConfiguration();
define("SYS_SKIN", $conf->getConfiguration('SKIN_CRON', '')); define("SYS_SKIN", $config['default_skin']);
} }
$criteria = new Criteria("workflow"); $criteria = new Criteria("workflow");