From ae309324eebca2c1b57f6e02f50878e297bac60e Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Mon, 29 Sep 2014 09:06:53 +0530 Subject: [PATCH] #29750 progressbar databse save --- CRM/Wci/Form/ProgressBar.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CRM/Wci/Form/ProgressBar.php b/CRM/Wci/Form/ProgressBar.php index e3a7275..0992e9e 100644 --- a/CRM/Wci/Form/ProgressBar.php +++ b/CRM/Wci/Form/ProgressBar.php @@ -71,9 +71,10 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { $sql = "INSERT INTO civicrm_wci_progress_bar (name, starting_amount, goal_amount) VALUES ('" . $_REQUEST['progressbar_name'] . "','" . $_REQUEST['starting_amount'] . "','" . $_REQUEST['goal_amount'] . "')"; - - CRM_Core_DAO::executeQuery($sql); + $errorScope = CRM_Core_TemporaryErrorScope::useException(); try { + $transaction = new CRM_Core_Transaction(); + CRM_Core_DAO::executeQuery($sql); $progressbar_id = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()'); for($i = 1; $i <= (int)$_REQUEST['contrib_count']; $i++): $page = 'contribution_page_' . (string)$i; @@ -87,7 +88,8 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { } catch (Exception $e) { //TODO - print_r($e); + print_r($e->getMessage()); + $transaction->rollback(); } parent::postProcess(); $elem = $this->getElement('contrib_count'); -- 2.25.1