From bc4c38dbbd48d85aa487639c5d0571ae44475aa4 Mon Sep 17 00:00:00 2001 From: Pravin_s Date: Tue, 10 Dec 2019 11:08:25 +0530 Subject: [PATCH] Task #284 fix: Cluster not getting update in UCM main record --- .../com_tjucm/site/controllers/itemform.json.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/com_tjucm/site/controllers/itemform.json.php b/src/components/com_tjucm/site/controllers/itemform.json.php index ee1cd581..7f2e0337 100644 --- a/src/components/com_tjucm/site/controllers/itemform.json.php +++ b/src/components/com_tjucm/site/controllers/itemform.json.php @@ -280,9 +280,11 @@ public function saveFormData() $formData['fieldsvalue'] = $data; $formData['client'] = $client; $formData['created_by'] = $table->created_by; + $isNew = $table->draft; // If data is valid then save the data into DB $response = $model->saveFieldsData($formData); + $msg = null; if ($response && empty($section)) @@ -296,7 +298,8 @@ public function saveFormData() $msg = ($response) ? Text::_("COM_TJUCM_ITEM_SAVED_SUCCESSFULLY") : Text::_("COM_TJUCM_FORM_SAVE_FAILED"); } - // Disable the draft mode of the item if full f)orm is submitted + // Disable the draft mode of the item if full form is submitted + $table->load($recordId); $table->draft = $draft; $table->modified_date = Factory::getDate()->toSql(); $table->store(); @@ -307,7 +310,7 @@ public function saveFormData() // TJ-ucm plugin trigger after save $dispatcher = JEventDispatcher::getInstance(); PluginHelper::importPlugin("content"); - $dispatcher->trigger('onUcmItemAfterSave', array($table->getProperties(), $data)); + $dispatcher->trigger('onUcmItemAfterSave', array($table->getProperties(), $data, $isNew)); } }