This commit is contained in:
Roly Rudy Gutierrez Pinto
2015-12-09 18:53:28 -04:00
parent 7d44d27019
commit ad4fc1beab
4 changed files with 15 additions and 22 deletions

View File

@@ -971,11 +971,6 @@ class Cases
public function updateCase($sAppUid, $Fields = array()) public function updateCase($sAppUid, $Fields = array())
{ {
try { try {
$dynContentHistory = "";
if (isset($Fields["APP_DATA"]) && isset($Fields["APP_DATA"]["DYN_CONTENT_HISTORY"])) {
$dynContentHistory = $Fields["APP_DATA"]["DYN_CONTENT_HISTORY"];
unset($Fields["APP_DATA"]["DYN_CONTENT_HISTORY"]);
}
$oApplication = new Application; $oApplication = new Application;
if (!$oApplication->exists($sAppUid)) { if (!$oApplication->exists($sAppUid)) {
return false; return false;
@@ -1012,11 +1007,13 @@ class Cases
} }
} }
if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) { if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) {
$oCurrentDynaform = new Dynaform();
$currentDynaform = $oCurrentDynaform->Load($Fields['CURRENT_DYNAFORM']);
//There are changes //There are changes
$Fields['APP_STATUS'] = (isset($Fields['APP_STATUS'])) ? $Fields['APP_STATUS'] : $FieldsBefore['APP_STATUS']; $Fields['APP_STATUS'] = (isset($Fields['APP_STATUS'])) ? $Fields['APP_STATUS'] : $FieldsBefore['APP_STATUS'];
$appHistory = new AppHistory(); $appHistory = new AppHistory();
$aFieldsHistory = $Fields; $aFieldsHistory = $Fields;
$FieldsDifference['DYN_CONTENT_HISTORY'] = $dynContentHistory; $FieldsDifference['DYN_CONTENT_HISTORY'] = base64_encode($currentDynaform["DYN_CONTENT"]);
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference); $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
$appHistory->insertHistory($aFieldsHistory); $appHistory->insertHistory($aFieldsHistory);
} }

View File

@@ -30,7 +30,10 @@ class pmDynaform
$this->fields["APP_UID"] = null; $this->fields["APP_UID"] = null;
} }
if (isset($this->fields["APP_DATA"]["DYN_CONTENT_HISTORY"])) { if (isset($this->fields["APP_DATA"]["DYN_CONTENT_HISTORY"])) {
$this->record["DYN_CONTENT"] = $this->fields["APP_DATA"]["DYN_CONTENT_HISTORY"]; $decode = base64_decode($this->fields["APP_DATA"]["DYN_CONTENT_HISTORY"], true);
if ($decode !== false) {
$this->record["DYN_CONTENT"] = $decode;
}
} }
} }

View File

@@ -7,15 +7,6 @@ function ajax_post(action, form, method, callback, asynchronous) {
function dynaFormChanged(frm) { function dynaFormChanged(frm) {
return false; return false;
} }
function clearData(data) {
for (var i in data) {
if (data[i] instanceof Array || data[i] instanceof Object)
data[i] = clearData(data[i]);
if (i === "optionsSql")
data[i] = [];
}
return data;
}
$(window).load(function () { $(window).load(function () {
if (pm_run_outside_main_app === 'true') { if (pm_run_outside_main_app === 'true') {
if (parent.showCaseNavigatorPanel) { if (parent.showCaseNavigatorPanel) {
@@ -87,10 +78,6 @@ $(window).load(function () {
token: credentials, token: credentials,
submitRest: false, submitRest: false,
onLoad: function () { onLoad: function () {
var dyn_content_history = document.createElement("input");
dyn_content_history.type = "hidden";
dyn_content_history.name = "form[DYN_CONTENT_HISTORY]";
dyn_content_history.value = JSON.stringify(clearData(jsondata));
var dynaformname = document.createElement("input"); var dynaformname = document.createElement("input");
dynaformname.type = "hidden"; dynaformname.type = "hidden";
dynaformname.name = "__DynaformName__"; dynaformname.name = "__DynaformName__";
@@ -111,7 +98,6 @@ $(window).load(function () {
} }
form.method = "post"; form.method = "post";
form.setAttribute("encType", "multipart/form-data"); form.setAttribute("encType", "multipart/form-data");
form.appendChild(dyn_content_history);
form.appendChild(dynaformname); form.appendChild(dynaformname);
form.appendChild(appuid); form.appendChild(appuid);
form.appendChild(arrayRequired); form.appendChild(arrayRequired);

View File

@@ -1194,10 +1194,17 @@ class DynaForm
while ($rsCriteria->next()) { while ($rsCriteria->next()) {
$row = $rsCriteria->getRow(); $row = $rsCriteria->getRow();
$d = @unserialize($row["HISTORY_DATA"]); $d = @unserialize($row["HISTORY_DATA"]);
$jsonData = "";
if (isset($d["DYN_CONTENT_HISTORY"])) {
$decode = base64_decode($d["DYN_CONTENT_HISTORY"], true);
if ($decode !== false) {
$jsonData = $decode;
}
}
$data[] = array( $data[] = array(
"history_date" => $row["HISTORY_DATE"], "history_date" => $row["HISTORY_DATE"],
"dyn_uid" => $row["DYN_UID"], "dyn_uid" => $row["DYN_UID"],
"dyn_content_history" => isset($d["DYN_CONTENT_HISTORY"]) ? $d["DYN_CONTENT_HISTORY"] : "" "dyn_content_history" => $jsonData
); );
} }
return $data; return $data;