<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
* @var array
* @static
*/
- static $_aid = null;
+ protected $_aid = null;
/**
* Get BAO Name
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::UPDATE => array(
- 'name' => ts('Edit'),
- 'url' => 'civicrm/admin/financial/financialType/accounts',
- 'qs' => 'action=update&id=%%id%%&aid=%%aid%%&reset=1',
+ 'name' => ts('Edit'),
+ 'url' => 'civicrm/admin/financial/financialType/accounts',
+ 'qs' => 'action=update&id=%%id%%&aid=%%aid%%&reset=1',
'title' => ts('Edit Financial Type Account'),
),
CRM_Core_Action::DELETE => array(
- 'name' => ts('Delete'),
- 'url' => 'civicrm/admin/financial/financialType/accounts',
- 'qs' => 'action=delete&id=%%id%%&aid=%%aid%%',
+ 'name' => ts('Delete'),
+ 'url' => 'civicrm/admin/financial/financialType/accounts',
+ 'qs' => 'action=delete&id=%%id%%&aid=%%aid%%',
'title' => ts('Delete Financial Type Account'),
),
);
$params['entity_id'] = $this->_aid;
$params['entity_table'] = 'civicrm_financial_type';
if ($this->_aid) {
+ $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_aid, 'name');
CRM_Utils_System::setTitle($this->_title .' - '.ts( 'Assigned Financial Accounts'));
- $financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
- $accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
+ $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id');
+ $accountRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$dao->copyValues($params);
$dao->find();
while ($dao->fetch()) {
$financialType[$dao->id] = array();
- CRM_Core_DAO::storeValues( $dao, $financialType[$dao->id] );
+ CRM_Core_DAO::storeValues($dao, $financialType[$dao->id]);
- $params = array( 'id' => $dao->financial_account_id );
+ $params = array('id' => $dao->financial_account_id);
$defaults = array();
$financialAccount = CRM_Financial_BAO_FinancialAccount::retrieve($params, $defaults);
if (!empty($financialAccount)) {
$financialType[$dao->id]['account_relationship'] = CRM_Utils_Array::value($dao->account_relationship, $accountRelationship);
}
}
-
// form all action links
$action = array_sum(array_keys($this->links()));
- $financialType[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action,
+ $links = self::links();
+
+ //CRM-12492
+ if ($dao->account_relationship == $relationTypeId) {
+ unset($links[CRM_Core_Action::DELETE]);
+ }
+ $financialType[$dao->id]['action'] = CRM_Core_Action::formLink($links, $action,
array(
'id' => $dao->id,
'aid'=> $dao->entity_id,
- )
+ ),
+ ts('more'),
+ FALSE,
+ 'financialTypeAccount.manage.action',
+ 'FinancialTypeAccount',
+ $dao->id
);
}
$this->assign('rows', $financialType);