From 10119db167e3b7baccb2641c72f9cd703d892ca3 Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Mon, 6 Oct 2014 10:11:23 +0530 Subject: [PATCH] after review comments --- CRM/Wci/DAO/ProgressBarFormula.php | 10 ++++++---- CRM/Wci/Form/ProgressBar.php | 13 ++++++++----- CRM/Wci/Page/ProgressBarList.php | 3 ++- wci.php | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CRM/Wci/DAO/ProgressBarFormula.php b/CRM/Wci/DAO/ProgressBarFormula.php index 56736ad..31298e4 100644 --- a/CRM/Wci/DAO/ProgressBarFormula.php +++ b/CRM/Wci/DAO/ProgressBarFormula.php @@ -123,12 +123,12 @@ class CRM_WCI_DAO_ProgressBarFormula extends CRM_Core_DAO */ static function getReferenceColumns() { - /*if (!self::$_links) { + if (!self::$_links) { self::$_links = array( new CRM_Core_EntityReference(self::getTableName() , 'progress_bar_id', 'civicrm_wci_progress_bar', 'id') , new CRM_Core_EntityReference(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id') , ); - }*/ + } return self::$_links; } /** @@ -225,7 +225,8 @@ class CRM_WCI_DAO_ProgressBarFormula extends CRM_Core_DAO if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { self::$_import['wci_progress_bar_formula'] = & $fields[$name]; - } else { + } + else { self::$_import[$name] = & $fields[$name]; } } @@ -249,7 +250,8 @@ class CRM_WCI_DAO_ProgressBarFormula extends CRM_Core_DAO if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { self::$_export['wci_progress_bar_formula'] = & $fields[$name]; - } else { + } + else { self::$_export[$name] = & $fields[$name]; } } diff --git a/CRM/Wci/Form/ProgressBar.php b/CRM/Wci/Form/ProgressBar.php index 1d337e1..4f6552c 100644 --- a/CRM/Wci/Form/ProgressBar.php +++ b/CRM/Wci/Form/ProgressBar.php @@ -17,7 +17,7 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.wci', 'addmore.js'); parent::preProcess(); } - function fill_data() { + function fillData() { // $_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'REQUEST'); $count = 1; if (isset($this->_id)) { @@ -71,7 +71,8 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { $count++; } $count--; // because last iteration increments it to the next - } else { + } + else { /** New progress bar*/ $this->add( 'select', // field type @@ -125,7 +126,7 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { true // is required );*/ - $this->fill_data(); + $this->fillData(); $this->addElement('link', 'addmore_link',' ', 'addmore', 'Add more'); @@ -162,7 +163,8 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { $sql = "UPDATE civicrm_wci_progress_bar_formula SET contribution_page_id = '". $_REQUEST[$page] . "', percentage = '". $_REQUEST[$perc] . "' WHERE id = " . (int)$_REQUEST['contrib_elem_'.$i]; - } else { + } + else { $sql = "INSERT INTO civicrm_wci_progress_bar_formula (contribution_page_id, progress_bar_id, percentage) VALUES ('" . $_REQUEST[$page] . "','" . $this->_id . "','" . $_REQUEST[$perc] . "')"; } @@ -177,7 +179,8 @@ class CRM_Wci_Form_ProgressBar extends CRM_Core_Form { $transaction->rollback(); } - } else { + } + else { $sql = "INSERT INTO civicrm_wci_progress_bar (name, starting_amount, goal_amount) VALUES ('" . $_REQUEST['progressbar_name'] . "','" . $_REQUEST['starting_amount'] . "','" . $_REQUEST['goal_amount'] . "')"; try { diff --git a/CRM/Wci/Page/ProgressBarList.php b/CRM/Wci/Page/ProgressBarList.php index 513eea2..c225821 100644 --- a/CRM/Wci/Page/ProgressBarList.php +++ b/CRM/Wci/Page/ProgressBarList.php @@ -25,7 +25,8 @@ class CRM_Wci_Page_ProgressBarList extends CRM_Core_Page { $controller->set('id', $id); $controller->process(); return $controller->run(); - } elseif ($action & CRM_Core_Action::DELETE) { + } + elseif ($action & CRM_Core_Action::DELETE) { try { $transaction = new CRM_Core_Transaction(); $sql = "DELETE FROM civicrm_wci_progress_bar_formula where progress_bar_id = " . $id; diff --git a/wci.php b/wci.php index 88f9a84..005b1f8 100644 --- a/wci.php +++ b/wci.php @@ -169,7 +169,7 @@ function wci_civicrm_navigationMenu( &$params ) { 'attributes' => array ( 'label' => ts('Manage Progress bar'), 'name' => 'manage_progress_bar', - 'url' => 'civicrm/wci/progress-bar', + 'url' => 'civicrm/wci/progress-bar?reset=1', 'permission' => 'access CiviReport,access CiviContribute', 'operator' => 'OR', 'separator' => 1, -- 2.25.1