* Set variables up before form is built
*
* @return void
- * @access public
*/
public function preProcess() {
parent::preProcess();
* Build the form object
*
* @return void
- * @access public
*/
- public function buildQuickForm( ) {
- parent::buildQuickForm( );
+ public function buildQuickForm() {
+ parent::buildQuickForm();
$this->setPageTitle(ts('Financial Account'));
if ($this->_action & CRM_Core_Action::DELETE) {
*
* @internal param array $fields posted values of the form
*
- * @return array list of errors to be posted back to the form
+ * @return array
+ * list of errors to be posted back to the form
* @static
- * @access public
*/
- static function formRule( $values, $files, $self ) {
- $errorMsg = array( );
+ public static function formRule($values, $files, $self) {
+ $errorMsg = array();
$financialAccountTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Liability' "));
if (isset($values['is_tax'])) {
- if ($values['financial_account_type_id'] != $financialAccountTypeId) {
+ if ($values['financial_account_type_id'] != $financialAccountTypeId) {
$errorMsg['financial_account_type_id'] = ts('Taxable accounts should have Financial Account Type set to Liability.');
}
if (CRM_Utils_Array::value('tax_rate', $values) == NULL) {
$errorMsg['tax_rate'] = ts('Please enter value for tax rate');
}
}
- if ((CRM_Utils_Array::value('tax_rate', $values) != NULL)) {
+ if ((CRM_Utils_Array::value('tax_rate', $values) != NULL)) {
if ($values['tax_rate'] < 0 || $values['tax_rate'] >= 100) {
$errorMsg['tax_rate'] = ts('Tax Rate Should be between 0 - 100');
}
$relationshipId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Sales Tax Account is' "));
$params = array(
'financial_account_id' => $self->_id,
- 'account_relationship'=> $relationshipId
+ 'account_relationship' => $relationshipId,
);
$result = CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, $defaults);
if ($result) {
}
}
}
- return CRM_Utils_Array::crmIsEmptyArray( $errorMsg ) ? true : $errorMsg;
+ return CRM_Utils_Array::crmIsEmptyArray($errorMsg) ? TRUE : $errorMsg;
}
/**
* Set default values for the form.
* the default values are retrieved from the database
*
- * @access public
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', CRM_Core_Config::domainID(), 'contact_id');
/**
* Process the form submission
*
- * @access public
* @return void
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Financial_BAO_FinancialAccount::del($this->_id);
- CRM_Core_Session::setStatus( ts('Selected Financial Account has been deleted.') );
+ CRM_Core_Session::setStatus(ts('Selected Financial Account has been deleted.'));
}
else {
- $ids = array( );
+ $ids = array();
// store the submitted values in an array
$params = $this->exportValues();