X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FPrice%2FPage%2FOption.php;h=2630b75baea54279fa7d418351354a07b9acc996;hb=d5b9585b3da73a76dada27cfa2f791c6c4763cd5;hp=0fc615f13b477cf797533e782854f2b23dca83cb;hpb=e7f7aef7265627c99d27b5e9cecdfe5d3e50f7de;p=civicrm-core.git diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index 0fc615f13b..2630b75bae 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -46,45 +46,40 @@ class CRM_Price_Page_Option extends CRM_Core_Page { public $useLivePageJS = TRUE; /** - * The field id of the option + * The field id of the option. * * @var int - * @access protected */ protected $_fid; /** - * The field id of the option + * The field id of the option. * * @var int - * @access protected */ protected $_sid; /** - * The price set is reserved or not + * The price set is reserved or not. * * @var boolean - * @access protected */ - protected $_isSetReserved = false; + protected $_isSetReserved = FALSE; /** - * The action links that we need to display for the browse screen + * The action links that we need to display for the browse screen. * * @var array - * @access private */ private static $_actionLinks; /** * Get the action links for this page. * - * @param null - * - * @return array array of action links that we need to display for the browse screen - * @access public - */ function &actionLinks() { + * @return array + * array of action links that we need to display for the browse screen + */ + public function &actionLinks() { if (!isset(self::$_actionLinks)) { self::$_actionLinks = array( CRM_Core_Action::UPDATE => array( @@ -123,19 +118,16 @@ class CRM_Price_Page_Option extends CRM_Core_Page { /** * Browse all price fields. * - * @param null - * * @return void - * @access public */ - function browse() { + public function browse() { $customOption = array(); CRM_Price_BAO_PriceFieldValue::getValues($this->_fid, $customOption); $config = CRM_Core_Config::singleton(); $financialType = CRM_Contribute_PseudoConstant::financialType(); $taxRate = CRM_Core_PseudoConstant::getTaxRates(); // display taxTerm for priceFields - $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $getTaxDetails = FALSE; @@ -150,7 +142,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($customOption[$id]['amount'], $customOption[$id]['tax_rate']); $customOption[$id]['tax_amount'] = $taxAmount['tax_amount']; } - if (!empty($values['financial_type_id'])){ + if (!empty($values['financial_type_id'])) { $customOption[$id]['financial_type_id'] = $financialType[$values['financial_type_id']]; } // update enable/disable links depending on price_field properties. @@ -203,12 +195,12 @@ class CRM_Price_Page_Option extends CRM_Core_Page { * * editing would involved modifying existing fields + adding data to new fields. * - * @param string $action the action to be invoked + * @param string $action + * The action to be invoked. * * @return void - * @access public */ - function edit($action) { + public function edit($action) { $oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, FALSE, 0 ); @@ -223,8 +215,8 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field/option', - "reset=1&action=browse&fid={$this->_fid}&sid={$this->_sid}" - )); + "reset=1&action=browse&fid={$this->_fid}&sid={$this->_sid}" + )); $controller = new CRM_Core_Controller_Simple('CRM_Price_Form_Option', ts('Price Field Option'), $action); $controller->set('fid', $this->_fid); $controller->setEmbedded(TRUE); @@ -259,13 +251,9 @@ class CRM_Price_Page_Option extends CRM_Core_Page { * This method is called after the page is created. It checks for the * type of action and executes that action. * - * @param null - * * @return void - * @access public */ - function run() { - + public function run() { // get the field id $this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE, 0 @@ -277,13 +265,16 @@ class CRM_Price_Page_Option extends CRM_Core_Page { if ($this->_sid) { CRM_Price_BAO_PriceSet::checkPermission($this->_sid); - $this->_isSetReserved= CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'is_reserved'); + $this->_isSetReserved = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'is_reserved'); $this->assign('isReserved', $this->_isSetReserved); } //as url contain $sid so append breadcrumb dynamically. - $breadcrumb = array(array('title' => ts('Price Fields'), + $breadcrumb = array( + array( + 'title' => ts('Price Fields'), 'url' => CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&sid=' . $this->_sid), - )); + ), + ); CRM_Utils_System::appendBreadCrumb($breadcrumb); if ($this->_fid) { @@ -315,7 +306,8 @@ class CRM_Price_Page_Option extends CRM_Core_Page { // what action to take ? if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::VIEW | CRM_Core_Action::DELETE - ) && !$this->_isSetReserved) { + ) && !$this->_isSetReserved + ) { // no browse for edit/update/view $this->edit($action); } @@ -325,5 +317,5 @@ class CRM_Price_Page_Option extends CRM_Core_Page { // Call the parents run method return parent::run(); } -} +}