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;
}
}
* @return null
*/
public function getTemplateFileName() {
- return null;
+ return NULL;
}
/**
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) {
}
//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),
'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,
}
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) {
return file_exists($destination);
}
else {
- return FALSE;
- }
+ return FALSE;
+ }
}
}
/**
* @param array $exportParams
*/
- public function export( $exportParams ) {
+ public function export($exportParams) {
parent::export( $exportParams );
foreach( self::$complementaryTables as $rct ) {
$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),
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 );
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;
2 => array(strtolower($accountTypeCode), 'String'),
3 => array($financialAccountId, 'Integer'),
);
- return CRM_Core_DAO::singleValueQuery($query, $params);
+ return CRM_Core_DAO::singleValueQuery($query, $params);
}
}
/**
* Class constructor
*/
- public function __construct( ) {
+ public function __construct() {
parent::__construct( );
}
*/
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'];
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;
return $financialItems;
}
else {
- return null;
+ return NULL;
}
}
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()) {
/**
* Static holder for the default LT
*/
- static $_defaultContributionType = null;
+ static $_defaultContributionType = NULL;
/**
* Class constructor
*/
- public function __construct( ) {
+ public function __construct() {
parent::__construct( );
}
* @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;
}
/**
* @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 );
}
*/
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
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');
foreach ($occurrences as $occurence) {
$className = get_class($occurence);
if (!in_array($className, $ignoreTables)) {
- $tables[] = $className;
+ $tables[] = $className;
}
}
if (!empty($tables)) {
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' "
);
/**
* Class constructor
*/
- public function __construct( ) {
+ public function __construct() {
parent::__construct( );
}
*
* @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' );
$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;
}
}
}
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}" ));
}
$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();
else {
$existingFinancialAccount[$dao->financial_account_type_id] = $dao->id;
}
- $params = array (
+ $params = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $financialType->id,
);
}
}
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);
* @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) {
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;
* @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
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');
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'),
$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,
)
$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',
//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'];
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.'));
}
}
*
* @return void
*/
- public function postProcess( ) {
+ public function postProcess() {
if (!$this->_exportFormat) {
$params = $this->exportValues();
$this->_exportFormat = $params['export_format'];
*
* @return void
*/
- public function buildQuickForm( ) {
+ public function buildQuickForm() {
parent::buildQuickForm( );
$this->setPageTitle(ts('Financial Account'));
* @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) {
$relationshipId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Sales Tax Account is' "));
$params = array(
'financial_account_id' => $self->_id,
- 'account_relationship'=> $relationshipId
+ 'account_relationship' => $relationshipId
);
$result = CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, $defaults);
if ($result) {
}
}
}
- return CRM_Utils_Array::crmIsEmptyArray( $errorMsg ) ? true : $errorMsg;
+ return CRM_Utils_Array::crmIsEmptyArray( $errorMsg ) ? TRUE : $errorMsg;
}
/**
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();
array(
'type' => 'next',
'name' => ts('Save'),
- 'isDefault' => true,
+ 'isDefault' => TRUE,
),
array(
'type' => 'next',
//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']);
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;
}
/**
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');
}
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)
);
}
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();
}
$breadCrumb = array(
- array('title' => ts('Financial Type Accounts'),
+ array(
+ 'title' => ts('Financial Type Accounts'),
'url' => $url,
)
);
'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
'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
'name' => ts('Save and New'),
'subName' => 'new'
),
- array (
+ array(
'type' => 'cancel',
'name' => ts('Cancel')
))
array_search('Closed', $batchStatus) => ts('Closed'),
array_search('Exported', $batchStatus) => ts('Exported'),
),
- false
+ FALSE
);
$this->add(
'payment_instrument_id',
ts('Payment Instrument'),
array('' => ts('- any -' )) + CRM_Contribute_PseudoConstant::paymentInstrument(),
- false
+ FALSE
);
$this->add('text', 'total', ts('Total Amount'), $attributes['total']);
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',
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];
}
}
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,
$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];
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');
$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'] = "<input type='checkbox' id='mark_x_". $financialItem->id."' name='mark_x_". $financialItem->id."' value='1' onclick={$js}></input>";
$row[$financialItem->id]['action'] = CRM_Core_Action::formLink(
CRM_Financial_Form_BatchTransaction::links(),
- null,
+ NULL,
array(
'id' => $financialItem->id,
'contid' => $financialItem->contributionID,
$row[$financialItem->id]['check'] = "<input type='checkbox' id='mark_y_". $financialItem->id."' name='mark_y_". $financialItem->id."' value='1' onclick={$js}></input>";
$row[$financialItem->id]['action'] = CRM_Core_Action::formLink(
CRM_Financial_Page_BatchTransaction::links(),
- null,
+ NULL,
array(
'id' => $financialItem->id,
'contid' => $financialItem->contributionID,
unset($links['remove']);
$row[$financialItem->id]['action'] = CRM_Core_Action::formLink(
$links,
- null,
+ NULL,
array(
'id' => $financialItem->id,
'contid' => $financialItem->contributionID,
$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',
$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)) {
*
* @return array (reference) of action links
*/
- public function &links() {}
+ public function &links() {
+ }
/**
* Get name of edit form
}
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
)
* @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
*
*/
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');
}
*
* @return string user context.
*/
- public function userContext($mode = null) {
+ public function userContext($mode = NULL) {
return 'civicrm/batchtransaction';
}
}
* @var array
* @static
*/
- static $_links = null;
+ static $_links = NULL;
/**
* Get BAO Name
*/
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
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()));
*
* @return string user context.
*/
- public function userContext($mode = null) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/financial/financialAccount';
}
}
* @var array
* @static
*/
- static $_links = null;
+ static $_links = NULL;
/**
* Get BAO Name
$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();
*
* @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";
* @var array
* @static
*/
- static $_links = null;
+ static $_links = NULL;
/**
* Get BAO Name
*/
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
*
* @return string user context.
*/
- public function userContext($mode = null) {
+ public function userContext($mode = NULL) {
return 'civicrm/admin/financial/financialType';
}
}
* @var array
* @static
*/
- static $_links = null;
+ static $_links = NULL;
/**
* The account id that we need to display for the browse screen
* @var array
* @static
*/
- protected $_aid = null;
+ protected $_aid = NULL;
/**
* Get BAO Name
*/
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);
$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;
$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,
}
else {
CRM_Core_Error::fatal( );
- return null;
+ return NULL;
}
}
*
* @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 );
'reset=1&action=browse&aid=' . $this->_aid ) );
$controller->set( 'aid', $this->_aid );
- $controller->setEmbedded( true );
+ $controller->setEmbedded( TRUE );
$controller->process();
$controller->run();
}