This commit is contained in:
Roly Rudy Gutierrez Pinto
2015-10-05 10:04:20 -04:00
parent 0ae464a797
commit 260ae4ee33
4 changed files with 20 additions and 7 deletions

View File

@@ -971,6 +971,11 @@ 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;
@@ -1011,6 +1016,7 @@ class Cases
$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;
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference); $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
$appHistory->insertHistory($aFieldsHistory); $appHistory->insertHistory($aFieldsHistory);
} }

View File

@@ -23,13 +23,10 @@ class pmDynaform
$this->fields = $fields; $this->fields = $fields;
$this->getDynaform(); $this->getDynaform();
$this->getCredentials(); $this->getCredentials();
if (isset($this->fields["APP_UID"])) { if (!isset($this->fields["APP_UID"])) {
//current
$cases = new \ProcessMaker\BusinessModel\Cases();
} else {
//history
$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"]; $this->record["DYN_CONTENT"] = $this->fields["APP_DATA"]["DYN_CONTENT_HISTORY"];
} }
} }

View File

@@ -7,6 +7,15 @@ 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) {
@@ -33,7 +42,7 @@ $(window).load(function () {
var dyn_content_history = document.createElement("input"); var dyn_content_history = document.createElement("input");
dyn_content_history.type = "hidden"; dyn_content_history.type = "hidden";
dyn_content_history.name = "form[DYN_CONTENT_HISTORY]"; dyn_content_history.name = "form[DYN_CONTENT_HISTORY]";
dyn_content_history.value = JSON.stringify(jsondata); 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__";

View File

@@ -858,6 +858,7 @@ class Ajax
$Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_STEP"] = "#"; $Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_STEP"] = "#";
$Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_ACTION"] = "return false;"; $Fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["NEXT_ACTION"] = "return false;";
G::LoadClass('pmDynaform'); G::LoadClass('pmDynaform');
$FieldsPmDynaform = $Fields;
$FieldsPmDynaform["PRO_UID"] = $_SESSION['PROCESS']; $FieldsPmDynaform["PRO_UID"] = $_SESSION['PROCESS'];
$FieldsPmDynaform["CURRENT_DYNAFORM"] = $_REQUEST['DYN_UID']; $FieldsPmDynaform["CURRENT_DYNAFORM"] = $_REQUEST['DYN_UID'];
$a = new pmDynaform($FieldsPmDynaform); $a = new pmDynaform($FieldsPmDynaform);