From 045f52a32c0f423168d132122e3f53b00267070e Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:09:21 -0800 Subject: [PATCH] INFRA-132 - CRM/Financial - phpcbf --- CRM/Financial/BAO/ExportFormat.php | 18 +++++------ CRM/Financial/BAO/ExportFormat/IIF.php | 8 +++-- CRM/Financial/BAO/FinancialAccount.php | 4 +-- CRM/Financial/BAO/FinancialItem.php | 12 +++---- CRM/Financial/BAO/FinancialType.php | 26 +++++++-------- CRM/Financial/BAO/FinancialTypeAccount.php | 22 ++++++------- CRM/Financial/BAO/PaymentProcessor.php | 18 +++++------ CRM/Financial/Form/BatchTransaction.php | 17 +++++----- CRM/Financial/Form/Export.php | 6 ++-- CRM/Financial/Form/FinancialAccount.php | 14 ++++---- CRM/Financial/Form/FinancialBatch.php | 10 +++--- CRM/Financial/Form/FinancialType.php | 8 ++--- CRM/Financial/Form/FinancialTypeAccount.php | 9 +++--- CRM/Financial/Form/Search.php | 10 +++--- CRM/Financial/Page/AJAX.php | 36 +++++++++++++-------- CRM/Financial/Page/Batch.php | 6 ++-- CRM/Financial/Page/BatchTransaction.php | 12 +++---- CRM/Financial/Page/FinancialAccount.php | 12 +++---- CRM/Financial/Page/FinancialBatch.php | 13 ++++---- CRM/Financial/Page/FinancialType.php | 10 +++--- CRM/Financial/Page/FinancialTypeAccount.php | 22 ++++++------- 21 files changed, 152 insertions(+), 141 deletions(-) diff --git a/CRM/Financial/BAO/ExportFormat.php b/CRM/Financial/BAO/ExportFormat.php index 727d1d9316..4c29baf2ea 100644 --- a/CRM/Financial/BAO/ExportFormat.php +++ b/CRM/Financial/BAO/ExportFormat.php @@ -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; + } } } diff --git a/CRM/Financial/BAO/ExportFormat/IIF.php b/CRM/Financial/BAO/ExportFormat/IIF.php index 7ccaa5c2c2..93142945a3 100644 --- a/CRM/Financial/BAO/ExportFormat/IIF.php +++ b/CRM/Financial/BAO/ExportFormat/IIF.php @@ -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 ); diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index 7b550766ea..a48a31233a 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -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); } } diff --git a/CRM/Financial/BAO/FinancialItem.php b/CRM/Financial/BAO/FinancialItem.php index 1c1df72439..f20377d20a 100644 --- a/CRM/Financial/BAO/FinancialItem.php +++ b/CRM/Financial/BAO/FinancialItem.php @@ -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()) { diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 061e3b3ae3..f8d4e9fdad 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -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' " ); diff --git a/CRM/Financial/BAO/FinancialTypeAccount.php b/CRM/Financial/BAO/FinancialTypeAccount.php index d6f9faa0c1..ba33aedf38 100644 --- a/CRM/Financial/BAO/FinancialTypeAccount.php +++ b/CRM/Financial/BAO/FinancialTypeAccount.php @@ -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); diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php index 1d33f68f3f..3797908d43 100644 --- a/CRM/Financial/BAO/PaymentProcessor.php +++ b/CRM/Financial/BAO/PaymentProcessor.php @@ -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 diff --git a/CRM/Financial/Form/BatchTransaction.php b/CRM/Financial/Form/BatchTransaction.php index 124ff2470f..18e8ac9c89 100644 --- a/CRM/Financial/Form/BatchTransaction.php +++ b/CRM/Financial/Form/BatchTransaction.php @@ -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', diff --git a/CRM/Financial/Form/Export.php b/CRM/Financial/Form/Export.php index 8d3caf7d8a..4a9ddc5708 100644 --- a/CRM/Financial/Form/Export.php +++ b/CRM/Financial/Form/Export.php @@ -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']; diff --git a/CRM/Financial/Form/FinancialAccount.php b/CRM/Financial/Form/FinancialAccount.php index d5878d3743..6ab82eaed7 100644 --- a/CRM/Financial/Form/FinancialAccount.php +++ b/CRM/Financial/Form/FinancialAccount.php @@ -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(); diff --git a/CRM/Financial/Form/FinancialBatch.php b/CRM/Financial/Form/FinancialBatch.php index f5adfafc44..4801df5a66 100644 --- a/CRM/Financial/Form/FinancialBatch.php +++ b/CRM/Financial/Form/FinancialBatch.php @@ -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; } /** diff --git a/CRM/Financial/Form/FinancialType.php b/CRM/Financial/Form/FinancialType.php index 67be508ecd..f222b3cac1 100644 --- a/CRM/Financial/Form/FinancialType.php +++ b/CRM/Financial/Form/FinancialType.php @@ -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(); diff --git a/CRM/Financial/Form/FinancialTypeAccount.php b/CRM/Financial/Form/FinancialTypeAccount.php index 2fd3633e88..bf22b304b0 100644 --- a/CRM/Financial/Form/FinancialTypeAccount.php +++ b/CRM/Financial/Form/FinancialTypeAccount.php @@ -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( 'type' => 'cancel', 'name' => ts('Cancel') )) diff --git a/CRM/Financial/Form/Search.php b/CRM/Financial/Form/Search.php index 909c2fcc0a..45dfb11ecb 100644 --- a/CRM/Financial/Form/Search.php +++ b/CRM/Financial/Form/Search.php @@ -71,7 +71,7 @@ class CRM_Financial_Form_Search extends CRM_Core_Form { array_search('Closed', $batchStatus) => ts('Closed'), array_search('Exported', $batchStatus) => ts('Exported'), ), - false + FALSE ); $this->add( @@ -79,7 +79,7 @@ class CRM_Financial_Form_Search extends CRM_Core_Form { 'payment_instrument_id', ts('Payment Instrument'), array('' => ts('- any -' )) + CRM_Contribute_PseudoConstant::paymentInstrument(), - false + FALSE ); $this->add('text', 'total', ts('Total Amount'), $attributes['total']); @@ -101,7 +101,7 @@ class CRM_Financial_Form_Search extends CRM_Core_Form { ts('Task' ), array('' => ts('- actions -')) + $batchAction); - $this->add('submit','submit', ts('Go'), + $this->add('submit', 'submit', ts('Go'), array( 'class' => 'crm-form-submit', 'id' => 'Go', @@ -122,8 +122,8 @@ class CRM_Financial_Form_Search extends CRM_Core_Form { public function postProcess() { $batchIds = array(); foreach ($_POST as $key => $value) { - if (substr($key,0,6) == "check_") { - $batch = explode("_",$key); + if (substr($key, 0, 6) == "check_") { + $batch = explode("_", $key); $batchIds[] = $batch[1]; } } diff --git a/CRM/Financial/Page/AJAX.php b/CRM/Financial/Page/AJAX.php index 451cb41b8e..8f3491c78d 100644 --- a/CRM/Financial/Page/AJAX.php +++ b/CRM/Financial/Page/AJAX.php @@ -199,13 +199,13 @@ class CRM_Financial_Page_AJAX { if ($recordClass[0] == 'CRM' && count($recordClass) >= 3) { foreach ($records as $recordID) { $params = array(); - $ids = null; + $ids = NULL; switch ($op) { case 'assign': case 'remove': $recordPID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $recordID, 'payment_instrument_id'); $batchPID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $entityID, 'payment_instrument_id'); - $paymentInstrument = CRM_Core_OptionGroup::getLabel('payment_instrument',$batchPID); + $paymentInstrument = CRM_Core_OptionGroup::getLabel('payment_instrument', $batchPID); if ($op == 'remove' || ($recordPID == $batchPID && $op == 'assign') || !isset($batchPID)) { $params = array( 'entity_id' => $recordID, @@ -217,6 +217,7 @@ class CRM_Financial_Page_AJAX { $response = array('status' => ts("This batch is configured to include only transactions using %1 payment method. If you want to include other transactions, please edit the batch first and modify the Payment Method.", array( 1 => $paymentInstrument))); } break; + case 'close': // Update totals when closing a batch $params = $totals[$recordID]; @@ -261,8 +262,15 @@ class CRM_Financial_Page_AJAX { public static function getFinancialTransactionsList() { $sortMapper = array( - 0 => '', 1 => '', 2 => 'sort_name', - 3 => 'amount', 4 => 'trxn_id', 5 => 'transaction_date', 6 => 'payment_method', 7 => 'status', 8 => 'name', + 0 => '', + 1 => '', + 2 => 'sort_name', + 3 => 'amount', + 4 => 'trxn_id', + 5 => 'transaction_date', + 6 => 'payment_method', + 7 => 'status', + 8 => 'name', ); $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer'); @@ -373,19 +381,19 @@ class CRM_Financial_Page_AJAX { $row[$financialItem->id][$columnKey] = CRM_Utils_Money::format($financialItem->$columnKey, $financialItem->currency); } elseif ($columnKey == 'transaction_date' && $financialItem->$columnKey) { - $row[$financialItem->id][$columnKey] = CRM_Utils_Date::customFormat($financialItem->$columnKey); + $row[$financialItem->id][$columnKey] = CRM_Utils_Date::customFormat($financialItem->$columnKey); } elseif ($columnKey == 'status' && $financialItem->$columnKey) { $row[$financialItem->id][$columnKey] = CRM_Core_OptionGroup::getLabel('contribution_status', $financialItem->$columnKey); } } - if ($statusID == CRM_Core_OptionGroup::getValue('batch_status','Open')) { + if ($statusID == CRM_Core_OptionGroup::getValue('batch_status', 'Open')) { if (isset($notPresent)) { $js = "enableActions('x')"; $row[$financialItem->id]['check'] = ""; $row[$financialItem->id]['action'] = CRM_Core_Action::formLink( CRM_Financial_Form_BatchTransaction::links(), - null, + NULL, array( 'id' => $financialItem->id, 'contid' => $financialItem->contributionID, @@ -403,7 +411,7 @@ class CRM_Financial_Page_AJAX { $row[$financialItem->id]['check'] = ""; $row[$financialItem->id]['action'] = CRM_Core_Action::formLink( CRM_Financial_Page_BatchTransaction::links(), - null, + NULL, array( 'id' => $financialItem->id, 'contid' => $financialItem->contributionID, @@ -423,7 +431,7 @@ class CRM_Financial_Page_AJAX { unset($links['remove']); $row[$financialItem->id]['action'] = CRM_Core_Action::formLink( $links, - null, + NULL, array( 'id' => $financialItem->id, 'contid' => $financialItem->contributionID, @@ -436,11 +444,11 @@ class CRM_Financial_Page_AJAX { $financialItem->id ); } - $row[$financialItem->id]['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage(CRM_Utils_Array::value('contact_sub_type',$row[$financialItem->id]) ? CRM_Utils_Array::value('contact_sub_type',$row[$financialItem->id]) : CRM_Utils_Array::value('contact_type',$row[$financialItem->id]) ,false, $financialItem->contact_id); + $row[$financialItem->id]['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage(CRM_Utils_Array::value('contact_sub_type', $row[$financialItem->id]) ? CRM_Utils_Array::value('contact_sub_type', $row[$financialItem->id]) : CRM_Utils_Array::value('contact_type', $row[$financialItem->id]), FALSE, $financialItem->contact_id); $financialitems = $row; } - $iFilteredTotal = $iTotal = $params['total']; + $iFilteredTotal = $iTotal = $params['total']; $selectorElements = array( 'check', 'contact_type', 'sort_name', @@ -456,14 +464,14 @@ class CRM_Financial_Page_AJAX { $entityID = CRM_Utils_Type::escape($_REQUEST['entityID'], 'String'); $action = CRM_Utils_Type::escape($_REQUEST['action'], 'String'); foreach ($checkIDs as $key => $value) { - if ((substr($value,0,7) == "mark_x_" && $action == 'Assign') || (substr($value,0,7) == "mark_y_" && $action == 'Remove')) { - $contributions = explode("_",$value); + if ((substr($value, 0, 7) == "mark_x_" && $action == 'Assign') || (substr($value, 0, 7) == "mark_y_" && $action == 'Remove')) { + $contributions = explode("_", $value); $cIDs[] = $contributions[2]; } } $batchPID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $entityID, 'payment_instrument_id'); - $paymentInstrument = CRM_Core_OptionGroup::getLabel('payment_instrument',$batchPID); + $paymentInstrument = CRM_Core_OptionGroup::getLabel('payment_instrument', $batchPID); foreach ($cIDs as $key => $value) { $recordPID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $value, 'payment_instrument_id'); if ($action == 'Remove' || ($recordPID == $batchPID && $action == 'Assign') || !isset($batchPID)) { diff --git a/CRM/Financial/Page/Batch.php b/CRM/Financial/Page/Batch.php index aca100f951..94892e928f 100644 --- a/CRM/Financial/Page/Batch.php +++ b/CRM/Financial/Page/Batch.php @@ -60,7 +60,8 @@ class CRM_Financial_Page_Batch extends CRM_Core_Page_Basic { * * @return array (reference) of action links */ - public function &links() {} + public function &links() { + } /** * Get name of edit form @@ -103,8 +104,7 @@ class CRM_Financial_Page_Batch extends CRM_Core_Page_Basic { } public function search() { - if ($this->_action & - (CRM_Core_Action::ADD | + if ($this->_action & (CRM_Core_Action::ADD | CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE ) diff --git a/CRM/Financial/Page/BatchTransaction.php b/CRM/Financial/Page/BatchTransaction.php index a6e4250a1c..3ac585d7ac 100644 --- a/CRM/Financial/Page/BatchTransaction.php +++ b/CRM/Financial/Page/BatchTransaction.php @@ -44,11 +44,11 @@ class CRM_Financial_Page_BatchTransaction extends CRM_Core_Page_Basic { * @var array * @static */ - static $_links = null; + static $_links = NULL; static $_entityID; - static $_columnHeader = null; - static $_returnvalues = null; + static $_columnHeader = NULL; + static $_returnvalues = NULL; /** * Get BAO Name * @@ -94,12 +94,12 @@ class CRM_Financial_Page_BatchTransaction extends CRM_Core_Page_Basic { */ public function run() { // get the requested action - $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse' + $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse' // assign vars to templates $this->assign('action', $action); - self::$_entityID = CRM_Utils_Request::retrieve('bid' , 'Positive'); + self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive'); if (isset(self::$_entityID)) { $statusID = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id'); } @@ -152,7 +152,7 @@ class CRM_Financial_Page_BatchTransaction extends CRM_Core_Page_Basic { * * @return string user context. */ - public function userContext($mode = null) { + public function userContext($mode = NULL) { return 'civicrm/batchtransaction'; } } diff --git a/CRM/Financial/Page/FinancialAccount.php b/CRM/Financial/Page/FinancialAccount.php index 908ff5de5c..ab83098bee 100644 --- a/CRM/Financial/Page/FinancialAccount.php +++ b/CRM/Financial/Page/FinancialAccount.php @@ -45,7 +45,7 @@ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic { * @var array * @static */ - static $_links = null; + static $_links = NULL; /** * Get BAO Name @@ -103,15 +103,15 @@ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic { */ public function run() { // get the requested action - $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse' + $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse' // assign vars to templates $this->assign('action', $action); - $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0); + $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0); // what action to take ? if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) { - $this->edit($action, $id) ; + $this->edit($action, $id); } // parent run @@ -136,7 +136,7 @@ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic { while ($dao->fetch()) { $contributionType[$dao->id] = array(); CRM_Core_DAO::storeValues( $dao, $contributionType[$dao->id]); - $contributionType[$dao->id]['financial_account_type_id'] = $financialAccountType[$dao->financial_account_type_id]; + $contributionType[$dao->id]['financial_account_type_id'] = $financialAccountType[$dao->financial_account_type_id]; // form all action links $action = array_sum(array_keys($this->links())); @@ -190,7 +190,7 @@ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic { * * @return string user context. */ - public function userContext($mode = null) { + public function userContext($mode = NULL) { return 'civicrm/admin/financial/financialAccount'; } } diff --git a/CRM/Financial/Page/FinancialBatch.php b/CRM/Financial/Page/FinancialBatch.php index 5cad89c9e2..cbf0a41fdc 100644 --- a/CRM/Financial/Page/FinancialBatch.php +++ b/CRM/Financial/Page/FinancialBatch.php @@ -44,7 +44,7 @@ class CRM_Financial_Page_FinancialBatch extends CRM_Core_Page_Basic { * @var array * @static */ - static $_links = null; + static $_links = NULL; /** * Get BAO Name @@ -81,17 +81,16 @@ class CRM_Financial_Page_FinancialBatch extends CRM_Core_Page_Basic { $context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->set("context", $context); // assign vars to templates - $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0); - $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse' + $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0); + $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse' // what action to take ? - if ($action & - (CRM_Core_Action::UPDATE | + if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::CLOSE | CRM_Core_Action::REOPEN | CRM_Core_Action::EXPORT)) { - $this->edit($action, $id) ; + $this->edit($action, $id); } // parent run return parent::run(); @@ -125,7 +124,7 @@ class CRM_Financial_Page_FinancialBatch extends CRM_Core_Page_Basic { * * @return string user context. */ - public function userContext($mode = null) { + public function userContext($mode = NULL) { $context = $this->get("context"); if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) { return "civicrm/financial/financialbatches"; diff --git a/CRM/Financial/Page/FinancialType.php b/CRM/Financial/Page/FinancialType.php index 0293ff5f77..0fb7a49d73 100644 --- a/CRM/Financial/Page/FinancialType.php +++ b/CRM/Financial/Page/FinancialType.php @@ -45,7 +45,7 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { * @var array * @static */ - static $_links = null; + static $_links = NULL; /** * Get BAO Name @@ -109,15 +109,15 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { */ public function run() { // get the requested action - $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse' + $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse' // assign vars to templates $this->assign('action', $action); - $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0); + $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0); // what action to take ? if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) { - $this->edit($action, $id) ; + $this->edit($action, $id); } // parent run @@ -216,7 +216,7 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { * * @return string user context. */ - public function userContext($mode = null) { + public function userContext($mode = NULL) { return 'civicrm/admin/financial/financialType'; } } diff --git a/CRM/Financial/Page/FinancialTypeAccount.php b/CRM/Financial/Page/FinancialTypeAccount.php index aa90c652c8..5c2303fb6d 100644 --- a/CRM/Financial/Page/FinancialTypeAccount.php +++ b/CRM/Financial/Page/FinancialTypeAccount.php @@ -43,7 +43,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { * @var array * @static */ - static $_links = null; + static $_links = NULL; /** * The account id that we need to display for the browse screen @@ -51,7 +51,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { * @var array * @static */ - protected $_aid = null; + protected $_aid = NULL; /** * Get BAO Name @@ -99,16 +99,16 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { */ public function run() { // get the requested action - $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse' + $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse' // assign vars to templates $this->assign('action', $action); - $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0); - $this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this, false, 0); + $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0); + $this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0); // what action to take ? if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE)) { - $this->edit($action, $id) ; + $this->edit($action, $id); } else { $this->browse($action, $id); @@ -147,7 +147,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { $defaults = array(); $financialAccount = CRM_Financial_BAO_FinancialAccount::retrieve($params, $defaults); if (!empty($financialAccount)) { - $financialType[$dao->id]['financial_account'] = $financialAccount->name; + $financialType[$dao->id]['financial_account'] = $financialAccount->name; $financialType[$dao->id]['accounting_code'] = $financialAccount->accounting_code; $financialType[$dao->id]['account_type_code'] = $financialAccount->account_type_code; $financialType[$dao->id]['is_active'] = $financialAccount->is_active; @@ -175,7 +175,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { $financialType[$dao->id]['action'] = CRM_Core_Action::formLink($links, $action, array( 'id' => $dao->id, - 'aid'=> $dao->entity_id, + 'aid' => $dao->entity_id, ), ts('more'), FALSE, @@ -190,7 +190,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { } else { CRM_Core_Error::fatal( ); - return null; + return NULL; } } @@ -205,7 +205,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { * * @return void */ - public function edit( $action ) { + public function edit($action) { // create a simple controller for editing CiviCRM Profile data $controller = new CRM_Core_Controller_Simple( 'CRM_Financial_Form_FinancialTypeAccount', ts('Financial Account Types'), $action ); @@ -215,7 +215,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page { 'reset=1&action=browse&aid=' . $this->_aid ) ); $controller->set( 'aid', $this->_aid ); - $controller->setEmbedded( true ); + $controller->setEmbedded( TRUE ); $controller->process(); $controller->run(); } -- 2.25.1