Merged in release/3.3 (pull request #6629)
HOR-4880: Update release/3.3.1 with release/3.3
This commit is contained in:
@@ -30,6 +30,7 @@ return array(
|
||||
'dynaformEditor' => DynaformEditor::class,
|
||||
'dynaformEditorAjax' => DynaformEditorAjax::class,
|
||||
'DynaFormField' => DynaFormField::class,
|
||||
'dynaformHandler' => DynaformHandler::class,
|
||||
'enterpriseClass' => EnterpriseClass::class,
|
||||
'EnterpriseUtils' => EnterpriseUtils::class,
|
||||
'featuresDetail' => FeaturesDetail::class,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\AppEvent;
|
||||
|
||||
/**
|
||||
* Class xmlformTemplate
|
||||
*
|
||||
@@ -350,6 +353,10 @@ class xmlformTemplate extends Smarty
|
||||
//(with the method "printTemplate") and painting takes less than 1 second
|
||||
//so the new template resource generally will had the same timestamp.
|
||||
$output = $this->fetch ( 'mem:defaultTemplate' . $form->name );
|
||||
$output = AppEvent::getAppEvent()
|
||||
->setHtml($output)
|
||||
->dispatch(AppEvent::XMLFORM_RENDER, $form)
|
||||
->getHtml();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,11 @@ require_once __DIR__ . '/../../../bootstrap/app.php';
|
||||
// php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000]
|
||||
// var_dump($argv);
|
||||
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
|
||||
use Illuminate\Foundation\Http\Kernel;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
app()->make(Kernel::class)->bootstrap();
|
||||
|
||||
$commandLineSyntaxMsg = "Invalid command line arguments: \n " .
|
||||
"syntax: ".
|
||||
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone|deleteindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" .
|
||||
@@ -127,6 +130,8 @@ print "PATH_HOME: " . PATH_HOME . "\n";
|
||||
print "PATH_DB: " . PATH_DB . "\n";
|
||||
print "PATH_CORE: " . PATH_CORE . "\n";
|
||||
|
||||
app()->useStoragePath(realpath(PATH_DATA));
|
||||
|
||||
// define the site name (instance name)
|
||||
if (empty(config("system.workspace"))) {
|
||||
$sObject = $workspaceName;
|
||||
|
||||
@@ -380,44 +380,56 @@ class Cases
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function isSelfService($USR_UID, $TAS_UID, $APP_UID = '')
|
||||
/**
|
||||
* Checks if at least one of the user’s tasks is self-service
|
||||
*
|
||||
* @param string $usrUid
|
||||
* @param string $tasUid
|
||||
* @param string $appUid
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSelfService($usrUid, $tasUid, $appUid = '')
|
||||
{
|
||||
$tasks = $this->getSelfServiceTasks($USR_UID);
|
||||
|
||||
foreach ($tasks as $key => $val) {
|
||||
if ($TAS_UID === $val['uid']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($APP_UID)) {
|
||||
$task = new Task();
|
||||
$arrayTaskData = $task->load($TAS_UID);
|
||||
|
||||
$taskGroupVariable = trim($arrayTaskData['TAS_GROUP_VARIABLE'], ' @#');
|
||||
|
||||
$caseData = $this->loadCase($APP_UID);
|
||||
|
||||
if (isset($caseData['APP_DATA'][$taskGroupVariable])) {
|
||||
$dataVariable = $caseData['APP_DATA'][$taskGroupVariable];
|
||||
|
||||
if (empty($dataVariable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dataVariable = is_array($dataVariable)? $dataVariable : (array)trim($dataVariable);
|
||||
|
||||
if (in_array($USR_UID, $dataVariable, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$groups = new Groups();
|
||||
foreach ($groups->getActiveGroupsForAnUser($USR_UID) as $key => $group) {
|
||||
if (in_array($group, $dataVariable, true)) {
|
||||
$selfServiceVariable = Task::getVariableUsedInSelfService($tasUid);
|
||||
switch ($selfServiceVariable){
|
||||
case Task::TASK_ASSIGN_TYPE_NO_SELF_SERVICE:
|
||||
return false;
|
||||
break;
|
||||
case Task::SELF_SERVICE_WITHOUT_VARIABLE:
|
||||
$tasks = $this->getSelfServiceTasks($usrUid);
|
||||
foreach ($tasks as $key => $val) {
|
||||
if ($tasUid === $val['uid']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
break;
|
||||
default://When is "Self Service Value Based Assignment"
|
||||
if (!empty($appUid)) {
|
||||
//If is Self service Value Based we will be get the value of variable defined in $selfServiceType
|
||||
$selfServiceType = trim($selfServiceVariable, ' @#');
|
||||
$caseData = $this->loadCase($appUid);
|
||||
if (isset($caseData['APP_DATA'][$selfServiceType])) {
|
||||
$dataVariable = $caseData['APP_DATA'][$selfServiceType];
|
||||
if (empty($dataVariable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dataVariable = is_array($dataVariable) ? $dataVariable : (array)trim($dataVariable);
|
||||
if (in_array($usrUid, $dataVariable, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$groups = new Groups();
|
||||
foreach ($groups->getActiveGroupsForAnUser($usrUid) as $key => $group) {
|
||||
if (in_array($group, $dataVariable, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -2767,27 +2767,26 @@ function PMFDeleteCase ($caseUid)
|
||||
* @return int | $result | Result of the cancelation | Returns 1 if the case is cancel successfully; otherwise, returns 0 if an error occurred.
|
||||
*
|
||||
*/
|
||||
function PMFCancelCase ($caseUid, $delIndex = null, $userUid = null)
|
||||
function PMFCancelCase($caseUid, $delIndex = null, $userUid = null)
|
||||
{
|
||||
$ws = new WsBase();
|
||||
$result = $ws->cancelCase($caseUid, $delIndex, $userUid);
|
||||
$result = (object)$result;
|
||||
|
||||
$sessionAppUid = $_SESSION['APPLICATION'];
|
||||
if ($result->status_code == 0) {
|
||||
if (isset($_SESSION['APPLICATION']) && isset($_SESSION['INDEX'])) {
|
||||
if ($_SESSION['APPLICATION'] == $caseUid && $_SESSION['INDEX'] == $delIndex) {
|
||||
if (!defined('WEB_SERVICE_VERSION')) {
|
||||
G::header('Location: ../cases/casesListExtJsRedirector');
|
||||
die();
|
||||
} else {
|
||||
die(
|
||||
G::LoadTranslation(
|
||||
//It was cancelled the same case in the execution
|
||||
if ($sessionAppUid === $caseUid) {
|
||||
if (!defined('WEB_SERVICE_VERSION')) {
|
||||
G::header('Location: ../cases/casesListExtJsRedirector');
|
||||
die;
|
||||
} else {
|
||||
die(
|
||||
G::LoadTranslation(
|
||||
'ID_PM_FUNCTION_CHANGE_CASE',
|
||||
SYS_LANG,
|
||||
['PMFCancelCase', G::LoadTranslation('ID_CANCELLED')]
|
||||
)
|
||||
);
|
||||
}
|
||||
['PMFCancelCase', G::LoadTranslation('ID_CANCELLED')]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
*/
|
||||
class Task extends BaseTask
|
||||
{
|
||||
const TASK_ASSIGN_TYPE_NO_SELF_SERVICE = null;
|
||||
const TASK_ASSIGN_TYPE_SELF_SERVICE = 'SELF_SERVICE';
|
||||
const SELF_SERVICE_WITHOUT_VARIABLE = 'YES';
|
||||
|
||||
const tas_type_events = [
|
||||
'INTERMEDIATE-THROW-MESSAGE-EVENT',
|
||||
'INTERMEDIATE-THROW-EMAIL-EVENT',
|
||||
@@ -845,6 +849,38 @@ class Task extends BaseTask
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Review if the task is "Self Service"
|
||||
* If the task is not self service, the function returns null
|
||||
* If the task is self service, the function returns the self service variable
|
||||
*
|
||||
* @param string $tasUid
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getVariableUsedInSelfService($tasUid)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(TaskPeer::TAS_UID, $tasUid);
|
||||
$task = TaskPeer::doSelectOne($criteria);
|
||||
if (!is_null($task)) {
|
||||
//Review if is "Self Service"
|
||||
if ($task->getTasAssignType() === self::TASK_ASSIGN_TYPE_SELF_SERVICE) {
|
||||
$variableInSelfService = $task->getTasGroupVariable();
|
||||
//Review if is "Self Service Value Based Assignment"
|
||||
if (empty($variableInSelfService)) {
|
||||
return self::SELF_SERVICE_WITHOUT_VARIABLE;
|
||||
} else {
|
||||
return $variableInSelfService;
|
||||
}
|
||||
} else {
|
||||
self::TASK_ASSIGN_TYPE_NO_SELF_SERVICE;
|
||||
}
|
||||
} else {
|
||||
self::TASK_ASSIGN_TYPE_NO_SELF_SERVICE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8585,6 +8585,12 @@ msgstr "Full Text Search"
|
||||
msgid "@function() It evaluates the value, then executes a PHP function"
|
||||
msgstr "@function() It evaluates the value, then executes a PHP function"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_G_SUITE_CONFIGURATION_SAVED
|
||||
#: LABEL/ID_G_SUITE_CONFIGURATION_SAVED
|
||||
msgid "G Suite Configuration Saved"
|
||||
msgstr "G Suite Configuration Saved"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_GENERAL
|
||||
#: LABEL/ID_GENERAL
|
||||
|
||||
@@ -58256,6 +58256,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_FULL_NAME','en','Full Name','2014-01-15') ,
|
||||
( 'LABEL','ID_FULL_TEXT_SEARCH','en','Full Text Search','2014-01-15') ,
|
||||
( 'LABEL','ID_FUNCTION','en','@function() It evaluates the value, then executes a PHP function','2014-01-15') ,
|
||||
( 'LABEL','ID_G_SUITE_CONFIGURATION_SAVED','en','G Suite Configuration Saved','2018-09-14') ,
|
||||
( 'LABEL','ID_GENERAL','en','General','2014-01-15') ,
|
||||
( 'LABEL','ID_GENERAL_PROCESS_NUMBERS','en','General Process Numbers','2014-01-15') ,
|
||||
( 'LABEL','ID_GENERATE','en','Generate','2014-01-15') ,
|
||||
|
||||
@@ -41,7 +41,7 @@ if ($RBAC->userCanAccess( 'PM_CASES' ) != 1) {
|
||||
}
|
||||
}
|
||||
|
||||
$oCase = new Cases();
|
||||
$caseInstance = new Cases();
|
||||
|
||||
//cleaning the case session data
|
||||
Cases::clearCaseSessionData();
|
||||
@@ -49,8 +49,8 @@ Cases::clearCaseSessionData();
|
||||
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'] );
|
||||
$_GET['APP_UID'] = $caseInstance->getApplicationUIDByNumber( $_GET['APP_NUMBER'] );
|
||||
$_GET['DEL_INDEX'] = $caseInstance->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] );
|
||||
|
||||
//if the application doesn't exist
|
||||
if (is_null($_GET['APP_UID'])) {
|
||||
@@ -65,8 +65,6 @@ try {
|
||||
G::header( 'location: casesListExtJs' );
|
||||
exit();
|
||||
}
|
||||
//wrong implemented, need refactored
|
||||
//$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); ???????
|
||||
}
|
||||
|
||||
$sAppUid = $_GET['APP_UID'];
|
||||
@@ -74,7 +72,7 @@ try {
|
||||
$_action = isset($_GET['action']) ? $_GET['action'] : '';
|
||||
|
||||
//loading application data
|
||||
$aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
|
||||
$aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex );
|
||||
|
||||
if (!isset($_SESSION['CURRENT_TASK'])) {
|
||||
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID'];
|
||||
@@ -149,10 +147,10 @@ try {
|
||||
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID'];
|
||||
|
||||
//if the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume
|
||||
if ($oCase->isSelfService( $_SESSION['USER_LOGGED'], $aFields['TAS_UID'], $sAppUid )) {
|
||||
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php');
|
||||
if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $aFields['TAS_UID'], $sAppUid)) {
|
||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php');
|
||||
} else {
|
||||
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||
}
|
||||
|
||||
exit();
|
||||
@@ -164,8 +162,8 @@ try {
|
||||
$_SESSION['INDEX'] = $iDelIndex;
|
||||
|
||||
if (is_null( $aFields['DEL_INIT_DATE'] )) {
|
||||
$oCase->setDelInitDate( $sAppUid, $iDelIndex );
|
||||
$aFields = $oCase->loadCase( $sAppUid, $iDelIndex );
|
||||
$caseInstance->setDelInitDate( $sAppUid, $iDelIndex );
|
||||
$aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex );
|
||||
}
|
||||
|
||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
||||
@@ -176,10 +174,10 @@ try {
|
||||
unset( $_SESSION['bNoShowSteps'] );
|
||||
|
||||
/* Execute Before Triggers for first Task*/
|
||||
$oCase->getExecuteTriggerProcess($sAppUid, 'OPEN');
|
||||
$caseInstance->getExecuteTriggerProcess($sAppUid, 'OPEN');
|
||||
/*end Execute Before Triggers for first Task*/
|
||||
|
||||
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
$aNextStep = $caseInstance->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
$sPage = $aNextStep['PAGE'];
|
||||
G::header( 'location: ' . $sPage );
|
||||
|
||||
@@ -208,7 +206,7 @@ try {
|
||||
$_SESSION['INDEX'] = $row['DEL_INDEX'];
|
||||
}
|
||||
|
||||
$Fields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
||||
$Fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
||||
|
||||
$_SESSION['CURRENT_TASK'] = $Fields['TAS_UID'];
|
||||
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||
@@ -217,11 +215,11 @@ try {
|
||||
break;
|
||||
default: //APP_STATUS IS COMPLETED OR CANCELLED
|
||||
$_SESSION['APPLICATION'] = $sAppUid;
|
||||
$_SESSION['INDEX'] = $oCase->getCurrentDelegationCase( $_GET['APP_UID'] );
|
||||
$_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase( $_GET['APP_UID'] );
|
||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
||||
$_SESSION['TASK'] = - 1;
|
||||
$_SESSION['STEP_POSITION'] = 0;
|
||||
$Fields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
||||
$Fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
||||
$_SESSION['CURRENT_TASK'] = $Fields['TAS_UID'];
|
||||
|
||||
require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||
|
||||
@@ -37,7 +37,7 @@ class ChangeLog
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $applications = ['Unknow', 'Web', 'Actions by Email', 'Mobile'];
|
||||
protected static $applications = ['Unknow', 'Web Application', 'Action by Email', 'Mobile Application'];
|
||||
|
||||
/**
|
||||
* Identifier for unknow object.
|
||||
|
||||
96
workflow/engine/src/ProcessMaker/Core/AppEvent.php
Normal file
96
workflow/engine/src/ProcessMaker/Core/AppEvent.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Core;
|
||||
|
||||
class AppEvent
|
||||
{
|
||||
/**
|
||||
* Identify XML Form type elements
|
||||
*/
|
||||
const XMLFORM_RENDER = 0;
|
||||
|
||||
/**
|
||||
* Represents the AppEvent object.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private static $appEvent = null;
|
||||
|
||||
/**
|
||||
* List of closure elements.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $callbacks = [];
|
||||
|
||||
/**
|
||||
* Represents the html string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $html = null;
|
||||
|
||||
/**
|
||||
* Get an AppEvent object.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function getAppEvent()
|
||||
{
|
||||
if (self::$appEvent === null) {
|
||||
self::$appEvent = new AppEvent();
|
||||
}
|
||||
return self::$appEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process all closure elements.
|
||||
*
|
||||
* @param int $type
|
||||
* @param object $object
|
||||
* @return $this
|
||||
*/
|
||||
public function dispatch($type, $object)
|
||||
{
|
||||
foreach ($this->callbacks as $callback) {
|
||||
$callback($type, $object, $this);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a closure function.
|
||||
*
|
||||
* @param function $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function addEvent($callback)
|
||||
{
|
||||
if (is_callable($callback)) {
|
||||
$this->callbacks[] = $callback;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get html value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHtml()
|
||||
{
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set html value.
|
||||
*
|
||||
* @param string $html
|
||||
* @return $this
|
||||
*/
|
||||
public function setHtml($html)
|
||||
{
|
||||
$this->html = $html;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1274,7 +1274,7 @@ class Light extends Api
|
||||
|
||||
$url = "http://maps.googleapis.com/maps/api/staticmap?center=" . $latitude . ',' . $longitude . "&format=jpg&size=600x600&zoom=15&markers=color:blue%7Clabel:S%7C" . $latitude . ',' . $longitude;
|
||||
$imageLocation = imagecreatefromjpeg($url);
|
||||
$tmpfname = tempnam("php://temp", "pmm");
|
||||
$tmpfname = tempnam(sys_get_temp_dir(), "pmm");
|
||||
imagejpeg($imageLocation, $tmpfname);
|
||||
|
||||
$_FILES["form"]["type"] = "image/jpeg";
|
||||
|
||||
@@ -4,6 +4,7 @@ use Illuminate\Foundation\Http\Kernel;
|
||||
use Maveriks\WebApplication;
|
||||
use Maveriks\Http\Response;
|
||||
use Maveriks\Pattern\Mvc\PhtmlView;
|
||||
use ProcessMaker\Core\AppEvent;
|
||||
use ProcessMaker\Exception\RBACException;
|
||||
|
||||
// Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used.
|
||||
@@ -11,6 +12,7 @@ require_once __DIR__ . '/../../gulliver/system/class.g.php';
|
||||
require_once __DIR__ . '/../../bootstrap/autoload.php';
|
||||
require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
|
||||
AppEvent::getAppEvent();
|
||||
|
||||
register_shutdown_function(
|
||||
create_function(
|
||||
|
||||
Reference in New Issue
Block a user