BUG 5979 "Cases are overwritten with data from another..." SOlVED
- problem fixed passing the app uid by GET and acomparing with the session data so, if there were differents a message to re-open case will be throw
This commit is contained in:
@@ -23,50 +23,57 @@
|
||||
*
|
||||
*/
|
||||
//validate the data post
|
||||
$oForm = new Form ( $_SESSION ['PROCESS'] . '/' . $_GET ['UID'], PATH_DYNAFORM );
|
||||
$oForm->validatePost ();
|
||||
|
||||
/* Includes */
|
||||
G::LoadClass ( 'case' );
|
||||
try {
|
||||
|
||||
//load the variables
|
||||
$oCase = new Cases ( );
|
||||
$oCase->thisIsTheCurrentUser ( $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['USER_LOGGED'], 'REDIRECT', 'cases_List' );
|
||||
$Fields = $oCase->loadCase ( $_SESSION ['APPLICATION'] );
|
||||
$Fields ['APP_DATA'] = array_merge ( $Fields ['APP_DATA'], G::getSystemConstants () );
|
||||
$Fields ['APP_DATA'] = array_merge ( $Fields ['APP_DATA'], ( array ) $_POST ['form'] );
|
||||
if ($_GET['APP_UID'] !== $_SESSION ['APPLICATION']) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_APPLICATION_ID_MSG', array('<a href=\''.$_SERVER['HTTP_REFERER'].'\'>{1}</a>', G::LoadTranslation('ID_REOPEN'))));
|
||||
}
|
||||
|
||||
#here we must verify if is a debug session
|
||||
$trigger_debug_session = $_SESSION ['TRIGGER_DEBUG'] ['ISSET']; #here we must verify if is a debugg session
|
||||
$oForm = new Form ( $_SESSION ['PROCESS'] . '/' . $_GET ['UID'], PATH_DYNAFORM );
|
||||
$oForm->validatePost ();
|
||||
|
||||
/* Includes */
|
||||
G::LoadClass ( 'case' );
|
||||
|
||||
//load the variables
|
||||
$oCase = new Cases ( );
|
||||
$oCase->thisIsTheCurrentUser ( $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['USER_LOGGED'], 'REDIRECT', 'cases_List' );
|
||||
$Fields = $oCase->loadCase ( $_SESSION ['APPLICATION'] );
|
||||
$Fields ['APP_DATA'] = array_merge ( $Fields ['APP_DATA'], G::getSystemConstants () );
|
||||
$Fields ['APP_DATA'] = array_merge ( $Fields ['APP_DATA'], ( array ) $_POST ['form'] );
|
||||
|
||||
#here we must verify if is a debug session
|
||||
$trigger_debug_session = $_SESSION ['TRIGGER_DEBUG'] ['ISSET']; #here we must verify if is a debugg session
|
||||
|
||||
|
||||
#trigger debug routines...
|
||||
#trigger debug routines...
|
||||
|
||||
|
||||
//cleaning debug variables
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['ERRORS'] = Array ();
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['DATA'] = Array ();
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_NAMES'] = Array ();
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_VALUES'] = Array ();
|
||||
//cleaning debug variables
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['ERRORS'] = Array ();
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['DATA'] = Array ();
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_NAMES'] = Array ();
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_VALUES'] = Array ();
|
||||
|
||||
$triggers = $oCase->loadTriggers ( $_SESSION ['TASK'], 'DYNAFORM', $_GET ['UID'], 'AFTER' );
|
||||
$triggers = $oCase->loadTriggers ( $_SESSION ['TASK'], 'DYNAFORM', $_GET ['UID'], 'AFTER' );
|
||||
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] = count ( $triggers );
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TIME'] = 'AFTER';
|
||||
if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) {
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] = count ( $triggers );
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TIME'] = 'AFTER';
|
||||
if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) {
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_NAMES'] = $oCase->getTriggerNames ( $triggers );
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['TRIGGERS_VALUES'] = $triggers;
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) {
|
||||
if ($_SESSION ['TRIGGER_DEBUG'] ['NUM_TRIGGERS'] != 0) {
|
||||
//Execute after triggers - Start
|
||||
$Fields ['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION ['TASK'], 'DYNAFORM', $_GET ['UID'], 'AFTER', $Fields ['APP_DATA'] );
|
||||
//Execute after triggers - End
|
||||
}
|
||||
}
|
||||
|
||||
//save data in PM Tables if necessary
|
||||
$newValues = array ();
|
||||
foreach ( $_POST ['form'] as $sField => $sAux ) {
|
||||
//save data in PM Tables if necessary
|
||||
$newValues = array ();
|
||||
foreach ( $_POST ['form'] as $sField => $sAux ) {
|
||||
if (isset ( $oForm->fields [$sField]->pmconnection ) && isset ( $oForm->fields [$sField]->pmfield )) {
|
||||
if (($oForm->fields [$sField]->pmconnection != '') && ($oForm->fields [$sField]->pmfield != '')) {
|
||||
if (isset ( $oForm->fields [$oForm->fields [$sField]->pmconnection] )) {
|
||||
@@ -108,12 +115,14 @@ foreach ( $_POST ['form'] as $sField => $sAux ) {
|
||||
} catch ( Exception $oError ) {
|
||||
//Nothing
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
// assembling the field list in order to save the data ina new record of a pm table
|
||||
if (empty($newValues)){
|
||||
$newValues = $aValues;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
foreach ($aValues as $aValueKey=>$aValueCont) {
|
||||
if (trim($newValues[$aValueKey])==''){
|
||||
$newValues[$aValueKey] = $aValueCont;
|
||||
@@ -121,7 +130,6 @@ foreach ( $_POST ['form'] as $sField => $sAux ) {
|
||||
}
|
||||
}
|
||||
//$oAdditionalTables->saveDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aValues );
|
||||
|
||||
} catch ( Exception $oError ) {
|
||||
//Nothing
|
||||
}
|
||||
@@ -129,34 +137,32 @@ foreach ( $_POST ['form'] as $sField => $sAux ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// saving the data ina pm table in case that is a new record
|
||||
if (!empty($newValues)){
|
||||
}
|
||||
// saving the data ina pm table in case that is a new record
|
||||
if (!empty($newValues)){
|
||||
if(!$oAdditionalTables->saveDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $newValues))
|
||||
$oAdditionalTables->updateDataInTable( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $newValues);
|
||||
}
|
||||
//save data
|
||||
$aData = array ();
|
||||
$aData ['APP_NUMBER'] = $Fields ['APP_NUMBER'];
|
||||
$aData ['APP_PROC_STATUS'] = $Fields ['APP_PROC_STATUS'];
|
||||
$aData ['APP_DATA'] = $Fields ['APP_DATA'];
|
||||
$aData ['DEL_INDEX'] = $_SESSION ['INDEX'];
|
||||
$aData ['TAS_UID'] = $_SESSION ['TASK'];
|
||||
$aData ['CURRENT_DYNAFORM'] = $_GET ['UID'];
|
||||
$aData ['USER_UID'] = $_SESSION ['USER_LOGGED'];
|
||||
$aData ['APP_STATUS'] = $Fields ['APP_STATUS'];
|
||||
$aData ['PRO_UID'] = $_SESSION ['PROCESS'];
|
||||
}
|
||||
//save data
|
||||
$aData = array ();
|
||||
$aData ['APP_NUMBER'] = $Fields ['APP_NUMBER'];
|
||||
$aData ['APP_PROC_STATUS'] = $Fields ['APP_PROC_STATUS'];
|
||||
$aData ['APP_DATA'] = $Fields ['APP_DATA'];
|
||||
$aData ['DEL_INDEX'] = $_SESSION ['INDEX'];
|
||||
$aData ['TAS_UID'] = $_SESSION ['TASK'];
|
||||
$aData ['CURRENT_DYNAFORM'] = $_GET ['UID'];
|
||||
$aData ['USER_UID'] = $_SESSION ['USER_LOGGED'];
|
||||
$aData ['APP_STATUS'] = $Fields ['APP_STATUS'];
|
||||
$aData ['PRO_UID'] = $_SESSION ['PROCESS'];
|
||||
|
||||
$oCase->updateCase ( $_SESSION ['APPLICATION'], $aData );
|
||||
//save files
|
||||
require_once 'classes/model/AppDocument.php';
|
||||
if (isset ( $_FILES ['form'] )) {
|
||||
$oCase->updateCase ( $_SESSION ['APPLICATION'], $aData );
|
||||
//save files
|
||||
require_once 'classes/model/AppDocument.php';
|
||||
if (isset ( $_FILES ['form'] )) {
|
||||
foreach ( $_FILES ['form'] ['name'] as $sFieldName => $vValue ) {
|
||||
if ($_FILES ['form'] ['error'] [$sFieldName] == 0) {
|
||||
$oAppDocument = new AppDocument ( );
|
||||
|
||||
|
||||
|
||||
if ( isset ( $_POST ['INPUTS'] [$sFieldName] ) && $_POST ['INPUTS'] [$sFieldName] != '' ) {
|
||||
require_once ('classes/model/AppFolder.php');
|
||||
require_once ('classes/model/InputDocument.php');
|
||||
@@ -184,7 +190,8 @@ if (isset ( $_FILES ['form'] )) {
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$aFields = array (
|
||||
'APP_UID' => $_SESSION ['APPLICATION'],
|
||||
'DEL_INDEX' => $_SESSION ['INDEX'],
|
||||
@@ -220,26 +227,26 @@ if (isset ( $_FILES ['form'] )) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//go to the next step
|
||||
$aNextStep = $oCase->getNextStep ( $_SESSION ['PROCESS'], $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['STEP_POSITION'] );
|
||||
if (isset ( $_GET ['_REFRESH_'] )) {
|
||||
}
|
||||
//go to the next step
|
||||
$aNextStep = $oCase->getNextStep ( $_SESSION ['PROCESS'], $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['STEP_POSITION'] );
|
||||
if (isset ( $_GET ['_REFRESH_'] )) {
|
||||
G::header ( 'location: ' . $_SERVER ['HTTP_REFERER'] );
|
||||
die ();
|
||||
}
|
||||
$_SESSION ['STEP_POSITION'] = $aNextStep ['POSITION'];
|
||||
}
|
||||
$_SESSION ['STEP_POSITION'] = $aNextStep ['POSITION'];
|
||||
|
||||
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep ['PAGE'];
|
||||
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep ['PAGE'];
|
||||
|
||||
if ($trigger_debug_session) {
|
||||
if ($trigger_debug_session) {
|
||||
$_SESSION ['TRIGGER_DEBUG'] ['BREAKPAGE'] = $aNextStep ['PAGE'];
|
||||
$aNextStep ['PAGE'] = $aNextStep ['PAGE'] . '&breakpoint=triggerdebug';
|
||||
}
|
||||
}
|
||||
|
||||
$oForm->validatePost ();
|
||||
$oJSON = new Services_JSON ( );
|
||||
$_POST ['__notValidateThisFields__'] = (isset($_POST ['__notValidateThisFields__']) && $_POST ['__notValidateThisFields__']!='')?$_POST ['__notValidateThisFields__']:$_POST ['DynaformRequiredFields'];
|
||||
if ($missing_req_values = $oForm->validateRequiredFields ( $_POST ['form'], $oJSON->decode ( stripslashes ( $_POST ['__notValidateThisFields__'] ) ) )) {
|
||||
$oForm->validatePost ();
|
||||
$oJSON = new Services_JSON ( );
|
||||
$_POST ['__notValidateThisFields__'] = (isset($_POST ['__notValidateThisFields__']) && $_POST ['__notValidateThisFields__']!='')?$_POST ['__notValidateThisFields__']:$_POST ['DynaformRequiredFields'];
|
||||
if ($missing_req_values = $oForm->validateRequiredFields ( $_POST ['form'], $oJSON->decode ( stripslashes ( $_POST ['__notValidateThisFields__'] ) ) )) {
|
||||
$_POST ['next_step'] = $aNextStep;
|
||||
$_POST ['previous_step'] = $oCase->getPreviousStep ( $_SESSION ['PROCESS'], $_SESSION ['APPLICATION'], $_SESSION ['INDEX'], $_SESSION ['STEP_POSITION'] );
|
||||
$_POST ['req_val'] = $missing_req_values;
|
||||
@@ -247,7 +254,17 @@ if ($missing_req_values = $oForm->validateRequiredFields ( $_POST ['form'], $oJS
|
||||
$G_PUBLISH->AddContent ( 'view', 'cases/missRequiredFields' );
|
||||
G::RenderPage ( 'publish', 'blank' );
|
||||
exit ( 0 );
|
||||
}
|
||||
|
||||
G::header ( 'location: ' . $aNextStep ['PAGE'] );
|
||||
|
||||
}
|
||||
catch(Exception $e) {
|
||||
|
||||
G::header ( 'location: ' . $aNextStep ['PAGE'] );
|
||||
|
||||
$G_PUBLISH = new Publisher;
|
||||
$aMessage = array();
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
G::RenderPage( 'publish', 'blank' );
|
||||
die;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ $uidf=$_GET['UID'];
|
||||
$oDbConnections->loadAdditionalConnections();
|
||||
$_SESSION['CURRENT_DYN_UID'] = $_GET['UID'];
|
||||
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS']. '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS']. '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));
|
||||
break;
|
||||
|
||||
case 'INPUT_DOCUMENT':
|
||||
|
||||
Reference in New Issue
Block a user