Commit 045f52a3 authored by totten's avatar totten

INFRA-132 - CRM/Financial - phpcbf

parent b3a4b879
......@@ -78,14 +78,14 @@ class CRM_Financial_BAO_ExportFormat {
switch ($this->getFileExtension()) {
case 'csv':
self::createActivityExport($this->_batchIds, $fileName);
break;
break;
case 'iif':
$tplFile = $this->getHookedTemplateFileName();
$out = self::getTemplate()->fetch($tplFile);
$fileName = $this->putFile($out);
self::createActivityExport($this->_batchIds, $fileName);
break;
break;
}
}
......@@ -108,7 +108,7 @@ class CRM_Financial_BAO_ExportFormat {
* @return null
*/
public function getTemplateFileName() {
return null;
return NULL;
}
/**
......@@ -150,7 +150,7 @@ class CRM_Financial_BAO_ExportFormat {
public function initiateDownload() {
$config = CRM_Core_Config::singleton();
//zip files if more than one.
if (count($this->_downloadFile)>1) {
if (count($this->_downloadFile) > 1) {
$zip = $config->customFileUploadDir . 'Financial_Transactions_' . date('YmdHis') . '.zip';
$result = $this->createZip($this->_downloadFile, $zip, TRUE);
if ($result) {
......@@ -204,7 +204,7 @@ class CRM_Financial_BAO_ExportFormat {
}
//create activity.
$subject .= ' ' . ts('Batch') . '['. $values['title'] .']';
$subject .= ' ' . ts('Batch') . '['. $values['title'] .']';
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
$activityParams = array(
'activity_type_id' => array_search('Export Accounting Batch', $activityTypes),
......@@ -215,7 +215,7 @@ class CRM_Financial_BAO_ExportFormat {
'source_record_id' => $values['id'],
'target_contact_id' => $session->get('userID'),
'details' => $details,
'attachFile_1' => array (
'attachFile_1' => array(
'uri' => $fileName,
'type' => 'text/csv',
'location' => $fileName,
......@@ -249,7 +249,7 @@ class CRM_Financial_BAO_ExportFormat {
}
if (count($validFiles)) {
$zip = new ZipArchive();
if ($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== TRUE) {
if ($zip->open($destination, $overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== TRUE) {
return FALSE;
}
foreach ($validFiles as $file) {
......@@ -259,7 +259,7 @@ class CRM_Financial_BAO_ExportFormat {
return file_exists($destination);
}
else {
return FALSE;
}
return FALSE;
}
}
}
......@@ -61,7 +61,7 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat
/**
* @param array $exportParams
*/
public function export( $exportParams ) {
public function export($exportParams) {
parent::export( $exportParams );
foreach( self::$complementaryTables as $rct ) {
......@@ -194,7 +194,7 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat
$journalEntries[$dao->financial_trxn_id] = array(
'to_account' => array(
'trxn_date' => $this->format($dao->trxn_date, 'date'),
'trxn_id' => $this->format($dao->trxn_id),
'trxn_id' => $this->format($dao->trxn_id),
'account_name' => $this->format($dao->to_account_name),
'amount' => $this->format($dao->debit_total_amount, 'money'),
'contact_name' => $this->format($dao->contact_to_name),
......@@ -352,9 +352,11 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat
case 'date':
$sout = date( 'Y/m/d', strtotime( $s1 ) );
break;
case 'money':
$sout = CRM_Utils_Money::format($s, null, null, true);
$sout = CRM_Utils_Money::format($s, NULL, NULL, TRUE);
break;
case 'string':
case 'notepad':
$s2 = str_replace( "\n", '\n', $s1 );
......
......@@ -135,7 +135,7 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco
array('Financial', 'FinancialTypeAccount', 'financial_account_id'),
);
foreach ($dependancy as $name) {
require_once (str_replace('_', DIRECTORY_SEPARATOR, "CRM_" . $name[0] . "_BAO_" . $name[1]) . ".php");
require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_" . $name[0] . "_BAO_" . $name[1]) . ".php";
$className = "CRM_{$name[0]}_BAO_{$name[1]}";
$bao = new $className();
$bao->$name[2] = $financialAccountId;
......@@ -206,6 +206,6 @@ WHERE cft.id = %1
2 => array(strtolower($accountTypeCode), 'String'),
3 => array($financialAccountId, 'Integer'),
);
return CRM_Core_DAO::singleValueQuery($query, $params);
return CRM_Core_DAO::singleValueQuery($query, $params);
}
}
......@@ -38,7 +38,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
/**
* Class constructor
*/
public function __construct( ) {
public function __construct() {
parent::__construct( );
}
......@@ -143,14 +143,14 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
*/
public static function create(&$params, $ids = NULL, $trxnIds = NULL) {
$financialItem = new CRM_Financial_DAO_FinancialItem();
if (!empty($ids['id'])) {
CRM_Utils_Hook::pre('edit', 'FinancialItem', $ids['id'], $params);
}
else {
CRM_Utils_Hook::pre('create', 'FinancialItem', NULL, $params);
}
$financialItem->copyValues($params);
if (!empty($ids['id'])) {
$financialItem->id = $ids['id'];
......@@ -175,7 +175,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
if (!empty($ids['id'])) {
CRM_Utils_Hook::post('edit', 'FinancialItem', $financialItem->id, $financialItem);
}
else {
else {
CRM_Utils_Hook::post('create', 'FinancialItem', $financialItem->id, $financialItem);
}
return $financialItem;
......@@ -230,7 +230,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
return $financialItems;
}
else {
return null;
return NULL;
}
}
......@@ -258,7 +258,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
if (!$allowPermDelete) {
$sql = 'SELECT DISTINCT(cc.id), cc.display_name FROM civicrm_contact cc
INNER JOIN civicrm_contribution con ON con.contact_id = cc.id
WHERE cc.id IN (' . implode (',', $contactIds) . ') AND con.is_test = 0';
WHERE cc.id IN (' . implode(',', $contactIds) . ') AND con.is_test = 0';
$dao = CRM_Core_DAO::executeQuery($sql);
if ($dao->N) {
while ($dao->fetch()) {
......
......@@ -39,12 +39,12 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
/**
* Static holder for the default LT
*/
static $_defaultContributionType = null;
static $_defaultContributionType = NULL;
/**
* Class constructor
*/
public function __construct( ) {
public function __construct() {
parent::__construct( );
}
......@@ -59,14 +59,14 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
* @return CRM_Contribute_BAO_ContributionType object
* @static
*/
public static function retrieve( &$params, &$defaults ) {
public static function retrieve(&$params, &$defaults) {
$financialType = new CRM_Financial_DAO_FinancialType( );
$financialType->copyValues( $params );
if ($financialType->find(true)) {
if ($financialType->find(TRUE)) {
CRM_Core_DAO::storeValues( $financialType, $defaults );
return $financialType;
}
return null;
return NULL;
}
/**
......@@ -80,7 +80,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
* @return Object DAO object on sucess, null otherwise
* @static
*/
public static function setIsActive( $id, $is_active ) {
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue( 'CRM_Financial_DAO_FinancialType', $id, 'is_active', $is_active );
}
......@@ -97,9 +97,9 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
*/
public static function add(&$params, &$ids = array()) {
if(empty($params['id'])) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
$params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, false);
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, false);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, FALSE);
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
}
// action is taken depending upon the mode
......@@ -128,7 +128,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
public static function del($financialTypeId) {
$financialType = new CRM_Financial_DAO_FinancialType( );
$financialType->id = $financialTypeId;
$financialType->find(true);
$financialType->find(TRUE);
// tables to ingore checks for financial_type_id
$ignoreTables = array('CRM_Financial_DAO_EntityFinancialAccount');
......@@ -141,7 +141,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
foreach ($occurrences as $occurence) {
$className = get_class($occurence);
if (!in_array($className, $ignoreTables)) {
$tables[] = $className;
$tables[] = $className;
}
}
if (!empty($tables)) {
......@@ -179,9 +179,9 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
CRM_Core_PseudoConstant::populate(
$revenueFinancialType,
'CRM_Financial_DAO_EntityFinancialAccount',
$all = True,
$all = TRUE,
$retrieve = 'entity_id',
$filter = null,
$filter = NULL,
"account_relationship = $relationTypeId AND entity_table = 'civicrm_financial_type' "
);
......
......@@ -38,7 +38,7 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
/**
* Class constructor
*/
public function __construct( ) {
public function __construct() {
parent::__construct( );
}
......@@ -111,9 +111,9 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
*
* @static
*/
public static function del($financialTypeAccountId, $accountId = null) {
public static function del($financialTypeAccountId, $accountId = NULL) {
//checking if financial type is present
$check = false;
$check = FALSE;
$relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$financialTypeId = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id' );
......@@ -134,8 +134,8 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
$daoString = 'CRM_' . $name[0] . '_DAO_' . $name[1];
$dao = new $daoString();
$dao->financial_type_id = $financialTypeId;
if ($dao->find(true)) {
$check = true;
if ($dao->find(TRUE)) {
$check = TRUE;
break;
}
}
......@@ -146,7 +146,7 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
}
else {
$accountRelationShipId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'account_relationship');
CRM_Core_Session::setStatus(ts('You cannot remove an account with a %1 relationship because it is being referenced by one or more of the following types of records: Contributions, Contribution Pages, or Membership Types. Consider disabling this type instead if you no longer want it used.', array(1 => $relationValues[$accountRelationShipId])), NUll, 'error');
CRM_Core_Session::setStatus(ts('You cannot remove an account with a %1 relationship because it is being referenced by one or more of the following types of records: Contributions, Contribution Pages, or Membership Types. Consider disabling this type instead if you no longer want it used.', array(1 => $relationValues[$accountRelationShipId])), NULL, 'error');
}
return CRM_Utils_System::redirect( CRM_Utils_System::url( 'civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$accountId}" ));
}
......@@ -235,14 +235,14 @@ WHERE cog.name = 'payment_instrument' ";
$titles = array();
$financialAccountTypeID = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
$accountRelationship = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
$relationships = array (
$relationships = array(
array_search('Accounts Receivable Account is', $accountRelationship) => array_search('Asset', $financialAccountTypeID),
array_search('Expense Account is', $accountRelationship) => array_search('Expenses', $financialAccountTypeID),
array_search('Cost of Sales Account is', $accountRelationship) => array_search('Cost of Sales', $financialAccountTypeID),
array_search('Income Account is', $accountRelationship) => array_search('Revenue', $financialAccountTypeID),
);
$dao = CRM_Core_DAO::executeQuery('SELECT id, financial_account_type_id FROM civicrm_financial_account WHERE name LIKE %1',
$dao = CRM_Core_DAO::executeQuery('SELECT id, financial_account_type_id FROM civicrm_financial_account WHERE name LIKE %1',
array(1 => array($financialType->name, 'String'))
);
$dao->fetch();
......@@ -261,7 +261,7 @@ WHERE cog.name = 'payment_instrument' ";
else {
$existingFinancialAccount[$dao->financial_account_type_id] = $dao->id;
}
$params = array (
$params = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $financialType->id,
);
......@@ -294,8 +294,8 @@ WHERE cog.name = 'payment_instrument' ";
}
}
else {
$params['financial_account_id'] = $existingFinancialAccount[$value];
$titles[] = $financialType->name;
$params['financial_account_id'] = $existingFinancialAccount[$value];
$titles[] = $financialType->name;
}
$params['account_relationship'] = $key;
self::add($params);
......
......@@ -102,7 +102,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
* @return CRM_Financial_DAO_PaymentProcessor object on success, null otherwise
* @return CRM_Financial_DAO_PaymentProcessor object on success, null otherwise
* @static
*/
public static function retrieve(&$params, &$defaults) {
......@@ -226,7 +226,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
CRM_Core_Error::fatal(ts('Invalid value passed to getPayment function'));
}
$payments = array( );
$payments = array();
foreach ($paymentProcessorIDs as $paymentProcessorID) {
$payment = self::getPayment($paymentProcessorID, $mode);
$payments[$payment['id']] = $payment;
......@@ -243,14 +243,14 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
* @param array_type $processor2
* @return number
*/
public static function defaultComparison($processor1, $processor2){
$p1 = CRM_Utils_Array::value('is_default', $processor1);
$p2 = CRM_Utils_Array::value('is_default', $processor2);
if ($p1 == $p2) {
return 0;
}
return ($p1 > $p2) ? -1 : 1;
public static function defaultComparison($processor1, $processor2){
$p1 = CRM_Utils_Array::value('is_default', $processor1);
$p2 = CRM_Utils_Array::value('is_default', $processor2);
if ($p1 == $p2) {
return 0;
}
return ($p1 > $p2) ? -1 : 1;
}
/**
* Build payment processor details
......
......@@ -48,7 +48,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
protected $_batchStatusId;
public function preProcess() {
self::$_entityID = CRM_Utils_Request::retrieve( 'bid' , 'Positive' ) ? CRM_Utils_Request::retrieve( 'bid' , 'Positive' ) : $_POST['batch_id'];
self::$_entityID = CRM_Utils_Request::retrieve( 'bid', 'Positive' ) ? CRM_Utils_Request::retrieve( 'bid', 'Positive' ) : $_POST['batch_id'];
$this->assign('entityID', self::$_entityID);
if (isset(self::$_entityID)) {
$this->_batchStatusId = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
......@@ -61,7 +61,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
array(
'created_by' => ts('Created By'),
'status' => ts('Status'),
'description'=> ts('Description'),
'description' => ts('Description'),
'payment_instrument' => ts('Payment Instrument'),
'item_count' => ts('Entered Transactions'),
'assigned_item_count' => ts('Assigned Transactions'),
......@@ -121,19 +121,20 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
$this->add( 'select',
'trans_remove',
ts('Task'),
array( '' => ts( '- actions -' )) + array( 'Remove' => ts('Remove from Batch')));
array( '' => ts( '- actions -' )) + array( 'Remove' => ts('Remove from Batch')));
$this->add('submit','rSubmit', ts('Go'),
$this->add('submit', 'rSubmit', ts('Go'),
array(
'class' => 'crm-form-submit',
'id' => 'GoRemove',
));
self::$_entityID = CRM_Utils_Request::retrieve('bid' , 'Positive');
self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive');
$this->addButtons(
array(
array('type' => 'submit',
array(
'type' => 'submit',
'name' => ts('Search'),
'isDefault' => TRUE,
)
......@@ -144,9 +145,9 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
$this->add( 'select',
'trans_assign',
ts('Task'),
array( '' => ts( '- actions -' )) + array( 'Assign' => ts( 'Assign to Batch' )));
array( '' => ts( '- actions -' )) + array( 'Assign' => ts( 'Assign to Batch' )));
$this->add('submit','submit', ts('Go'),
$this->add('submit', 'submit', ts('Go'),
array(
'class' => 'crm-form-submit',
'id' => 'Go',
......
......@@ -76,7 +76,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
//validate batch ids
$batchIds = explode(',', $_GET['batch_id']);
foreach($batchIds as $batchId) {
CRM_Utils_Type::validate($batchId,'Positive');
CRM_Utils_Type::validate($batchId, 'Positive');
}
$this->_batchIds = $_GET['batch_id'];
......@@ -101,7 +101,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
foreach( $batchStatus as $batchStatusId ) {
if ($batchStatusId == $this->_exportStatusId) {
CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
}
}
......@@ -154,7 +154,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
*
* @return void
*/
public function postProcess( ) {
public function postProcess() {
if (!$this->_exportFormat) {
$params = $this->exportValues();
$this->_exportFormat = $params['export_format'];
......
......@@ -78,7 +78,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
*
* @return void
*/
public function buildQuickForm( ) {
public function buildQuickForm() {
parent::buildQuickForm( );
$this->setPageTitle(ts('Financial Account'));
......@@ -137,11 +137,11 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
* @return array list of errors to be posted back to the form
* @static
*/
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) {
......@@ -158,7 +158,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
$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) {
......@@ -166,7 +166,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
}
}
}
return CRM_Utils_Array::crmIsEmptyArray( $errorMsg ) ? true : $errorMsg;
return CRM_Utils_Array::crmIsEmptyArray( $errorMsg ) ? TRUE : $errorMsg;
}
/**
......@@ -195,7 +195,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
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();
......
......@@ -105,7 +105,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form {
array(
'type' => 'next',
'name' => ts('Save'),
'isDefault' => true,
'isDefault' => TRUE,
),
array(
'type' => 'next',
......@@ -125,19 +125,19 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form {
//unset exported status
$exportedStatusId = CRM_Utils_Array::key('Exported', $batchStatus );
unset($batchStatus[$exportedStatusId]);
$this->add('select', 'status_id', ts('Batch Status'), array('' => ts('- select -')) + $batchStatus, true);
$this->add('select', 'status_id', ts('Batch Status'), array('' => ts('- select -')) + $batchStatus, TRUE);
$this->freeze(array('status_id'));
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Batch_DAO_Batch');
$this->add('text', 'title', ts('Batch Name'), $attributes['name'], true);
$this->add('text', 'title', ts('Batch Name'), $attributes['name'], TRUE);
$this->add('textarea', 'description', ts('Description'), $attributes['description']);
$this->add('select', 'payment_instrument_id', ts('Payment Instrument'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
false
FALSE
);
$this->add('text', 'total', ts('Total Amount'), $attributes['total']);
......@@ -196,7 +196,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form {
if (!CRM_Core_DAO::objectExists($batchName, 'CRM_Batch_DAO_Batch', $self->_id)) {
$errors['title'] = ts('This name already exists in database. Batch names must be unique.');
}
return CRM_Utils_Array::crmIsEmptyArray($errors) ? true : $errors;
return CRM_Utils_Array::crmIsEmptyArray($errors) ? TRUE : $errors;
}
/**
......
......@@ -49,7 +49,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
parent::buildQuickForm();
$this->setPageTitle(ts('Financial Type'));
$this->_id = CRM_Utils_Request::retrieve('id' , 'Positive', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($this->_id) {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'name');
}
......@@ -67,11 +67,11 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
if ($this->_action == CRM_Core_Action::UPDATE) {
$this->assign('aid', $this->_id);
}
if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'is_reserved','vid')) {
if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'is_reserved', 'vid')) {
$this->freeze(array('is_active'));
}
$this->addRule('name', ts('A financial type with this name already exists. Please select another name.'),'objectExists',
$this->addRule('name', ts('A financial type with this name already exists. Please select another name.'), 'objectExists',
array('CRM_Financial_DAO_FinancialType', $this->_id)
);
}
......@@ -90,7 +90,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'), ts('Record Deleted'), 'success');
}
else {
$params = $ids = array( );
$params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
......
......@@ -110,7 +110,8 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
}
$breadCrumb = array(
array('title' => ts('Financial Type Accounts'),
array(
'title' => ts('Financial Type Accounts'),
'url' => $url,
)
);
......@@ -167,7 +168,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
'5' => 5, //expense
'3' => 1, //AR relation
'1' => 3, //revenue
'6' => 1, //Asset
'6' => 1, //Asset
'7' => 4, //cost of sales
'8' => 1, //premium inventory
'9' => 3 //discount account is
......@@ -189,7 +190,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
'5' => 5, //expense
'3' => 1, //AR relation
'1' => 3, //revenue
'6' => 1, //Asset
'6' => 1, //Asset
'7' => 4, //cost of sales
'8' => 1, //premium inventory
'9' => 3 //discount account is
......@@ -219,7 +220,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
'name' => ts('Save and New'),
'subName' => 'new'
),
array (
array(