BUG 10087 "PM functions y Web Services de ProcessMaker no..." SOLVED
- Problem with the variable $_SESSION
- The variable $_SESSION should not lose the default values ..set
- Added functions to save and restore the values ..of the variable $_SESSION
- Revised class.pmFunctions.php functions and class.wsBase.php
- The QA team should test this functions (most of these functions running
triggers, try running triggers):
PMFAddInputDocument
PMFGenerateOutputDocument
PMFDerivateCase, WSDerivateCase, wsBase::derivateCase
PMFNewCase, WSNewCase, wsBase::newCase
PMFRedirectToStep
PMFDeleteCase, WSDeleteCase, wsBase::deleteCase
PMFCancelCase, WSCancelCase, wsBase::cancelCase
PMFPauseCase, WSPauseCase, wsBase::pauseCase
PMFUnpauseCase, WSUnpauseCase, wsBase::unpauseCase
wsBase::executeTrigger
wsBase::reassignCase
* Available from version 2.0.46
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
class G
|
||||
{
|
||||
public $sessionVar = array(); //SESSION temporary array store.
|
||||
|
||||
/**
|
||||
* is_https
|
||||
* @return void
|
||||
@@ -3130,7 +3132,7 @@ class G
|
||||
} else {
|
||||
$setup['MESS_RAUTH'] = 1;
|
||||
}
|
||||
|
||||
|
||||
if (count($setup) == 0 || !isset($setup['MESS_ENGINE']) || !isset($setup['MESS_SERVER'])
|
||||
|| !isset($setup['MESS_ENABLED']) || !isset($setup['MESS_RAUTH']) || $setup['MESS_SERVER'] == '') {
|
||||
return G::LoadTranslation('ID_EMAIL_ENGINE_IS_NOT_CONFIGURED');
|
||||
@@ -4763,6 +4765,90 @@ class G
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the $_SESSION variables into $sessionVar array, to unset them temporary.
|
||||
*
|
||||
*/
|
||||
public function sessionVarSave()
|
||||
{
|
||||
//Unset any variable
|
||||
$this->sessionVar = array();
|
||||
|
||||
if (isset($_SESSION["APPLICATION"])) {
|
||||
$this->sessionVar["APPLICATION"] = $_SESSION["APPLICATION"];
|
||||
}
|
||||
|
||||
if (isset($_SESSION["INDEX"])) {
|
||||
$this->sessionVar["INDEX"] = $_SESSION["INDEX"];
|
||||
}
|
||||
|
||||
if (isset($_SESSION["PROCESS"])) {
|
||||
$this->sessionVar["PROCESS"] = $_SESSION["PROCESS"];
|
||||
}
|
||||
|
||||
if (isset($_SESSION["TASK"])) {
|
||||
$this->sessionVar["TASK"] = $_SESSION["TASK"];
|
||||
}
|
||||
|
||||
if (isset($_SESSION["USER_LOGGED"])) {
|
||||
$this->sessionVar["USER_LOGGED"] = $_SESSION["USER_LOGGED"];
|
||||
}
|
||||
|
||||
if (isset($_SESSION["USR_USERNAME"])) {
|
||||
$this->sessionVar["USR_USERNAME"] = $_SESSION["USR_USERNAME"];
|
||||
}
|
||||
|
||||
if (isset($_SESSION["STEP_POSITION"])) {
|
||||
$this->sessionVar["STEP_POSITION"] = $_SESSION["STEP_POSITION"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the session variables with values of $sessionVar array, if this is set.
|
||||
*
|
||||
*/
|
||||
public function sessionVarRestore()
|
||||
{
|
||||
if (count($this->sessionVar) > 0) {
|
||||
//Restore original values
|
||||
unset($_SESSION["APPLICATION"]);
|
||||
unset($_SESSION["INDEX"]);
|
||||
unset($_SESSION["PROCESS"]);
|
||||
unset($_SESSION["TASK"]);
|
||||
unset($_SESSION["USER_LOGGED"]);
|
||||
unset($_SESSION["USR_USERNAME"]);
|
||||
unset($_SESSION["STEP_POSITION"]);
|
||||
|
||||
if (isset($this->sessionVar["APPLICATION"])) {
|
||||
$_SESSION["APPLICATION"] = $this->sessionVar["APPLICATION"];
|
||||
}
|
||||
|
||||
if (isset($this->sessionVar["INDEX"])) {
|
||||
$_SESSION["INDEX"] = $this->sessionVar["INDEX"];
|
||||
}
|
||||
|
||||
if (isset($this->sessionVar["PROCESS"])) {
|
||||
$_SESSION["PROCESS"] = $this->sessionVar["PROCESS"];
|
||||
}
|
||||
|
||||
if (isset($this->sessionVar["TASK"])) {
|
||||
$_SESSION["TASK"] = $this->sessionVar["TASK"];
|
||||
}
|
||||
|
||||
if (isset($this->sessionVar["USER_LOGGED"])) {
|
||||
$_SESSION["USER_LOGGED"] = $this->sessionVar["USER_LOGGED"];
|
||||
}
|
||||
|
||||
if (isset($this->sessionVar["USR_USERNAME"])) {
|
||||
$_SESSION["USR_USERNAME"] = $this->sessionVar["USR_USERNAME"];
|
||||
}
|
||||
|
||||
if (isset($this->sessionVar["STEP_POSITION"])) {
|
||||
$_SESSION["STEP_POSITION"] = $this->sessionVar["STEP_POSITION"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1485,6 +1485,16 @@ function PMFAddInputDocument(
|
||||
$file = "path_to_file/myfile.txt"
|
||||
) {
|
||||
G::LoadClass("case");
|
||||
|
||||
$g = new G();
|
||||
|
||||
$g->sessionVarSave();
|
||||
|
||||
$_SESSION["APPLICATION"] = $caseUid;
|
||||
$_SESSION["INDEX"] = $delIndex;
|
||||
$_SESSION["TASK"] = $taskUid;
|
||||
$_SESSION["USER_LOGGED"] = $userUid;
|
||||
|
||||
$case = new Cases();
|
||||
|
||||
$appDocUid = $case->addInputDocument(
|
||||
@@ -1502,6 +1512,8 @@ function PMFAddInputDocument(
|
||||
$file
|
||||
);
|
||||
|
||||
$g->sessionVarRestore();
|
||||
|
||||
return $appDocUid;
|
||||
}
|
||||
|
||||
@@ -1518,14 +1530,26 @@ function PMFAddInputDocument(
|
||||
*/
|
||||
function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = null, $sUserLogged = null)
|
||||
{
|
||||
if (! $sApplication) {
|
||||
$sApplication = $_SESSION['APPLICATION'];
|
||||
$g = new G();
|
||||
|
||||
$g->sessionVarSave();
|
||||
|
||||
if ($sApplication) {
|
||||
$_SESSION["APPLICATION"] = $sApplication;
|
||||
} else {
|
||||
$sApplication = $_SESSION["APPLICATION"];
|
||||
}
|
||||
if (! $index) {
|
||||
$index = $_SESSION['INDEX'];
|
||||
|
||||
if ($index) {
|
||||
$_SESSION["INDEX"] = $index;
|
||||
} else {
|
||||
$index = $_SESSION["INDEX"];
|
||||
}
|
||||
if (! $sUserLogged) {
|
||||
$sUserLogged = $_SESSION['USER_LOGGED'];
|
||||
|
||||
if ($sUserLogged) {
|
||||
$_SESSION["USER_LOGGED"] = $sUserLogged;
|
||||
} else {
|
||||
$sUserLogged = $_SESSION["USER_LOGGED"];
|
||||
}
|
||||
|
||||
G::LoadClass( 'case' );
|
||||
@@ -1688,6 +1712,8 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$g->sessionVarRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2157,7 +2183,15 @@ function PMFgetLabelOption ($PROCESS, $DYNAFORM_UID, $FIELD_NAME, $FIELD_SELECTE
|
||||
*/
|
||||
function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUid)
|
||||
{
|
||||
$iDelegation = intval( $iDelegation );
|
||||
$g = new G();
|
||||
|
||||
$g->sessionVarSave();
|
||||
|
||||
$iDelegation = intval($iDelegation);
|
||||
|
||||
$_SESSION["APPLICATION"] = $sApplicationUID;
|
||||
$_SESSION["INDEX"] = $iDelegation;
|
||||
|
||||
require_once 'classes/model/AppDelegation.php';
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );
|
||||
@@ -2206,10 +2240,15 @@ function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUi
|
||||
$aFields['APP_DATA'] = $oPMScript->aFields;
|
||||
$oCase->updateCase( $sApplicationUID, $aFields );
|
||||
}
|
||||
|
||||
$g->sessionVarRestore();
|
||||
|
||||
G::header( 'Location: ' . 'cases_Step?TYPE=' . $sStepType . '&UID=' . $sStepUid . '&POSITION=' . $oTheStep->getStepPosition() . '&ACTION=' . $sAction );
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$g->sessionVarRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user