<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
$this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this, FALSE, NULL, 'REQUEST');
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE, NULL, 'REQUEST');
$url = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$this->_sid}");
- $breadCrumb = array(array('title' => ts('Price Set Fields'),
- 'url' => $url,
- ));
+ $breadCrumb = array(array('title' => ts('Price Set Fields'), 'url' => $url));
$this->_extendComponentId = array();
$extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'extends', 'id');
}
CRM_Utils_System::appendBreadCrumb($breadCrumb);
+
+ switch ($this->_action) {
+ case CRM_Core_Action::ADD:
+ CRM_Utils_System::setTitle(ts('Add Price Field'));
+ break;
+ case CRM_Core_Action::UPDATE:
+ CRM_Utils_System::setTitle(ts('Edit Price Field'));
+ break;
+ case CRM_Core_Action::DELETE:
+ CRM_Utils_System::setTitle(ts('Delete Price Field'));
+ break;
+ }
}
/**
$defaults['price'] = CRM_Utils_Money::format($defaults['amount'], NULL, '%a');
}
- if (CRM_Utils_Array::value('active_on', $defaults)) {
+ if (!empty($defaults['active_on'])) {
list($defaults['active_on'],
$defaults['active_on_time']
) = CRM_Utils_Date::setDateDefaults($defaults['active_on'], 'activityDateTime');
}
- if (CRM_Utils_Array::value('expire_on', $defaults)) {
+ if (!empty($defaults['expire_on'])) {
list($defaults['expire_on'],
$defaults['expire_on_time']
) = CRM_Utils_Date::setDateDefaults($defaults['expire_on'], 'activityDateTime');
$defaults['options_per_line'] = 1;
$defaults['is_display_amounts'] = 1;
}
- $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
+ $enabledComponents = CRM_Core_Component::getEnabledComponents();
+ $eventComponentId = NULL;
+ if (array_key_exists('CiviEvent',$enabledComponents)) {
+ $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
+ }
if (isset($this->_sid) && $this->_action == CRM_Core_Action::ADD) {
$financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'financial_type_id');
if (count($financialType)) {
$this->assign('financialType', $financialType);
}
+ $enabledComponents = CRM_Core_Component::getEnabledComponents();
+ $eventComponentId = $memberComponentId = NULL;
+ if (array_key_exists('CiviEvent',$enabledComponents)) {
+ $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
+ }
+ if (array_key_exists('CiviMember',$enabledComponents)) {
+ $memberComponentId = CRM_Core_Component::getComponentID('CiviMember');
+ }
- $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
- $memberComponentId = CRM_Core_Component::getComponentID('CiviMember');
$attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue');
$this->add('select', 'financial_type_id',
/**
* global validation rules for the form
*
- * @param array $fields (referance) posted values of the form
+ * @param array $fields (referance) posted values of the form
+ *
+ * @param $files
+ * @param $form
*
* @return array if errors then list of errors to be posted back to the form,
* true otherwise
$_flagOption = 1;
}
}
- if (!$noLabel && !$noAmount && CRM_Utils_Array::value('option_financial_type_id', $fields) && $fields['option_financial_type_id'][$index] == '' && $fields['html_type'] != 'Text') {
+ if (!$noLabel && !$noAmount && !empty($fields['option_financial_type_id']) && $fields['option_financial_type_id'][$index] == '' && $fields['html_type'] != 'Text') {
$errors["option_financial_type_id[{$index}]"] = ts('Financial Type is a Required field.');
}
if ($noLabel && !$noAmount) {
foreach ($memTypesIDS as $key => $val) {
// see if any price field option values in this price field are for memberships with autorenew
$memTypeDetails = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($val);
- if (CRM_Utils_Array::value('auto_renew', $memTypeDetails)) {
+ if (!empty($memTypeDetails['auto_renew'])) {
$foundAutorenew = TRUE;
break;
}