From: monishdeb Date: Thu, 11 Sep 2014 14:39:51 +0000 (+0530) Subject: CRM-15276 fixes - DB Syntax Error on saving new mailing component with checked is_default X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0e994f087f8576a66133081aca31a9180e276195;p=civicrm-core.git CRM-15276 fixes - DB Syntax Error on saving new mailing component with checked is_default https://issues.civicrm.org/jira/browse/CRM-15276 --- diff --git a/CRM/Mailing/BAO/Component.php b/CRM/Mailing/BAO/Component.php index 2c23cdf5d5..55dd8b35fb 100644 --- a/CRM/Mailing/BAO/Component.php +++ b/CRM/Mailing/BAO/Component.php @@ -98,7 +98,7 @@ class CRM_Mailing_BAO_Component extends CRM_Mailing_DAO_Component { $component->body_text = CRM_Utils_String::htmlToText(CRM_Utils_Array::value('body_html', $params)); } - if ($component->is_default) { + if ($component->is_default && !empty($id)) { CRM_Core_DAO::executeQuery("UPDATE civicrm_mailing_component SET is_default = 0 WHERE component_type ='{$component->component_type}' AND id <> $id"); }