CRM-21133: Price set error with NULL financial types
authordeb.monish <monish.deb@jmaconsulting.biz>
Tue, 5 Sep 2017 19:28:30 +0000 (00:58 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Wed, 6 Sep 2017 08:06:59 +0000 (13:36 +0530)
CRM/Core/Page/AJAX.php

index 357b54466e7abce077add00cc6c29fc5cf4f656d..63ba1a129e1e905f47b594c3dfef3a1c53ca385a 100644 (file)
@@ -113,8 +113,9 @@ class CRM_Core_Page_AJAX {
         $sql = "UPDATE
           civicrm_price_set cps
           INNER JOIN civicrm_discount cd ON cd.price_set_id = cps.id
-          SET cps.is_quick_config = 0
-          WHERE cd.entity_id = (%1) AND cd.entity_table = 'civicrm_event' ";
+          INNER JOIN civicrm_event ce ON cd.entity_id = ce.id AND cd.entity_table = 'civicrm_event'
+          SET cps.is_quick_config = 0, cps.financial_type_id = IF(cps.financial_type_id IS NULL, ce.financial_type_id, cps.financial_type_id)
+          WHERE cd.entity_id = (%1) ";
         $params = array(1 => array($id, 'Integer'));
         CRM_Core_DAO::executeQuery($sql, $params);
         CRM_Core_BAO_Discount::del($id, $context);