Merged in gproly/processmaker/PM-4409 (pull request #3354)

PM-4409
This commit is contained in:
Julio Cesar Laura Avendaño
2015-12-10 11:05:30 -04:00
4 changed files with 15 additions and 22 deletions

View File

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

View File

@@ -30,7 +30,10 @@ class pmDynaform
$this->fields["APP_UID"] = null;
}
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) {
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 () {
if (pm_run_outside_main_app === 'true') {
if (parent.showCaseNavigatorPanel) {
@@ -87,10 +78,6 @@ $(window).load(function () {
token: credentials,
submitRest: false,
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");
dynaformname.type = "hidden";
dynaformname.name = "__DynaformName__";
@@ -111,7 +98,6 @@ $(window).load(function () {
}
form.method = "post";
form.setAttribute("encType", "multipart/form-data");
form.appendChild(dyn_content_history);
form.appendChild(dynaformname);
form.appendChild(appuid);
form.appendChild(arrayRequired);

View File

@@ -1194,10 +1194,17 @@ class DynaForm
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$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(
"history_date" => $row["HISTORY_DATE"],
"dyn_uid" => $row["DYN_UID"],
"dyn_content_history" => isset($d["DYN_CONTENT_HISTORY"]) ? $d["DYN_CONTENT_HISTORY"] : ""
"dyn_content_history" => $jsonData
);
}
return $data;