Skip to content

Commit

Permalink
Merge pull request #10789 from JMAConsulting/CRM-20987
Browse files Browse the repository at this point in the history
CRM-20987, added batch transaction column
  • Loading branch information
monishdeb authored Jul 31, 2017
2 parents 051396d + 0a3dfa4 commit f3df3c4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
15 changes: 11 additions & 4 deletions CRM/Financial/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,10 @@ public static function getFinancialTransactionsList() {
3 => 'amount',
4 => 'trxn_id',
5 => 'transaction_date',
6 => 'payment_method',
7 => 'status',
8 => 'name',
6 => 'receive_date',
7 => 'payment_method',
8 => 'status',
9 => 'name',
);

$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
Expand Down Expand Up @@ -287,6 +288,7 @@ public static function getFinancialTransactionsList() {
'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',
Expand All @@ -298,7 +300,8 @@ public static function getFinancialTransactionsList() {
'sort_name' => ts('Contact Name'),
'amount' => ts('Amount'),
'trxn_id' => ts('Trxn ID'),
'transaction_date' => ts('Received'),
'transaction_date' => ts('Transaction Date'),
'receive_date' => ts('Received'),
'payment_method' => ts('Payment Method'),
'status' => ts('Status'),
'name' => ts('Type'),
Expand Down Expand Up @@ -374,6 +377,9 @@ public static function getFinancialTransactionsList() {
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);
}
Expand Down Expand Up @@ -450,6 +456,7 @@ public static function getFinancialTransactionsList() {
'amount',
'trxn_id',
'transaction_date',
'receive_date',
'payment_method',
'status',
'name',
Expand Down
3 changes: 3 additions & 0 deletions templates/CRM/Financial/Form/BatchTransaction.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<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}Transaction Date{/ts}</th>
<th class="crm-received">{ts}Received{/ts}</th>
<th class="crm-payment-method">{ts}Pay Method{/ts}</th>
<th class="crm-status">{ts}Status{/ts}</th>
Expand Down Expand Up @@ -196,6 +197,7 @@ function buildTransactionSelectorAssign(filterSearch) {
{sClass:'crm-contact-name'},
{sClass:'crm-amount'},
{sClass:'crm-trxnID'},
{sClass:'crm-trxn_date'},
{sClass:'crm-received'},
{sClass:'crm-payment-method'},
{sClass:'crm-status'},
Expand Down Expand Up @@ -270,6 +272,7 @@ function buildTransactionSelectorRemove( ) {
{sClass:'crm-contact-name'},
{sClass:'crm-amount'},
{sClass:'crm-trxnID'},
{sClass:'crm-trxn_date'},
{sClass:'crm-received'},
{sClass:'crm-payment-method'},
{sClass:'crm-status'},
Expand Down
5 changes: 3 additions & 2 deletions templates/CRM/Financial/Page/BatchTransaction.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@
<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-trxnID">{ts}Trxn ID{/ts}</th>
<th class="crm-trxn_date">{ts}Transaction Date{/ts}</th>
<th class="crm-received">{ts}Received{/ts}</th>
<th class="crm-payment-method">{ts}Pay Method{/ts}</th>
<th class="crm-status">{ts}Status{/ts}</th>
<th class="crm-status">{ts}Status{/ts}</th>
<th class="crm-type">{ts}Type{/ts}</th>
<th class="crm-transaction-links"></th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Financial/Page/AjaxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testGetFinancialTransactionsList() {
$json = CRM_Financial_Page_AJAX::getFinancialTransactionsList();
$json = str_replace(rtrim(CIVICRM_UF_BASEURL, '/'), 'http://FIX ME', $json);
$this->assertEquals($json, '{"sEcho": 1, "iTotalRecords": 1, "iTotalDisplayRecords": 1, "aaData": [ ["","<a href=\"/index.php?q=civicrm/profile/view&amp;reset=1&amp;gid=7&amp;id=3&amp;snippet=4\" class=\"crm-summary-link\"><div'
. ' class=\"icon crm-icon Individual-icon\"></div></a>","<a href=/index.php?q=civicrm/contact/view&amp;reset=1&amp;cid=3>Anderson, Anthony</a>","$ 100.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",'
. ' class=\"icon crm-icon Individual-icon\"></div></a>","<a href=/index.php?q=civicrm/contact/view&amp;reset=1&amp;cid=3>Anderson, Anthony</a>","$ 100.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",'
. '"Credit Card","Completed","Donation","<span><a href=\"/index.php?q=civicrm/contact/view/contribution&amp;reset=1&amp;id=1&amp;cid=3&amp;action=view&amp;context=contribution&amp;'
. 'selectedChild=contribute\" class=\"action-item crm-hover-button\" title=\'View Contribution\' >View</a></span>"]] }');
}
Expand Down

0 comments on commit f3df3c4

Please sign in to comment.