From: Deepak Srivastava Date: Thu, 4 Jul 2013 13:16:30 +0000 (+0530) Subject: CRM-12877, making report-instance thinner X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c5958fbe59bc5d82a1b9056b47fe3b6fc12db8b7;p=civicrm-core.git CRM-12877, making report-instance thinner ---------------------------------------- * CRM-12877: http://issues.civicrm.org/jira/browse/CRM-12877 --- diff --git a/CRM/Report/BAO/ReportInstance.php b/CRM/Report/BAO/ReportInstance.php index 6585e29425..c584778584 100644 --- a/CRM/Report/BAO/ReportInstance.php +++ b/CRM/Report/BAO/ReportInstance.php @@ -106,16 +106,6 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance { // just take it from current url $instance->report_id = CRM_Report_Utils_Report::getValueFromUrl(); } - - // unset params that doesn't match with DB columns, and also not required in form-values for sure - $fields = array( - 'title', 'to_emails', 'cc_emails', 'header', 'footer', - 'qfKey', '_qf_default', 'report_header', 'report_footer', 'grouprole', - ); - foreach ($fields as $field) { - unset($params[$field]); - } - $instance->form_values = serialize($params); $instance->save(); if ($instanceID) { diff --git a/CRM/Report/Form/Instance.php b/CRM/Report/Form/Instance.php index 785be24d63..a768543ce3 100644 --- a/CRM/Report/Form/Instance.php +++ b/CRM/Report/Form/Instance.php @@ -255,6 +255,20 @@ class CRM_Report_Form_Instance { $params['navigation'] = $form->_navigation; } + // make a copy of params + $formValues = $params; + + // unset params from $formValues that doesn't match with DB columns of instance tables, and also not required in form-values for sure + $unsetFields = array( + 'title', 'to_emails', 'cc_emails', 'header', 'footer', + 'qfKey', 'id', '_qf_default', 'report_header', 'report_footer', 'grouprole', + ); + foreach ($unsetFields as $field) { + unset($formValues[$field]); + } + // pass form_values as string + $params['form_values'] = serialize($formValues); + $instance = CRM_Report_BAO_ReportInstance::create($params); $form->set('id', $instance->id);