Commit bd266103 authored by KarinG's avatar KarinG
Browse files

but only for Individuals

parent e7b4da13
......@@ -171,15 +171,17 @@ function cdntaxreceipts_generateFormattedReceipt($receipt, &$collectedPdf = NULL
$result_get_name = civicrm_api3('Contact', 'get', array(
'sequential' => 1,
'return' => array("first_name", "last_name", "middle_name"),
'return' => array("first_name", "last_name", "middle_name","contact_type"),
'id' => $receipt['contact_id'],
));
if (strlen(trim($result_get_name['values'][0]['middle_name'])) > 0) {
$displayname = $result_get_name['values'][0]['first_name'] .' '. $result_get_name['values'][0]['middle_name'][0] .' '. $result_get_name['values'][0]['last_name'];
}
else {
$displayname = $result_get_name['values'][0]['first_name'] . ' '. $result_get_name['values'][0]['last_name'];
if ($result_get_name['values'][0]['contact_type'] == 'Individual') {
if (strlen(trim($result_get_name['values'][0]['middle_name'])) > 0) {
$displayname = $result_get_name['values'][0]['first_name'] . ' ' . $result_get_name['values'][0]['middle_name'][0] . ' ' . $result_get_name['values'][0]['last_name'];
}
else {
$displayname = $result_get_name['values'][0]['first_name'] . ' ' . $result_get_name['values'][0]['last_name'];
}
}
if ( $receipt['issue_type'] == 'single' ) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment