<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
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(
/**
* 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;
$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.
*
* 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
);
$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);
* 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
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) {
// 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);
}
// Call the parents run method
return parent::run();
}
-}
+}