Commit 03e04002 authored by eileen's avatar eileen

CRM-12595 fix formatting in remaing files

parent 366fe2a3
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
class CRM_Dedupe_BAO_QueryBuilder_IndividualUnsupervised extends CRM_Dedupe_BAO_QueryBuilder {
static function record($rg) {
......@@ -62,7 +87,7 @@ SELECT contact_id1 as id1, contact_id2 as id2, {$rg->threshold} as weight
FROM emails
JOIN civicrm_contact as contact1 on contact1.id=contact_id1
JOIN civicrm_contact as contact2 on contact2.id=contact_id2
WHERE contact1.contact_type='Individual'
WHERE contact1.contact_type='Individual'
AND contact2.contact_type='Individual'
AND " . self::internalFilters($rg);
......
......@@ -1765,7 +1765,7 @@ WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
*
* CRM-12155
*
* @param integer $contactId contact id
* @param integer $contactId contact id
*
* @access public
* @static
......
......@@ -122,8 +122,8 @@ class CRM_Event_BAO_ParticipantStatusType extends CRM_Event_DAO_ParticipantStatu
LEFT JOIN civicrm_event event ON ( event.id = participant.event_id )
WHERE participant.status_id IN {$statusIds}
AND (event.end_date > now() OR event.end_date IS NULL)
AND event.is_active = 1
ORDER BY participant.register_date, participant.id
AND event.is_active = 1
ORDER BY participant.register_date, participant.id
";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
class CRM_Event_Cart_BAO_MerParticipant extends CRM_Event_BAO_Participant {
public $email = NULL;
public $contribution_id = NULL;
public $cart = NULL;
//XXX
//XXX
function __construct($participant = NULL) {
parent::__construct();
$a = (array)$participant;
......
......@@ -125,7 +125,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) {
if ($payment_processor_id == NULL && $event_in_cart->event->payment_processor != NULL) {
$payment_processor_id = $event_in_cart->event->payment_processor;
$this->financial_type_id = $event_in_cart->event->financial_type_id;
$this->financial_type_id = $event_in_cart->event->financial_type_id;
}
else {
if ($event_in_cart->event->payment_processor != NULL && $event_in_cart->event->payment_processor != $payment_processor_id) {
......@@ -559,7 +559,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
'payment_processor' => $this->_paymentProcessor['payment_processor_type'],
'trxn_id' => $result['trxn_id'],
);
$trxn = new CRM_Financial_DAO_FinancialTrxn();
$trxn = new CRM_Financial_DAO_FinancialTrxn();
$trxn->copyValues($trxnParams);
if (!CRM_Utils_Rule::currencyCode($trxn->currency)) {
$config = CRM_Core_Config::singleton();
......@@ -618,7 +618,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
'amount' => $params['amount'],
'currency' => CRM_Utils_Array::value('currencyID', $params),
);
$entity_trxn =& new CRM_Financial_DAO_EntityFinancialTrxn();
$entity_trxn =& new CRM_Financial_DAO_EntityFinancialTrxn();
$entity_trxn->copyValues($entity_financial_trxn_params);
$entity_trxn->save();
}
......
......@@ -348,7 +348,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent {
CRM_Price_BAO_Set::addTo('civicrm_event', $event->id, $priceSetId);
}
}
$this->set('id', $event->id);
if ($this->_action & CRM_Core_Action::ADD) {
......@@ -380,7 +380,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent {
return ts('Event Information and Settings');
}
/* Retrieve event template custom data values
/* Retrieve event template custom data values
* and set as default values for current new event.
*
* @params int $tempId event template id.
......
......@@ -257,8 +257,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
NULL, NULL, NULL, NULL,
array('&nbsp;&nbsp;', '&nbsp;&nbsp;', '&nbsp;&nbsp;', '<br/>')
);
// financial type
// financial type
$financialType = CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
$this->add('select', 'financial_type_id', ts('Financial Type'),
array('' => ts('- select -')) + $financialType
......@@ -476,7 +476,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
}
}
}
if ($values['is_monetary']) {
if ($values['is_monetary']) {
//check if financial type is selected
if (!$values['financial_type_id']) {
$errors['financial_type_id'] = ts("Please select financial type.");
......
......@@ -120,7 +120,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
if (!isset($defaults['address'][1]['country_id'])) {
$defaults['address'][1]['country_id'] = $config->defaultContactCountry;
}
if (!isset($defaults['address'][1]['state_province_id'])) {
$defaults['address'][1]['state_province_id'] = $config->defaultContactStateProvince;
}
......@@ -197,7 +197,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
}
// get the list of location blocks being used by other events
$locationEvents = CRM_Event_BAO_Event::getLocationEvents();
// remove duplicates and make sure that the duplicate entry with key as
// loc_block_id of this event (this->_id) is preserved
......
......@@ -104,7 +104,7 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage
* @access public
*/
public function buildQuickForm() {
$field = 'civicrm_event';
$field = 'civicrm_event';
if ($this->_isTemplate) {
$field = 'event_template';
}
......
......@@ -1173,10 +1173,10 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
// set source if not set
if (empty($params['source'])) {
$this->_params['participant_source'] = ts('Offline Registration for Event: %2 by: %1', array(1 => $userName, 2 => $eventTitle));
$this->_params['participant_source'] = ts('Offline Registration for Event: %2 by: %1', array(1 => $userName, 2 => $eventTitle));
}
else {
$this->_params['participant_source'] = $params['source'];
$this->_params['participant_source'] = $params['source'];
}
$this->_params['description'] = $this->_params['participant_source'];
......@@ -1253,7 +1253,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
if (($this->_lineItem || !isset($params['proceSetId'])) && !$this->_paymentId && $this->_id) {
CRM_Price_BAO_LineItem::deleteLineItems($this->_id, 'civicrm_participant');
}
if ($this->_mode) {
// add all the additioanl payment params we need
$this->_params["state_province-{$this->_bltID}"] = $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
......
......@@ -98,7 +98,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration {
$this->assign('email', $email);
}
$this->assignToTemplate();
if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) {
$lineItemForTemplate = array();
foreach ($this->_lineItem as $key => $value) {
......
......@@ -68,7 +68,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task {
*
* @return void
* @access public
*/
*/
function preProcess() {
/*
* initialize the task and row fields
......
......@@ -62,7 +62,7 @@ class CRM_Event_Form_Task_PickProfile extends CRM_Event_Form_Task {
*
* @return void
* @access public
*/
*/
function preProcess() {
/*
* initialize the task and row fields
......
......@@ -53,7 +53,7 @@ class CRM_Event_Form_Task_SearchTaskHookSample extends CRM_Event_Form_Task {
$query = "
SELECT p.fee_amount as amount,
p.register_date as register_date,
p.source as source,
p.source as source,
ct.display_name as display_name
FROM civicrm_participant p
INNER JOIN civicrm_contact ct ON ( p.contact_id = ct.id )
......
......@@ -451,7 +451,7 @@ abstract class CRM_Event_Import_Parser {
$this->_activeFields[$i]->_hasLocationType = $elements[$i];
}
}
function setActiveFieldPhoneTypes( $elements )
{
for ($i = 0; $i < count( $elements ); $i++) {
......
......@@ -78,7 +78,7 @@ ORDER BY title
SELECT v.label ,v.value
FROM civicrm_option_value v,
civicrm_option_group g
WHERE v.option_group_id = g.id
WHERE v.option_group_id = g.id
AND g.name = 'event_type'
AND v.is_active = 1
AND {$whereClause}
......@@ -102,14 +102,14 @@ ORDER by v.weight";
}
$whereClause = "cv.label LIKE '$name%' ";
$query = "SELECT DISTINCT (
cv.label
), cv.id
FROM civicrm_price_field_value cv
LEFT JOIN civicrm_price_field cf ON cv.price_field_id = cf.id
LEFT JOIN civicrm_price_set_entity ce ON ce.price_set_id = cf.price_set_id
WHERE ce.entity_table = 'civicrm_event' AND {$whereClause}
WHERE ce.entity_table = 'civicrm_event' AND {$whereClause}
GROUP BY cv.label";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
......
......@@ -59,8 +59,8 @@ class CRM_Event_Page_ParticipantListing_Simple extends CRM_Core_Page {
$fromClause = "
FROM civicrm_contact
INNER JOIN civicrm_participant ON ( civicrm_contact.id = civicrm_participant.contact_id
AND civicrm_contact.is_deleted = 0 )
INNER JOIN civicrm_participant ON ( civicrm_contact.id = civicrm_participant.contact_id
AND civicrm_contact.is_deleted = 0 )
INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id
LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1 )
";
......
......@@ -149,7 +149,7 @@ class CRM_Export_Form_Select extends CRM_Core_Form {
CRM_Case_Form_Task::preProcessCommon($this, TRUE);
$this->_exportMode = self::CASE_EXPORT;
$componentName = array('', 'Case');
break;
break;
}
$this->_task = $values['task'];
......
......@@ -44,7 +44,7 @@ interface CRM_Extension_Manager_Interface {
/**
* Perform type-specific removal logic (before updating the extension
* row in the "civicrm_extension" table).
*
*
* @param CRM_Extension_Info $info may be generated from xml or DB (which is lossy)
* @see CRM_Extension_Manager::createInfoFromDB
*/
......
This diff is collapsed.
......@@ -85,7 +85,7 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
c.source AS source,
ft.currency AS currency,
cov_status.label AS status,
CASE
CASE
WHEN efti.entity_id IS NOT NULL
THEN efti.amount
ELSE eftc.amount
......@@ -163,7 +163,7 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
$financialItems = array();
$this->_batchIds = $batchId;
while ($dao->fetch()) {
$creditAccountName = $creditAccountType =
$creditAccountName = $creditAccountType =
$creditAccount = NULL;
if ($dao->credit_account) {
$creditAccountName = $dao->credit_account_name;
......@@ -173,9 +173,9 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
else {
$creditAccountName = $dao->from_credit_account_name;
$creditAccountType = $dao->from_credit_account_type_code;
$creditAccount = $dao->from_credit_account;
$creditAccount = $dao->from_credit_account;
}
$financialItems[] = array(
'Transaction Date' => $dao->trxn_date,
'Debit Account' => $dao->to_account_code,
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
......@@ -72,9 +71,9 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
*
* @param object $lineItem line item object
* @param object $contribution contribution object
*
*
* @access public
* @static
* @static
* @return void
*/
static function add($lineItem, $contribution) {
......@@ -82,13 +81,13 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
$financialItemStatus = CRM_Core_PseudoConstant::accountOptionValues('financial_item_status');
if ($contribution->contribution_status_id == array_search('Completed', $contributionStatuses)) {
$itemStatus = array_search('Paid', $financialItemStatus);
}
}
elseif ($contribution->contribution_status_id == array_search('Pending', $contributionStatuses)) {
$itemStatus = array_search('Unpaid', $financialItemStatus);
}
}
$params = array(
'transaction_date' => CRM_Utils_Date::isoToMysql($contribution->receive_date),
'contact_id' => $contribution->contact_id,
'contact_id' => $contribution->contact_id,
'amount' => $lineItem->line_total,
'currency' => $contribution->currency,
'entity_table' => 'civicrm_line_item',
......@@ -96,9 +95,9 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
'description' => ( $lineItem->qty != 1 ? $lineItem->qty . ' of ' : ''). ' ' . $lineItem->label,
'status_id' => $itemStatus,
);
if ($lineItem->financial_type_id) {
$searchParams = array(
$searchParams = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $lineItem->financial_type_id,
'account_relationship' => 1,
......@@ -113,7 +112,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
$trxnId['id'] = $trxn['financialTrxnId'];
self::create($params, NULL, $trxnId);
}
}
/**
* function to create the financial Items and financial enity trxn
......@@ -121,16 +120,16 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
* @param array $params associated array to create financial items
* @param array $ids financial item ids
* @param array $trxnIds financial item ids
*
*
* @access public
* @static
* @static
* @return object
*/
static function create(&$params, $ids = NULL, $trxnIds = NULL) {
$financialItem = new CRM_Financial_DAO_FinancialItem();
$financialItem->copyValues($params);
if (CRM_Utils_Array::value('id', $ids)) {
$financialItem->id = $ids['id'];
$financialItem->id = $ids['id'];
}
$financialItem->save();
......@@ -141,7 +140,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
'financial_trxn_id' => $trxnIds['id'],
'amount' => $params['amount'],
);
$entity_trxn = new CRM_Financial_DAO_EntityFinancialTrxn();
$entity_trxn->copyValues($entity_financial_trxn_params);
if (CRM_Utils_Array::value('entityFinancialTrxnId', $ids)) {
......@@ -150,7 +149,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
$entity_trxn->save();
}
return $financialItem;
}
}
/**
* takes an associative array and creates a entity financial transaction object
......@@ -173,7 +172,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
*
* @param array $params (reference ) an assoc array of name/value pairs
*
* @param boolean $maxID to retrive max id
* @param boolean $maxID to retrive max id
*
* @return array
* @access public
......@@ -196,7 +195,7 @@ class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
'financial_trxn_id' => $financialItem->financial_trxn_id,
'amount' => $financialItem->amount,
);
}
}
if (!empty($financialItems)) {
return $financialItems;
}
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
......@@ -74,15 +73,15 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
}
return $defaults;
}
/**
* function to add the financial types
*
* @param array $params reference array contains the values submitted by the form
* @param array $ids reference array contains the id
*
*
* @access public
* @static
* @static
* @return object
*/
static function add(&$params, &$ids = NULL) {
......@@ -103,18 +102,18 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
$financialTypeAccount->save();
return $financialTypeAccount;
}
/**
* Function to delete financial Types
*
* Function to delete financial Types
*
* @param int $contributionTypeId
* @static
*/
static function del($financialTypeAccountId, $accountId = null) {
//checking if financial type is present
//checking if financial type is present
$check = false;
$relationValues = CRM_Core_PseudoConstant::accountOptionValues('account_relationship');
$financialTypeId = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id' );
//check dependencies
// FIXME more table containing financial_type_id to come
......@@ -148,20 +147,20 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin
}
return CRM_Utils_System::redirect( CRM_Utils_System::url( 'civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$accountId}" ));
}
//delete from financial Type table
$financialType = new CRM_Financial_DAO_EntityFinancialAccount( );
$financialType->id = $financialTypeAccountId;
$financialType->delete();
}
/**
* Function to get Financial Account Name
*
* Function to get Financial Account Name
*
* @param int $entityId
*
* @param string $entityTable
*
*
* @param string $entityTable
*
* @param string $columnName Column to fetch
* @static
*/
......@@ -182,18 +181,18 @@ AND entity_id = %2";
}
/**
* Function to financial Account for payment instrument
*
* Function to financial Account for payment instrument
*
* @param int $paymentInstrumentValue payment instrument value
*
*
* @static
*/
static function getInstrumentFinancialAccount($paymentInstrumentValue = NULL) {
if (!self::$financialAccount) {
$query = "SELECT ceft.financial_account_id, cov.value
FROM civicrm_entity_financial_account ceft
INNER JOIN civicrm_option_value cov ON cov.id = ceft.entity_id AND ceft.entity_table = 'civicrm_option_value'
INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id
INNER JOIN civicrm_option_value cov ON cov.id = ceft.entity_id AND ceft.entity_table = 'civicrm_option_value'
INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id
WHERE cog.name = 'payment_instrument' ";
if ($paymentInstrumentValue) {
......
......@@ -66,7 +66,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
$processor->payment_type = $ppTypeDAO->payment_type;
$processor->save();
// CRM-11826, add entry in civicrm_entity_financial_account
// CRM-11826, add entry in civicrm_entity_financial_account
// if financial_account_id is not NULL
if (CRM_Utils_Array::value('financial_account_id', $params)) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
......@@ -76,7 +76,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
'account_relationship' => $relationTypeId,
'financial_account_id' => $params['financial_account_id']
);
CRM_Financial_BAO_FinancialTypeAccount::add($values);
CRM_Financial_BAO_FinancialTypeAccount::add($values);
}
return $processor;
}
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
......@@ -81,9 +80,9 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
*/
public function buildQuickForm() {
if ($this->_batchStatusId == 2) {
$this->add('submit', 'export_batch', ts('Export Batch'));
$this->add('submit', 'export_batch', ts('Export Batch'));
}
// do not build rest of form unless it is open batch
if ($this->_batchStatusId != 1 ) {
return;
......@@ -103,7 +102,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
);
$this->_group = CRM_Core_PseudoConstant::group();
// multiselect for groups
if ($this->_group) {
$this->add('select', 'group', ts('Groups'), $this->_group, FALSE,
......@@ -111,7 +110,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
);
}
$contactTags = CRM_Core_BAO_Tag::getTags();
if ($contactTags) {
$this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE,
array('id' => 'contact_tags', 'multiple' => 'multiple', 'title' => ts('- select -'))
......@@ -141,7 +140,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
)
)
);
$this->addElement('checkbox', 'toggleSelect', NULL, NULL);
$this->add( 'select',
'trans_assign',
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
......@@ -112,7 +111,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/financialbatches',
"reset=1&batchStatus=5"));
}
/**
* Build the form
*
......@@ -152,7 +151,7 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
)
);
}
/**
* process the form after the input has been submitted and validated
*
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
......@@ -36,7 +35,7 @@
/**
* This class generates form components for Financial Account
*
*
*/
class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
......@@ -55,13 +54,13 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialAccount');
$this->add('text', 'name', ts('Name'), $attributes['name'],true);
$this->addRule('name', ts('A financial type with this name already exists. Please select another name.'),
'objectExists', array('CRM_Financial_DAO_FinancialAccount', $this->_id));
$this->add('text', 'description', ts('Description'), $attributes['description']);
$this->add('text', 'accounting_code', ts('Accounting Code'), $attributes['accounting_code']);
$this->add('text', 'account_type_code', ts('Account Type Code'), $attributes['account_type_code']);
......@@ -72,20 +71,20 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('checkbox', 'is_tax', ts('Is Tax?'));
$this->add('checkbox', 'is_default', ts('Default?'));
$financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
if (!empty($financialAccountType)) {
$this->add('select', 'financial_account_type_id', ts('Financial Account Type'),
array('' => '- select -') + $financialAccountType, true);
}
if ($this->_action == CRM_Core_Action::UPDATE &&
CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $this->_id, 'is_reserved')) {
$this->freeze(array('name', 'description', 'is_active'));
}
$this->addFormRule(array('CRM_Financial_Form_FinancialAccount', 'formRule'), $this);
}
/**
* global validation rules for the form
*
......@@ -104,7 +103,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
}
return CRM_Utils_Array::crmIsEmptyArray( $errorMsg ) ? true : $errorMsg;
}
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
......@@ -121,7 +120,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
}
return $defaults;
}
/**
* Function to process the form
*
......@@ -137,11 +136,11 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {