Commit 53a8f1d7 authored by Monish Deb's avatar Monish Deb

Remove overriden file

parent f9c0a2ed
......@@ -3,58 +3,66 @@
class CRM_Grantprograms_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',
);
$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');
$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;
$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 = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
$entityID = isset($_REQUEST['entityID']) ? CRM_Utils_Type::escape($_REQUEST['entityID'], 'String') : NULL;
$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;
$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_grant.contact_id as contact_id_grant',
'civicrm_contribution.id as contributionID',
'civicrm_grant.id as grantID',
'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',
'name',
'civicrm_contribution.currency as currency',
'civicrm_financial_trxn.status_id as status',
'civicrm_financial_trxn.check_number as check_number',
);
$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('Received'),
'payment_method' => ts('Payment Method'),
'status' => ts('Status'),
'name' => ts('Type'),
);
$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;
......@@ -64,10 +72,10 @@ class CRM_Grantprograms_AJAX {
$params['rp'] = $rowCount;
$params['context'] = $context;
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['total'] = 0;
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['total'] = 0;
// get batch list
if (isset($notPresent)) {
......@@ -97,9 +105,10 @@ class CRM_Grantprograms_AJAX {
}
}
$financialitems = array();
$formLinks = CRM_Financial_Form_BatchTransaction::links();
$pageLinks = CRM_Financial_Page_BatchTransaction::links();
$formLinks['view']['url'] = $pageLinks['view']['url'] = '%%url%%';
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) {
......@@ -108,64 +117,113 @@ class CRM_Grantprograms_AJAX {
continue;
}
$row[$financialItem->id][$columnKey] = $financialItem->$columnKey;
if ($columnKey == 'sort_name' && $financialItem->$columnKey) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=".$financialItem->contact_id);
$row[$financialItem->id][$columnKey] = '<a href='.$url.'>'.$financialItem->$columnKey.'</a>';
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_OptionGroup::getLabel('payment_instrument', $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') {
$row[$financialItem->id][$columnKey] = $row[$financialItem->id][$columnKey].' ('.$financialItem->check_number.')';
$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);
$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_OptionGroup::getLabel('contribution_status', $financialItem->$columnKey);
$row[$financialItem->id][$columnKey] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $financialItem->$columnKey);
}
}
if ($financialItem->grantID) {
$entityID = $financialItem->grantID;
$contactID = $financialItem->contact_id_grant;
$url = "civicrm/contact/view/grant";
}
elseif ($financialItem->contributionID) {
$entityID = $financialItem->contributionID;
$contactID = $financialItem->contact_id;
$url = "civicrm/contact/view/contribution";
}
if ($statusID == CRM_Core_OptionGroup::getValue('batch_status','Open')) {
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($formLinks, null, array('id' => $financialItem->id, 'contid' => $entityID, 'cid' => $contactID, 'url' => $url));
$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($pageLinks, null, array('id' => $financialItem->id, 'contid' => $entityID, 'cid' => $contactID, 'url' => $url));
$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;
unset($pageLinks['remove']);
$row[$financialItem->id]['action'] = CRM_Core_Action::formLink($pageLinks, null, array('id' => $financialItem->id, 'contid' => $entityID, 'cid' => $contactID, 'url' => $url));
$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);
}
$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, $contactID);
$financialitems = $row;
}
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements =
array(
'check', 'contact_type', 'sort_name',
'amount', 'trxn_id', 'transaction_date', 'payment_method', 'status', 'name', 'action',
);
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array(
'check',
'contact_type',
'sort_name',
'amount',
'trxn_id',
'transaction_date',
'receive_date',
'payment_method',
'status',
'name',
'action',
);
CRM_Core_Error::Debug_var('as', $financialitems);
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();
......
{*
+--------------------------------------------------------------------+
| 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},
"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) {
CRM.$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(b) {
fnCallback(b);
toggleFinancialSelections('#toggleSelects', 'remove');
}
});
}
});
}
function selectAction( id, toggleSelectId, checkId ) {
if (CRM.$("#"+ id ).is(':disabled')) {
return false;
}
else if (!CRM.$("#" + toggleSelectId).is(':checked') && !CRM.$("#" + checkId).is(':checked') && CRM.$("#" + id).val() != "") {
CRM.alert ({/literal}'{ts escape="js"}Please select one or more contributions for this action.{/ts}'{literal});
return false;
}
else if (CRM.$("#" + id).val() == "") {
CRM.alert ({/literal}'{ts escape="js"}Please select an action from the drop-down menu.{/ts}'{literal});
return false;
}
}
function bulkAssignRemove( action ) {
var postUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q="className=CRM_Financial_Page_AJAX&fnName=bulkAssignRemove&entityID=$entityID" }"{literal};
var fids = [];
if (action == 'Assign') {
CRM.$("input[id^='mark_x_']:checked").each( function () {
var a = CRM.$(this).attr('id');
fids.push(a);
});
}
if (action == 'Remove') {
CRM.$("input[id^='mark_y_']:checked").each( function () {
var a = CRM.$(this).attr('id');
fids.push