/** * Saving the bean data if sent through the engine * @param type $beanData * @codeCoverageIgnore */ public function saveBeanData($beanData) { $fields = $beanData; $bpmInboxId = $fields['flow_id']; $moduleName = $fields['moduleName']; $moduleId = $fields['beanId']; foreach ($beanData as $key => $value) { if (in_array($key, $this->engineFields)) { unset($fields[$key]); } } //modified_by_name => Current if (!isset($moduleName) || $moduleName == '') { $GLOBALS['log']->fatal('moduleName Empty cannot complete the route case'); header('Location: #Home'); } //If Process is Completed break... $bpmI = PMSEEngineUtils::getBPMInboxStatus($bpmInboxId); if ($bpmI === false) { header('Location: #pmse_Inbox/$bpmInboxId/layout/no-show-case/$bpmFlowId'); die; } $beanObject = BeanFactory::getBean($moduleName, $moduleId); $historyData = new PMSEHistoryData($moduleName); foreach ($fields as $key => $value) { $historyData->lock(!array_key_exists($key, $beanObject->fetched_row)); if (isset($beanObject->{$key})) { $historyData->verifyRepeated($beanObject->{$key}, $value); $historyData->savePredata($key, $beanObject->{$key}); $beanObject->{$key} = $value; $historyData->savePostdata($key, $value); } } //If a module includes custom save/editview logic in Save.php, use that instead of a direct save. if (isModuleBWC($beanObject->module_dir) && SugarAutoLoader::fileExists("modules/{$beanObject->module_dir}/Save.php")) { global $disable_redirects; $disable_redirects = true; $_REQUEST['record'] = $beanObject->id; include "modules/{$beanObject->module_dir}/Save.php"; $disable_redirects = false; } else { $beanObject->save(); } $fields['log_data'] = $historyData->getLog(); $this->caseFlowHandler->saveFormAction($fields); }