Commit fcd9e6cc authored by Monish Deb's avatar Monish Deb

additional fixes

parent 5338eba8
<?php
class CRM_Grantprograms_AJAX {
public static function getFinancialTransactionsList() {
$sortMapper = array(
0 => '',
1 => '',
2 => 'sort_name',
3 => 'amount',
4 => 'trxn_id',
5 => 'transaction_date',
6 => 'receive_date',
7 => 'payment_method',
8 => 'status',
9 => 'name',
);
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$return = isset($_REQUEST['return']) ? CRM_Utils_Type::escape($_REQUEST['return'], 'Boolean') : FALSE;
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$context = CRM_Utils_Request::retrieve('context', 'Alphanumeric');
$entityID = isset($_REQUEST['entityID']) ? CRM_Utils_Type::escape($_REQUEST['entityID'], 'String') : NULL;
$notPresent = isset($_REQUEST['notPresent']) ? CRM_Utils_Type::escape($_REQUEST['notPresent'], 'String') : NULL;
$statusID = isset($_REQUEST['statusID']) ? CRM_Utils_Type::escape($_REQUEST['statusID'], 'String') : NULL;
$search = isset($_REQUEST['search']) ? TRUE : FALSE;
$params = $_POST;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$returnvalues = array(
'civicrm_financial_trxn.payment_instrument_id as payment_method',
'civicrm_contribution.contact_id as contact_id',
'civicrm_contribution.id as contributionID',
'contact_a.sort_name',
'civicrm_financial_trxn.total_amount as amount',
'civicrm_financial_trxn.trxn_id as trxn_id',
'contact_a.contact_type',
'contact_a.contact_sub_type',
'civicrm_financial_trxn.trxn_date as transaction_date',
'civicrm_contribution.receive_date as receive_date',
'civicrm_financial_type.name',
'civicrm_financial_trxn.currency as currency',
'civicrm_financial_trxn.status_id as status',
'civicrm_financial_trxn.check_number as check_number',
'civicrm_financial_trxn.card_type_id',
'civicrm_financial_trxn.pan_truncation',
);
$columnHeader = array(
'contact_type' => '',
'sort_name' => ts('Contact Name'),
'amount' => ts('Amount'),
'trxn_id' => ts('Trxn ID'),
'transaction_date' => ts('Transaction Date'),
'receive_date' => ts('Received'),
'payment_method' => ts('Payment Method'),
'status' => ts('Status'),
'name' => ts('Type'),
);
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = ($offset / $rowCount) + 1;
$params['rp'] = $rowCount;
$params['context'] = $context;
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['total'] = 0;
// get batch list
if (isset($notPresent)) {
$financialItem = CRM_Grantprograms_Query::getBatchFinancialItems($entityID, $returnvalues, $notPresent, $params);
if ($search) {
$unassignedTransactions = CRM_Grantprograms_Query::getBatchFinancialItems($entityID, $returnvalues, $notPresent, $params, TRUE);
}
else {
$unassignedTransactions = CRM_Grantprograms_Query::getBatchFinancialItems($entityID, $returnvalues, $notPresent, NULL, TRUE);
}
while ($unassignedTransactions->fetch()) {
$unassignedTransactionsCount[] = $unassignedTransactions->id;
}
if (!empty($unassignedTransactionsCount)) {
$params['total'] = count($unassignedTransactionsCount);
}
}
else {
$financialItem = CRM_Grantprograms_Query::getBatchFinancialItems($entityID, $returnvalues, NULL, $params);
$assignedTransactions = CRM_Grantprograms_Query::getBatchFinancialItems($entityID, $returnvalues);
while ($assignedTransactions->fetch()) {
$assignedTransactionsCount[] = $assignedTransactions->id;
}
if (!empty($assignedTransactionsCount)) {
$params['total'] = count($assignedTransactionsCount);
}
}
$financialitems = array();
if ($statusID) {
$batchStatuses = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id', array('labelColumn' => 'name', 'condition' => " v.value={$statusID}"));
$batchStatus = $batchStatuses[$statusID];
}
while ($financialItem->fetch()) {
$row[$financialItem->id] = array();
foreach ($columnHeader as $columnKey => $columnValue) {
if ($financialItem->contact_sub_type && $columnKey == 'contact_type') {
$row[$financialItem->id][$columnKey] = $financialItem->contact_sub_type;
continue;
}
$row[$financialItem->id][$columnKey] = $financialItem->$columnKey;
if ($columnKey == 'sort_name' && $financialItem->$columnKey && $financialItem->contact_id) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=" . $financialItem->contact_id);
$row[$financialItem->id][$columnKey] = '<a href=' . $url . '>' . $financialItem->$columnKey . '</a>';
}
elseif ($columnKey == 'payment_method' && $financialItem->$columnKey) {
$row[$financialItem->id][$columnKey] = CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'payment_instrument_id', $financialItem->$columnKey);
if ($row[$financialItem->id][$columnKey] == 'Check') {
$checkNumber = $financialItem->check_number ? ' (' . $financialItem->check_number . ')' : '';
$row[$financialItem->id][$columnKey] = $row[$financialItem->id][$columnKey] . $checkNumber;
}
}
elseif ($columnKey == 'amount' && $financialItem->$columnKey) {
$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);
}
elseif ($columnKey == 'receive_date' && $financialItem->$columnKey) {
$row[$financialItem->id][$columnKey] = CRM_Utils_Date::customFormat($financialItem->$columnKey);
}
elseif ($columnKey == 'status' && $financialItem->$columnKey) {
$row[$financialItem->id][$columnKey] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $financialItem->$columnKey);
}
}
if (isset($batchStatus) && in_array($batchStatus, array('Open', 'Reopened'))) {
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,
array(
'id' => $financialItem->id,
'contid' => $financialItem->contributionID,
'cid' => $financialItem->contact_id,
),
ts('more'),
FALSE,
'financialItem.batch.row',
'FinancialItem',
$financialItem->id
);
}
else {
$js = "enableActions('y')";
$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,
array(
'id' => $financialItem->id,
'contid' => $financialItem->contributionID,
'cid' => $financialItem->contact_id,
),
ts('more'),
FALSE,
'financialItem.batch.row',
'FinancialItem',
$financialItem->id
);
}
}
else {
$row[$financialItem->id]['check'] = NULL;
$tempBAO = new CRM_Financial_Page_BatchTransaction();
$links = $tempBAO->links();
unset($links['remove']);
$row[$financialItem->id]['action'] = CRM_Core_Action::formLink(
$links,
NULL,
array(
'id' => $financialItem->id,
'contid' => $financialItem->contributionID,
'cid' => $financialItem->contact_id,
),
ts('more'),
FALSE,
'financialItem.batch.row',
'FinancialItem',
$financialItem->id
);
}
if ($financialItem->contact_id) {
$row[$financialItem->id]['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage(CRM_Utils_Array::value('contact_sub_type', $row[$financialItem->id]) ? $row[$financialItem->id]['contact_sub_type'] : CRM_Utils_Array::value('contact_type', $row[$financialItem->id]), FALSE, $financialItem->contact_id);
}
$financialitems = $row;
}
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array(
'check',
'contact_type',
'sort_name',
'amount',
'trxn_id',
'transaction_date',
'receive_date',
'payment_method',
'status',
'name',
'action',
);
if ($return) {
return CRM_Utils_JSON::encodeDataTableSelector($financialitems, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
}
CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($financialitems, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
}
......@@ -118,156 +118,6 @@ function from($name, $mode, $side) {
public static function getPanesMapper(&$panes) {
}
/**
* Function to retrieve financial items assigned for a batch
*
* @param int $entityID
* @param array $returnValues
* @param null $notPresent
* @param null $params
* @return Object
*/
static function getBatchFinancialItems($entityID, $returnValues, $notPresent = NULL, $params = NULL, $getCount = FALSE) {
if (!$getCount) {
if (!empty($params['rowCount']) &&
$params['rowCount'] > 0
) {
$limit = " LIMIT {$params['offset']}, {$params['rowCount']} ";
}
}
// action is taken depending upon the mode
$select = 'civicrm_financial_trxn.id ';
if (!empty( $returnValues)) {
$select .= " , ".implode(' , ', $returnValues);
}
$orderBy = " ORDER BY civicrm_financial_trxn.id";
if (!empty($params['sort'])) {
$orderBy = ' ORDER BY ' . CRM_Utils_Type::escape($params['sort'], 'String');
}
$from = "civicrm_financial_trxn
LEFT JOIN civicrm_entity_financial_trxn ON civicrm_entity_financial_trxn.financial_trxn_id = civicrm_financial_trxn.id
LEFT JOIN civicrm_entity_batch ON civicrm_entity_batch.entity_id = civicrm_financial_trxn.id
LEFT OUTER JOIN civicrm_contribution ON civicrm_contribution.id = civicrm_entity_financial_trxn.entity_id AND civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution'
LEFT OUTER JOIN civicrm_grant ON civicrm_grant.id = civicrm_entity_financial_trxn.entity_id AND civicrm_entity_financial_trxn.entity_table = 'civicrm_grant'
LEFT JOIN civicrm_financial_type ON civicrm_financial_type.id = IFNULL(civicrm_contribution.financial_type_id, civicrm_grant.financial_type_id)
LEFT JOIN civicrm_contact contact_a ON contact_a.id = IFNULL(civicrm_contribution.contact_id, civicrm_grant.contact_id)
LEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id = civicrm_contribution.id
";
$searchFields =
array(
'sort_name',
'financial_type_id',
'contribution_page_id',
'contribution_payment_instrument_id',
'contribution_transaction_id',
'contribution_source',
'contribution_currency_type',
'contribution_pay_later',
'contribution_recurring',
'contribution_test',
'contribution_thankyou_date_is_not_null',
'contribution_receipt_date_is_not_null',
'contribution_pcp_made_through_id',
'contribution_pcp_display_in_roll',
'contribution_date_relative',
'contribution_amount_low',
'contribution_amount_high',
'contribution_in_honor_of',
'contact_tags',
'group',
'contribution_date_relative',
'contribution_date_high',
'contribution_date_low',
'contribution_check_number',
'contribution_status_id',
);
$values = array();
foreach ($searchFields as $field) {
if (isset($params[$field])) {
$values[$field] = $params[$field];
if ($field == 'sort_name') {
$from .= " LEFT JOIN civicrm_contact contact_b ON contact_b.id = civicrm_contribution.contact_id
LEFT JOIN civicrm_email ON contact_b.id = civicrm_email.contact_id";
}
if ($field == 'contribution_in_honor_of') {
$from .= " LEFT JOIN civicrm_contact contact_b ON contact_b.id = civicrm_contribution.contact_id";
}
if ($field == 'contact_tags') {
$from .= " LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-{$params[$field]}` ON `civicrm_entity_tag-{$params[$field]}`.entity_id = contact_a.id";
}
if ($field == 'group') {
$from .= " LEFT JOIN civicrm_group_contact `civicrm_group_contact-{$params[$field]}` ON contact_a.id = `civicrm_group_contact-{$params[$field]}`.contact_id ";
}
if ($field == 'contribution_date_relative') {
$relativeDate = explode('.', $params[$field]);
$date = CRM_Utils_Date::relativeToAbsolute($relativeDate[0], $relativeDate[1]);
$values['contribution_date_low'] = $date['from'];
$values['contribution_date_high'] = $date['to'];
}
$searchParams = CRM_Contact_BAO_Query::convertFormValues(
$values,
0,
FALSE,
NULL,
[
'financial_type_id',
'contribution_soft_credit_type_id',
'contribution_status_id',
'contribution_page_id',
'financial_trxn_card_type_id',
'contribution_payment_instrument_id',
]
);
$query = new CRM_Contact_BAO_Query($searchParams,
CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE,
FALSE
),NULL, FALSE, FALSE,CRM_Contact_BAO_Query::MODE_CONTRIBUTE
);
if ($field == 'contribution_date_high' || $field == 'contribution_date_low') {
$query->dateQueryBuilder($params[$field], 'civicrm_contribution', 'contribution_date', 'receive_date', 'Contribution Date');
}
}
}
if (!empty($query->_where[0])) {
$where = implode(' AND ', $query->_where[0]) .
" AND civicrm_entity_batch.batch_id IS NULL
AND (civicrm_grant.id IS NOT NULL OR civicrm_contribution.id IS NOT NULL)";
$searchValue = TRUE;
}
else {
$searchValue = FALSE;
}
if (!$searchValue) {
if (!$notPresent) {
$where = " ( civicrm_entity_batch.batch_id = {$entityID}
AND civicrm_entity_batch.entity_table = 'civicrm_financial_trxn'
AND (civicrm_grant.id IS NOT NULL OR civicrm_contribution.id IS NOT NULL) )";
}
else {
$where = " ( civicrm_entity_batch.batch_id IS NULL
AND (civicrm_grant.id IS NOT NULL OR civicrm_contribution.id IS NOT NULL) )";
}
}
$sql = "
SELECT {$select}
FROM {$from}
WHERE {$where}
{$orderBy}
";
if (isset($limit)) {
$sql .= "{$limit}";
}
$result = CRM_Core_DAO::executeQuery($sql);
return $result;
}
public static function buildSearchForm(&$form) {
$paymentStatus = CRM_Core_OptionGroup::values('grant_payment_status');
$form->add('select', 'payment_status_id', ts('Status'),
......
{*
+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2018 |
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*}
{* this template is used for batch transaction screen, assign/remove transactions to batch *}
{if in_array($batchStatus, array('Open', 'Reopened'))}
<div class="crm-form-block crm-search-form-block">
<div class="crm-accordion-wrapper crm-batch_transaction_search-accordion collapsed">
<div class="crm-accordion-header crm-master-accordion-header">
{ts}Edit Search Criteria{/ts}
</div>
<div class="crm-accordion-body">
<div id="searchForm" class="crm-block crm-form-block crm-contact-custom-search-activity-search-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr>
<td class="font-size12pt" colspan="2">
{$form.sort_name.label}<br>
{$form.sort_name.html|crmAddClass:'twenty'}
</td>
</tr>
<tr>
{if $form.contact_tags}
<td>
<label>{ts}Contributor Tag(s){/ts}</label><br>
{$form.contact_tags.html}
</td>
{else}
<td>&nbsp;</td>
{/if}
{if $form.group}
<td><label>{ts}Contributor Group(s){/ts}</label><br>
{$form.group.html}
</td>
{else}
<td>&nbsp;</td>
{/if}
</tr>
{include file="CRM/Contribute/Form/Search/Common.tpl"}
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
</div>
</div>
</div>
{if in_array($batchStatus, array('Open', 'Reopened'))}
<div class="form-layout-compressed">{$form.trans_assign.html}&nbsp;{$form.submit.html}</div><br/>
{/if}
<div id="ltype">
<p></p>
<div class="form-item">
{strip}
<table id="crm-transaction-selector-assign-{$entityID}" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th class="crm-transaction-checkbox">{if in_array($batchStatus, array('Open', 'Reopened'))}{$form.toggleSelect.html}{/if}</th>
<th class="crm-contact-type"></th>
<th class="crm-contact-name">{ts}Name{/ts}</th>
<th class="crm-amount">{ts}Amount{/ts}</th>
<th class="crm-trxnID">{ts}Trxn ID{/ts}</th>
<th class="crm-trxn_date">{ts}Payment/Transaction Date{/ts}</th>
<th class="crm-received">{ts}Contribution Date{/ts}</th>
<th class="crm-payment-method">{ts}Pay Method{/ts}</th>
<th class="crm-status">{ts}Status{/ts}</th>
<th class="crm-type">{ts}Financial Type{/ts}</th>
<th class="crm-transaction-links"></th>
</tr>
</thead>
</table>
{/strip}
</div>
</div>
{/if}
{literal}
<script type="text/javascript">
CRM.$(function($) {
CRM.$('#_qf_BatchTransaction_submit-top, #_qf_BatchTransaction_submit-bottom').click(function() {
CRM.$('.crm-batch_transaction_search-accordion:not(.collapsed)').crmAccordionToggle();
});
var batchStatus = {/literal}{$statusID}{literal};
{/literal}{if $validStatus}{literal}
// build transaction listing only for open/reopened batches
var paymentInstrumentID = {/literal}{if $paymentInstrumentID neq null}{$paymentInstrumentID}{else}'null'{/if}{literal};
if (paymentInstrumentID != 'null') {
buildTransactionSelectorAssign( true );
}
else {
buildTransactionSelectorAssign( false );
}
buildTransactionSelectorRemove();
CRM.$('#_qf_BatchTransaction_submit-bottom, #_qf_BatchTransaction_submit-top').click( function() {
buildTransactionSelectorAssign( true );
return false;
});
CRM.$("#trans_assign").prop('disabled',true);
CRM.$("#trans_remove").prop('disabled',true);
CRM.$('#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect').click( function() {
enableActions('x');
});
CRM.$('#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects').click( function() {
enableActions('y');
});
CRM.$('#Go').click( function() {
return selectAction("trans_assign","toggleSelect", "crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']");
});
CRM.$('#GoRemove').click( function() {
return selectAction("trans_remove","toggleSelects", "crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']");
});
CRM.$('#Go').click( function() {
if (CRM.$("#trans_assign" ).val() != "" && CRM.$("input[id^='mark_x_']").is(':checked')) {
bulkAssignRemove('Assign');
}
return false;
});
CRM.$('#GoRemove').click( function() {
if (CRM.$("#trans_remove" ).val() != "" && CRM.$("input[id^='mark_y_']").is(':checked')) {
bulkAssignRemove('Remove');
}
return false;
});
CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").click( function() {
enableActions('x');
});
CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").click( function() {
enableActions('y');
});
CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").click( function() {
toggleFinancialSelections('#toggleSelect', 'assign');
});
CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").click( function() {
toggleFinancialSelections('#toggleSelects', 'remove');
});
{/literal}{else}{literal}
buildTransactionSelectorRemove();
{/literal}{/if}{literal}
});
function enableActions( type ) {
if (type == 'x') {
CRM.$("#trans_assign").prop('disabled',false);
}
else {
CRM.$("#trans_remove").prop('disabled',false);
}
}
function toggleFinancialSelections(toggleID, toggleClass) {
var mark = 'x';
if (toggleClass == 'remove') {
mark = 'y';
}
if (CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} " + toggleID).is(':checked')) {
CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} input[id^='mark_" + mark + "_']").prop('checked',true);
}
else {
CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} input[id^='mark_" + mark + "_']").prop('checked',false);
}
}
function buildTransactionSelectorAssign(filterSearch) {
var columns = '';
var sourceUrl = {/literal}'{crmURL p="civicrm/getfinancialtransaction" h=0 q="&snippet=4&context=financialBatch&entityID=$entityID&notPresent=1&statusID=$statusID"}'{literal};
if ( filterSearch ) {
sourceUrl = sourceUrl+"&search=1";
var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}None found.{/ts}{literal}</li></ul></div>';
}
crmBatchSelector1 = CRM.$('#crm-transaction-selector-assign-{/literal}{$entityID}{literal}').dataTable({
"bDestroy" : true,
"bFilter" : false,
"bAutoWidth" : false,
"lengthMenu": [ 10, 25, 50, 100, 250, 500, 1000, 2000 ],
"aaSorting" : [[5, 'desc']],
"aoColumns" : [
{sClass:'crm-transaction-checkbox', bSortable:false},
{sClass:'crm-contact-type', bSortable:false},
{sClass:'crm-contact-name'},
{sClass:'crm-amount'},
{sClass:'crm-trxnID'},
{sClass:'crm-trxn_date'},
{sClass:'crm-received'},
{sClass:'crm-payment-method'},
{sClass:'crm-status'},
{sClass:'crm-type'},
{sClass:'crm-transaction-links', bSortable:false}
],
"bProcessing": true,
"asStripClasses" : [ "odd-row", "even-row" ],
"sPaginationType": "full_numbers",
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"iDisplayLength": 25,
"oLanguage": {
"sZeroRecords": ZeroRecordText,
"sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
"sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
"sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
"sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
"sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
"sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
"oPaginate": {
"sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
"sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
"sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
"sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
}
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
if ( filterSearch ) {
CRM.$('#searchForm :input').each(function() {
if (CRM.$(this).val()) {
aoData.push(
{name:CRM.$(this).attr('id'), value: CRM.$(this).val()}
);
CRM.$(':radio, :checkbox').each(function() {
if (CRM.$(this).is(':checked')) {
aoData.push( { name: CRM.$(this).attr('name'), value: CRM.$(this).val() } );
}
});
}
});
}
CRM.$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(b) {
fnCallback(b);
toggleFinancialSelections('#toggleSelect', 'assign');
}
});
}
});
}
function buildTransactionSelectorRemove( ) {
var columns = '';
var sourceUrl = {/literal}'{crmURL p="civicrm/getfinancialtransaction" h=0 q="snippet=4&context=financialBatch&entityID=$entityID&statusID=$statusID"}'{literal};
crmBatchSelector = CRM.$('#crm-transaction-selector-remove-{/literal}{$entityID}{literal}').dataTable({
"bDestroy" : true,
"bFilter" : false,
"bAutoWidth" : false,
"aaSorting" : [[5, 'desc']],
"aoColumns" : [
{sClass:'crm-transaction-checkbox', bSortable:false},
{sClass:'crm-contact-type', bSortable:false},
{sClass:'crm-contact-name'},
{sClass:'crm-amount'},
{sClass:'crm-trxnID'},
{sClass:'crm-trxn_date'},
{sClass:'crm-received'},
{sClass:'crm-payment-method'},
{sClass:'crm-status'},
{sClass:'crm-type'},
{sClass:'crm-transaction-links', bSortable:false}
],
"bProcessing": true,
"asStripClasses" : [ "odd-row", "even-row" ],
"sPaginationType": "full_numbers",
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"iDisplayLength": 25,
"oLanguage": {
"sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
"sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
"sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
"sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
"sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
"sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
"oPaginate": {
"sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},