From e7d8928bce7a02539e10012f96986d2e5da030c1 Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Tue, 25 Nov 2014 10:01:45 +0530 Subject: [PATCH] 31603 progress bar update not clearing widget cache --- CRM/Wci/BAO/WidgetCache.php | 9 +++++++++ CRM/Wci/Form/ProgressBar.php | 1 + 2 files changed, 10 insertions(+) diff --git a/CRM/Wci/BAO/WidgetCache.php b/CRM/Wci/BAO/WidgetCache.php index 12a9dc4..8574368 100644 --- a/CRM/Wci/BAO/WidgetCache.php +++ b/CRM/Wci/BAO/WidgetCache.php @@ -69,4 +69,13 @@ class CRM_Wci_BAO_WidgetCache extends CRM_Wci_DAO_WidgetCache { $dao = CRM_Core_DAO::executeQuery($query, array(1 => array($widgetId, 'Integer')), TRUE, 'CRM_Wci_DAO_WidgetCache'); } + + public static function clearCache($pbId) { + $query = "SELECT wc.widget_id FROM civicrm_wci_widget_cache as wc INNER JOIN civicrm_wci_widget w on w.id = wc.widget_id WHERE w.progress_bar_id =%1"; + $dao = CRM_Core_DAO::executeQuery($query, array(1 => array($pbId, 'Integer')), TRUE, 'CRM_Wci_DAO_WidgetCache'); + if ($dao->fetch()) { + $widget_id = $dao->widget_id; + CRM_Wci_BAO_WidgetCache::deleteWidgetCache($widget_id); + } + } } diff --git a/CRM/Wci/Form/ProgressBar.php b/CRM/Wci/Form/ProgressBar.php index 9480801..866aff1 100644 --- a/CRM/Wci/Form/ProgressBar.php +++ b/CRM/Wci/Form/ProgressBar.php @@ -190,6 +190,7 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { } $transaction->commit(); + CRM_Wci_BAO_WidgetCache::clearCache($this->_id); CRM_Core_Session::setStatus(ts('Progress bar created successfuly'), '', 'success'); CRM_Utils_System::redirect('progress-bar?reset=1'); } -- 2.25.1