Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
grant_program
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Extensions
grant_program
Commits
c2364888
Commit
c2364888
authored
Oct 17, 2018
by
Monish Deb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CSV export fatal error fix
parent
306ef748
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
24 deletions
+89
-24
CRM/Financial/BAO/ExportFormat/CSV.php
CRM/Financial/BAO/ExportFormat/CSV.php
+78
-12
sql/message_templates/grant_payment_check_html.tpl
sql/message_templates/grant_payment_check_html.tpl
+11
-12
No files found.
CRM/Financial/BAO/ExportFormat/CSV.php
View file @
c2364888
...
...
@@ -82,11 +82,10 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
ft.trxn_id AS trxn_id,
cov.label AS payment_instrument,
ft.check_number,
CASE
WHEN eftc.entity_table = 'civicrm_contribution'
THEN c.source
ELSE cgp.label
END AS source,
c.source AS source,
c.id AS contribution_id,
c.contact_id AS contact_id,
eb.batch_id AS batch_id,
ft.currency AS currency,
cov_status.label AS status,
CASE
...
...
@@ -150,7 +149,7 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
*/
function
formatHeaders
(
$values
)
{
$arrayKeys
=
array_keys
(
$values
);
$headers
=
''
;
$headers
=
[]
;
if
(
!
empty
(
$arrayKeys
))
{
foreach
(
$values
[
$arrayKeys
[
0
]]
as
$title
=>
$value
)
{
$headers
[]
=
$title
;
...
...
@@ -220,4 +219,71 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
function
exportTRANS
()
{
}
/**
* Generate CSV array for export.
*
* @param array $export
*/
public
function
makeExport
(
$export
)
{
// getting data from admin page
$prefixValue
=
Civi
::
settings
()
->
get
(
'contribution_invoice_settings'
);
foreach
(
$export
as
$batchId
=>
$dao
)
{
$financialItems
=
array
();
$this
->
_batchIds
=
$batchId
;
$queryResults
=
array
();
while
(
$dao
->
fetch
())
{
$creditAccountName
=
$creditAccountType
=
$creditAccount
=
NULL
;
if
(
$dao
->
credit_account
)
{
$creditAccountName
=
$dao
->
credit_account_name
;
$creditAccountType
=
$dao
->
credit_account_type_code
;
$creditAccount
=
$dao
->
credit_account
;
}
else
{
$creditAccountName
=
$dao
->
from_credit_account_name
;
$creditAccountType
=
$dao
->
from_credit_account_type_code
;
$creditAccount
=
$dao
->
from_credit_account
;
}
$invoiceNo
=
CRM_Utils_Array
::
value
(
'invoice_prefix'
,
$prefixValue
)
.
""
.
$dao
->
contribution_id
;
$financialItems
[]
=
array
(
'Batch ID'
=>
$dao
->
batch_id
,
'Invoice No'
=>
$invoiceNo
,
'Contact ID'
=>
$dao
->
contact_id
,
'Financial Trxn ID/Internal ID'
=>
$dao
->
financial_trxn_id
,
'Transaction Date'
=>
$dao
->
trxn_date
,
'Debit Account'
=>
$dao
->
to_account_code
,
'Debit Account Name'
=>
$dao
->
to_account_name
,
'Debit Account Type'
=>
$dao
->
to_account_type_code
,
'Debit Account Amount (Unsplit)'
=>
$dao
->
debit_total_amount
,
'Transaction ID (Unsplit)'
=>
$dao
->
trxn_id
,
'Debit amount (Split)'
=>
$dao
->
amount
,
'Payment Instrument'
=>
$dao
->
payment_instrument
,
'Check Number'
=>
$dao
->
check_number
,
'Source'
=>
$dao
->
source
,
'Currency'
=>
$dao
->
currency
,
'Transaction Status'
=>
$dao
->
status
,
'Amount'
=>
$dao
->
amount
,
'Credit Account'
=>
$creditAccount
,
'Credit Account Name'
=>
$creditAccountName
,
'Credit Account Type'
=>
$creditAccountType
,
'Item Description'
=>
$dao
->
item_description
,
);
end
(
$financialItems
);
$queryResults
[]
=
get_object_vars
(
$dao
);
}
CRM_Utils_Hook
::
batchItems
(
$queryResults
,
$financialItems
);
$financialItems
[
'headers'
]
=
self
::
formatHeaders
(
$financialItems
);
self
::
export
(
$financialItems
);
}
parent
::
initiateDownload
();
}
}
sql/message_templates/grant_payment_check_html.tpl
View file @
c2364888
...
...
@@ -4,11 +4,10 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title></title>
</head>
{
foreach
from
=
$grantPayment
key
=
key
item
=
data
}
<body
>
{
foreach
from
=
$grantPayment
key
=
key
item
=
data
}
<!-- Stub 1 -->
<div
style=
"
height:300px;
font-size: 11px;"
>
<div
style=
"font-size: 11px;"
>
<div
style=
"float:right; text-align:right;"
>
{
$data.payment_id
}
</div>
<table
width=
"100%"
cellpadding=
0
cellspacing=
0
style=
"font-size: 11px;"
>
<tr><td
width=
"100%"
colspan=
"4"
>
RE:
{
$data.payment_reason
}
</td></tr>
...
...
@@ -64,6 +63,6 @@
</tr>
</table>
</div>
{/
foreach
}
</body>
{/
foreach
}
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment