From: Jagadedes Date: Mon, 29 Sep 2014 03:36:53 +0000 (+0530) Subject: #29750 progressbar databse save X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ae309324eebca2c1b57f6e02f50878e297bac60e;p=com.zyxware.civiwci.git #29750 progressbar databse save --- 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');