-
-
Notifications
You must be signed in to change notification settings - Fork 827
/
Copy pathInvoice.php
575 lines (513 loc) · 22.6 KB
/
Invoice.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to email a group of
* contacts.
*/
class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
/**
* Are we operating in "single mode", i.e. updating the task of only
* one specific contribution?
*
* @var bool
*/
public $_single = FALSE;
/**
* Gives all the statues for conribution.
* @var int
*/
public $_contributionStatusId;
/**
* Gives the HTML template of PDF Invoice.
* @var string
*/
public $_messageInvoice;
/**
* This variable is used to assign parameters for HTML template of PDF Invoice.
* @var string
*/
public $_invoiceTemplate;
/**
* Selected output.
* @var string
*/
public $_selectedOutput;
/**
* Build all the data structures needed to build the form.
*/
public function preProcess() {
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($id) {
$this->_contributionIds = [$id];
$this->_componentClause = " civicrm_contribution.id IN ( $id ) ";
$this->_single = TRUE;
$this->assign('totalSelectedContributions', 1);
// set the redirection after actions
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$url = CRM_Utils_System::url('civicrm/contact/view/contribution',
"action=view&reset=1&id={$id}&cid={$contactId}&context=contribution&selectedChild=contribute"
);
CRM_Core_Session::singleton()->pushUserContext($url);
}
else {
parent::preProcess();
}
// check that all the contribution ids have status Completed, Pending, Refunded, or Partially Paid.
$this->_contributionStatusId = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$status = ['Completed', 'Pending', 'Refunded', 'Partially paid'];
$statusId = [];
foreach ($this->_contributionStatusId as $key => $value) {
if (in_array($value, $status)) {
$statusId[] = $key;
}
}
$Id = implode(",", $statusId);
$query = "SELECT count(*) FROM civicrm_contribution WHERE contribution_status_id NOT IN ($Id) AND {$this->_componentClause}";
$count = CRM_Core_DAO::singleValueQuery($query);
if ($count != 0) {
CRM_Core_Error::statusBounce(ts('Please select only contributions with Completed, Pending, Refunded, or Partially Paid status.'));
}
// we have all the contribution ids, so now we get the contact ids
parent::setContactIDs();
$this->assign('single', $this->_single);
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey=$qfKey";
}
$url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
$breadCrumb = [
[
'url' => $url,
'title' => ts('Search Results'),
],
];
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$this->_selectedOutput = CRM_Utils_Request::retrieve('select', 'String', $this);
$this->assign('selectedOutput', $this->_selectedOutput);
CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
if ($this->_selectedOutput == 'email') {
CRM_Utils_System::setTitle(ts('Email Invoice'));
}
else {
CRM_Utils_System::setTitle(ts('Print Contribution Invoice'));
}
}
/**
* Build the form object.
*/
public function buildQuickForm() {
$this->preventAjaxSubmit();
if (CRM_Core_Permission::check('administer CiviCRM')) {
$this->assign('isAdmin', 1);
}
$this->add('select', 'from_email_address', ts('From'), $this->_fromEmails, TRUE);
if ($this->_selectedOutput != 'email') {
$this->addElement('radio', 'output', NULL, ts('Email Invoice'), 'email_invoice');
$this->addElement('radio', 'output', NULL, ts('PDF Invoice'), 'pdf_invoice');
$this->addRule('output', ts('Selection required'), 'required');
$this->addFormRule(['CRM_Contribute_Form_Task_Invoice', 'formRule']);
}
else {
$this->addRule('from_email_address', ts('From Email Address is required'), 'required');
}
$this->add('wysiwyg', 'email_comment', ts('If you would like to add personal message to email please add it here. (If sending to more then one receipient the same message will be sent to each contact.)'), [
'rows' => 2,
'cols' => 40,
]);
$this->addButtons([
[
'type' => 'upload',
'name' => $this->_selectedOutput == 'email' ? ts('Send Email') : ts('Process Invoice(s)'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
}
/**
* Global validation rules for the form.
*
* @param array $values
*
* @return array
* list of errors to be posted back to the form
*/
public static function formRule($values) {
$errors = [];
if ($values['output'] == 'email_invoice' && empty($values['from_email_address'])) {
$errors['from_email_address'] = ts("From Email Address is required");
}
return $errors;
}
/**
* Process the form after the input has been submitted and validated.
*/
public function postProcess() {
$params = $this->controller->exportValues($this->_name);
self::printPDF($this->_contributionIds, $params, $this->_contactIds);
}
/**
* Process the PDf and email with activity and attachment on click of Print Invoices.
*
* @param array $contribIDs
* Contribution Id.
* @param array $params
* Associated array of submitted values.
* @param array $contactIds
* Contact Id.
*/
public static function printPDF($contribIDs, &$params, $contactIds) {
// get all the details needed to generate a invoice
$messageInvoice = [];
$invoiceTemplate = CRM_Core_Smarty::singleton();
$invoiceElements = CRM_Contribute_Form_Task_PDF::getElements($contribIDs, $params, $contactIds);
// gives the status id when contribution status is 'Refunded'
$contributionStatusID = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$refundedStatusId = CRM_Utils_Array::key('Refunded', $contributionStatusID);
$cancelledStatusId = CRM_Utils_Array::key('Cancelled', $contributionStatusID);
$pendingStatusId = CRM_Utils_Array::key('Pending', $contributionStatusID);
foreach ($invoiceElements['details'] as $contribID => $detail) {
$input = $ids = [];
if (in_array($detail['contact'], $invoiceElements['excludeContactIds'])) {
continue;
}
$input['component'] = $detail['component'];
$ids['contact'] = $detail['contact'];
$ids['contribution'] = $contribID;
$ids['contributionRecur'] = NULL;
$ids['contributionPage'] = NULL;
$ids['membership'] = $detail['membership'] ?? NULL;
$ids['participant'] = $detail['participant'] ?? NULL;
$ids['event'] = $detail['event'] ?? NULL;
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $contribID;
$contribution->fetch();
$contribution->loadRelatedObjects($input, $ids);
$input['amount'] = $contribution->total_amount;
$input['invoice_id'] = $contribution->invoice_id;
$input['receive_date'] = $contribution->receive_date;
$input['contribution_status_id'] = $contribution->contribution_status_id;
$input['organization_name'] = $contribution->_relatedObjects['contact']->organization_name;
// Fetch the billing address. getValues should prioritize the billing
// address, otherwise will return the primary address.
$billingAddress = [];
$addressDetails = CRM_Core_BAO_Address::getValues([
'contact_id' => $contribution->contact_id,
'is_billing' => 1,
]);
if (!empty($addressDetails)) {
$billingAddress = array_shift($addressDetails);
}
if ($contribution->contribution_status_id == $refundedStatusId || $contribution->contribution_status_id == $cancelledStatusId) {
$creditNoteId = $contribution->creditnote_id;
}
if (!$contribution->invoice_number) {
$contribution->invoice_number = CRM_Contribute_BAO_Contribution::getInvoiceNumber($contribution->id);
}
//to obtain due date for PDF invoice
$contributionReceiveDate = date('F j,Y', strtotime(date($input['receive_date'])));
$invoiceDate = date("F j, Y");
$dueDateSetting = Civi::settings()->get('invoice_due_date');
$dueDatePeriodSetting = Civi::settings()->get('invoice_due_date_period');
$dueDate = date('F j, Y', strtotime($contributionReceiveDate . "+" . $dueDateSetting . "" . $dueDatePeriodSetting));
$amountPaid = CRM_Core_BAO_FinancialTrxn::getTotalPayments($contribID, TRUE);
$amountDue = ($input['amount'] - $amountPaid);
// retrieving the subtotal and sum of same tax_rate
$dataArray = [];
$subTotal = 0;
$lineItem = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contribID);
foreach ($lineItem as $taxRate) {
if (isset($dataArray[(string) $taxRate['tax_rate']])) {
$dataArray[(string) $taxRate['tax_rate']] = $dataArray[(string) $taxRate['tax_rate']] + CRM_Utils_Array::value('tax_amount', $taxRate);
}
else {
$dataArray[(string) $taxRate['tax_rate']] = $taxRate['tax_amount'] ?? NULL;
}
$subTotal += CRM_Utils_Array::value('subTotal', $taxRate);
}
// to email the invoice
$mailDetails = [];
$values = [];
if ($contribution->_component == 'event') {
$daoName = 'CRM_Event_DAO_Event';
$pageId = $contribution->_relatedObjects['event']->id;
$mailElements = [
'title',
'confirm_from_name',
'confirm_from_email',
];
CRM_Core_DAO::commonRetrieveAll($daoName, 'id', $pageId, $mailDetails, $mailElements);
$values['title'] = $mailDetails[$contribution->_relatedObjects['event']->id]['title'] ?? NULL;
$values['confirm_from_name'] = $mailDetails[$contribution->_relatedObjects['event']->id]['confirm_from_name'] ?? NULL;
$values['confirm_from_email'] = $mailDetails[$contribution->_relatedObjects['event']->id]['confirm_from_email'] ?? NULL;
$title = $mailDetails[$contribution->_relatedObjects['event']->id]['title'] ?? NULL;
}
elseif ($contribution->_component == 'contribute') {
$daoName = 'CRM_Contribute_DAO_ContributionPage';
$pageId = $contribution->contribution_page_id;
$mailElements = [
'title',
'receipt_from_name',
'receipt_from_email',
'cc_receipt',
'bcc_receipt',
];
CRM_Core_DAO::commonRetrieveAll($daoName, 'id', $pageId, $mailDetails, $mailElements);
$values['title'] = CRM_Utils_Array::value('title', CRM_Utils_Array::value($contribution->contribution_page_id, $mailDetails));
$values['receipt_from_name'] = CRM_Utils_Array::value('receipt_from_name', CRM_Utils_Array::value($contribution->contribution_page_id, $mailDetails));
$values['receipt_from_email'] = CRM_Utils_Array::value('receipt_from_email', CRM_Utils_Array::value($contribution->contribution_page_id, $mailDetails));
$values['cc_receipt'] = CRM_Utils_Array::value('cc_receipt', CRM_Utils_Array::value($contribution->contribution_page_id, $mailDetails));
$values['bcc_receipt'] = CRM_Utils_Array::value('bcc_receipt', CRM_Utils_Array::value($contribution->contribution_page_id, $mailDetails));
$title = CRM_Utils_Array::value('title', CRM_Utils_Array::value($contribution->contribution_page_id, $mailDetails));
}
$source = $contribution->source;
$config = CRM_Core_Config::singleton();
if (!isset($params['forPage'])) {
$config->doNotAttachPDFReceipt = 1;
}
// get organization address
$domain = CRM_Core_BAO_Domain::getDomain();
$locParams = ['contact_id' => $domain->contact_id];
$locationDefaults = CRM_Core_BAO_Location::getValues($locParams);
if (isset($locationDefaults['address'][1]['state_province_id'])) {
$stateProvinceAbbreviationDomain = CRM_Core_PseudoConstant::stateProvinceAbbreviation($locationDefaults['address'][1]['state_province_id']);
}
else {
$stateProvinceAbbreviationDomain = '';
}
if (isset($locationDefaults['address'][1]['country_id'])) {
$countryDomain = CRM_Core_PseudoConstant::country($locationDefaults['address'][1]['country_id']);
}
else {
$countryDomain = '';
}
$invoiceNotes = Civi::settings()->get('invoice_notes') ?? NULL;
// parameters to be assign for template
$tplParams = [
'title' => $title,
'component' => $input['component'],
'id' => $contribution->id,
'source' => $source,
'invoice_number' => $contribution->invoice_number,
'invoice_id' => $contribution->invoice_id,
'resourceBase' => $config->userFrameworkResourceURL,
'defaultCurrency' => $config->defaultCurrency,
'amount' => $contribution->total_amount,
'amountDue' => $amountDue,
'amountPaid' => $amountPaid,
'invoice_date' => $invoiceDate,
'dueDate' => $dueDate,
'notes' => $invoiceNotes,
'display_name' => $contribution->_relatedObjects['contact']->display_name,
'lineItem' => $lineItem,
'dataArray' => $dataArray,
'refundedStatusId' => $refundedStatusId,
'pendingStatusId' => $pendingStatusId,
'cancelledStatusId' => $cancelledStatusId,
'contribution_status_id' => $contribution->contribution_status_id,
'contributionStatusName' => CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contribution->contribution_status_id),
'subTotal' => $subTotal,
'street_address' => $billingAddress['street_address'] ?? NULL,
'supplemental_address_1' => $billingAddress['supplemental_address_1'] ?? NULL,
'supplemental_address_2' => $billingAddress['supplemental_address_2'] ?? NULL,
'supplemental_address_3' => $billingAddress['supplemental_address_3'] ?? NULL,
'city' => $billingAddress['city'] ?? NULL,
'postal_code' => $billingAddress['postal_code'] ?? NULL,
'state_province' => $billingAddress['state_province'] ?? NULL,
'state_province_abbreviation' => $billingAddress['state_province_abbreviation'] ?? NULL,
// Kept for backwards compatibility
'stateProvinceAbbreviation' => $billingAddress['state_province_abbreviation'] ?? NULL,
'country' => $billingAddress['country'] ?? NULL,
'is_pay_later' => $contribution->is_pay_later,
'organization_name' => $contribution->_relatedObjects['contact']->organization_name,
'domain_organization' => $domain->name,
'domain_street_address' => CRM_Utils_Array::value('street_address', CRM_Utils_Array::value('1', $locationDefaults['address'])),
'domain_supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1', CRM_Utils_Array::value('1', $locationDefaults['address'])),
'domain_supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2', CRM_Utils_Array::value('1', $locationDefaults['address'])),
'domain_supplemental_address_3' => CRM_Utils_Array::value('supplemental_address_3', CRM_Utils_Array::value('1', $locationDefaults['address'])),
'domain_city' => CRM_Utils_Array::value('city', CRM_Utils_Array::value('1', $locationDefaults['address'])),
'domain_postal_code' => CRM_Utils_Array::value('postal_code', CRM_Utils_Array::value('1', $locationDefaults['address'])),
'domain_state' => $stateProvinceAbbreviationDomain,
'domain_country' => $countryDomain,
'domain_email' => CRM_Utils_Array::value('email', CRM_Utils_Array::value('1', $locationDefaults['email'])),
'domain_phone' => CRM_Utils_Array::value('phone', CRM_Utils_Array::value('1', $locationDefaults['phone'])),
];
if (isset($creditNoteId)) {
$tplParams['creditnote_id'] = $creditNoteId;
}
$pdfFileName = $contribution->invoice_number . ".pdf";
$sendTemplateParams = [
'groupName' => 'msg_tpl_workflow_contribution',
'valueName' => 'contribution_invoice_receipt',
'contactId' => $contribution->contact_id,
'tplParams' => $tplParams,
'PDFFilename' => $pdfFileName,
];
// from email address
$fromEmailAddress = $params['from_email_address'] ?? NULL;
// condition to check for download PDF Invoice or email Invoice
if ($invoiceElements['createPdf']) {
list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
if (isset($params['forPage'])) {
return $html;
}
else {
$mail = [
'subject' => $subject,
'body' => $message,
'html' => $html,
];
if ($mail['html']) {
$messageInvoice[] = $mail['html'];
}
else {
$messageInvoice[] = nl2br($mail['body']);
}
}
}
elseif ($contribution->_component == 'contribute') {
$email = CRM_Contact_BAO_Contact::getPrimaryEmail($contribution->contact_id);
$sendTemplateParams['tplParams'] = array_merge($tplParams, ['email_comment' => $invoiceElements['params']['email_comment']]);
$sendTemplateParams['from'] = $fromEmailAddress;
$sendTemplateParams['toEmail'] = $email;
$sendTemplateParams['cc'] = $values['cc_receipt'] ?? NULL;
$sendTemplateParams['bcc'] = $values['bcc_receipt'] ?? NULL;
list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
// functions call for adding activity with attachment
$fileName = self::putFile($html, $pdfFileName);
self::addActivities($subject, $contribution->contact_id, $fileName, $params, $contribution->id);
}
elseif ($contribution->_component == 'event') {
$email = CRM_Contact_BAO_Contact::getPrimaryEmail($contribution->contact_id);
$sendTemplateParams['tplParams'] = array_merge($tplParams, ['email_comment' => $invoiceElements['params']['email_comment']]);
$sendTemplateParams['from'] = $fromEmailAddress;
$sendTemplateParams['toEmail'] = $email;
$sendTemplateParams['cc'] = $values['cc_confirm'] ?? NULL;
$sendTemplateParams['bcc'] = $values['bcc_confirm'] ?? NULL;
list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
// functions call for adding activity with attachment
$fileName = self::putFile($html, $pdfFileName);
self::addActivities($subject, $contribution->contact_id, $fileName, $params, $contribution->id);
}
$invoiceTemplate->clearTemplateVars();
}
if ($invoiceElements['createPdf']) {
if (isset($params['forPage'])) {
return $html;
}
else {
CRM_Utils_PDF_Utils::html2pdf($messageInvoice, $pdfFileName, FALSE, [
'margin_top' => 10,
'margin_left' => 65,
'metric' => 'px',
]);
// functions call for adding activity with attachment
$fileName = self::putFile($html, $pdfFileName, [
'margin_top' => 10,
'margin_left' => 65,
'metric' => 'px',
]);
self::addActivities($subject, $contactIds, $fileName, $params);
CRM_Utils_System::civiExit();
}
}
else {
if ($invoiceElements['suppressedEmails']) {
$status = ts('Email was NOT sent to %1 contacts (no email address on file, or communication preferences specify DO NOT EMAIL, or contact is deceased).', [1 => $invoiceElements['suppressedEmails']]);
$msgTitle = ts('Email Error');
$msgType = 'error';
}
else {
$status = ts('Your mail has been sent.');
$msgTitle = ts('Sent');
$msgType = 'success';
}
CRM_Core_Session::setStatus($status, $msgTitle, $msgType);
}
}
/**
* Add activity for Email Invoice and the PDF Invoice.
*
* @param string $subject
* Activity subject.
* @param array $contactIds
* Contact Id.
* @param string $fileName
* Gives the location with name of the file.
* @param array $params
* For invoices.
* @param int $contributionId
* Contribution Id.
*
*/
public static function addActivities($subject, $contactIds, $fileName, $params, $contributionId = NULL) {
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$config = CRM_Core_Config::singleton();
$config->doNotAttachPDFReceipt = 1;
if (!empty($params['output']) && $params['output'] == 'pdf_invoice') {
$activityType = 'Downloaded Invoice';
}
else {
$activityType = 'Emailed Invoice';
}
$activityParams = [
'subject' => $subject,
'source_contact_id' => $userID,
'target_contact_id' => $contactIds,
'activity_type_id' => $activityType,
'activity_date_time' => date('YmdHis'),
'attachFile_1' => [
'uri' => $fileName,
'type' => 'application/pdf',
'location' => $fileName,
'upload_date' => date('YmdHis'),
],
];
if ($contributionId) {
$activityParams['source_record_id'] = $contributionId;
}
civicrm_api3('Activity', 'create', $activityParams);
}
/**
* Create the Invoice file in upload folder for attachment.
*
* @param string $html
* Content for pdf in html format.
*
* @param string $name
* @param array $format
*
* @return string
* Name of file which is in pdf format
*/
public static function putFile($html, $name = 'Invoice.pdf', $format = NULL) {
return CRM_Utils_Mail::appendPDF($name, $html, $format)['fullPath'] ?? '';
}
/**
* Callback to perform action on Print Invoice button.
*/
public static function getPrintPDF() {
$contributionId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject, FALSE);
$contributionIDs = [$contributionId];
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE);
$params = ['output' => 'pdf_invoice'];
CRM_Contribute_Form_Task_Invoice::printPDF($contributionIDs, $params, $contactId);
}
}