Bug 5673, the issue of dependent fields in a dynaform seems to be related to a session loss problem.

This commit is contained in:
Gustavo Adolfo Cruz Laura
2010-12-10 15:37:07 +00:00
parent 554e075158
commit ec8edf4feb
2 changed files with 3 additions and 14 deletions

View File

@@ -50,7 +50,8 @@
} }
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response; if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
// the script responds an ajax request in order to check the dependent fields,
// and generate a json output of the values that the dependent field must have.
$sDynUid = G::getUIDName(urlDecode($_POST['DYN_UID'])); $sDynUid = G::getUIDName(urlDecode($_POST['DYN_UID']));
$json=new Services_JSON(); $json=new Services_JSON();
$formValues=($json->decode($_POST['fields'])); $formValues=($json->decode($_POST['fields']));
@@ -59,13 +60,9 @@ $sMasterField = '';
$sPath = PATH_DYNAFORM; $sPath = PATH_DYNAFORM;
$G_FORM = new form( $sDynUid , $sPath ); $G_FORM = new form( $sDynUid , $sPath );
$aux = array(); $aux = array();
//g::pr($newValues);
$newValues=$json->decode(urlDecode(stripslashes($_POST['form']))); $newValues=$json->decode(urlDecode(stripslashes($_POST['form'])));
//g::pr($formValues);
if (isset($_POST['grid'])) { if (isset($_POST['grid'])) {
// echo ("is grid");
// die();
$_POST['row'] = (int)$_POST['row']; $_POST['row'] = (int)$_POST['row'];
$aAux = array(); $aAux = array();
foreach ($newValues as $sKey => $newValue) { foreach ($newValues as $sKey => $newValue) {
@@ -78,9 +75,6 @@ $newValues=$json->decode(urlDecode(stripslashes($_POST['form'])));
$aValues[$_POST['row']] = array($aKeys[0] => $newValue[$aKeys[0]]); $aValues[$_POST['row']] = array($aKeys[0] => $newValue[$aKeys[0]]);
$newValues[$sKey]->$_POST['grid'] = $aValues; $newValues[$sKey]->$_POST['grid'] = $aValues;
unset($newValues[$sKey]->$aKeys[0]); unset($newValues[$sKey]->$aKeys[0]);
//echo "<pre>";
//echo "</pre>";
} }
} }
@@ -103,9 +97,6 @@ $newValues=$json->decode(urlDecode(stripslashes($_POST['form'])));
$_SESSION[$G_FORM->id][$k] = $v; $_SESSION[$G_FORM->id][$k] = $v;
} }
else { else {
// echo "-$r-";
// g::pr($v);
// echo "--";
foreach($v[$_POST['row']] as $k1 => $v1) { foreach($v[$_POST['row']] as $k1 => $v1) {
$myDependentFields = subDependencies( $k1 , $G_FORM , $aux, $_POST['grid'] ); $myDependentFields = subDependencies( $k1 , $G_FORM , $aux, $_POST['grid'] );
if(!$found){ if(!$found){
@@ -129,6 +120,4 @@ $newValues=$json->decode(urlDecode(stripslashes($_POST['form'])));
break; break;
} }
//echo "one<br>";
?> ?>

View File

@@ -493,7 +493,7 @@ $startingTime = array_sum(explode(' ',microtime()));
and SYS_TARGET != 'autoinstallPlugins' and SYS_TARGET != 'autoinstallPlugins'
and SYS_TARGET != 'heartbeatStatus' and SYS_TARGET != 'heartbeatStatus'
and SYS_COLLECTION != 'services' and SYS_COLLECTION != 'tracker' and $collectionPlugin != 'services' and SYS_COLLECTION != 'services' and SYS_COLLECTION != 'tracker' and $collectionPlugin != 'services'
and $bWE != true and SYS_TARGET != 'defaultAjaxDynaform' and SYS_TARGET != 'cases_ShowDocument') { and $bWE != true and SYS_TARGET != 'defaultAjaxDynaform' and SYS_TARGET != 'dynaforms_checkDependentFields' and SYS_TARGET != 'cases_ShowDocument') {
$bRedirect = true; $bRedirect = true;
if (isset($_GET['sid'])) { if (isset($_GET['sid'])) {
G::LoadClass('sessions'); G::LoadClass('sessions');