Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
6b83d5bd | 6 | | Copyright CiviCRM LLC (c) 2004-2019 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
e70a7fc0 | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * @package CRM | |
6b83d5bd | 31 | * @copyright CiviCRM LLC (c) 2004-2019 |
6a488035 TO |
32 | */ |
33 | class CRM_Contribute_Form_AdditionalInfo { | |
34 | ||
35 | /** | |
c490a46a | 36 | * Build the form object for Premium Information. |
6a488035 | 37 | * |
3e6a1f4a | 38 | * Called from the CRM_Contribute_Form_Contribute function and seemingly nowhere else. |
6a488035 | 39 | * |
3e6a1f4a | 40 | * Probably this should be on the form that uses it since it is not used on multiple forms. |
dd244018 | 41 | * |
3e6a1f4a EM |
42 | * Putting it on this class doesn't seem to reduce complexity. |
43 | * | |
44 | * @param CRM_Core_Form $form | |
6a488035 | 45 | */ |
00be9182 | 46 | public static function buildPremium(&$form) { |
6a488035 TO |
47 | //premium section |
48 | $form->add('hidden', 'hidden_Premium', 1); | |
49 | $sel1 = $sel2 = array(); | |
50 | ||
51 | $dao = new CRM_Contribute_DAO_Product(); | |
52 | $dao->is_active = 1; | |
53 | $dao->find(); | |
54 | $min_amount = array(); | |
ccc29f8e | 55 | $sel1[0] = ts('-select product-'); |
6a488035 TO |
56 | while ($dao->fetch()) { |
57 | $sel1[$dao->id] = $dao->name . " ( " . $dao->sku . " )"; | |
58 | $min_amount[$dao->id] = $dao->min_contribution; | |
59 | $options = explode(',', $dao->options); | |
60 | foreach ($options as $k => $v) { | |
61 | $options[$k] = trim($v); | |
62 | } | |
63 | if ($options[0] != '') { | |
64 | $sel2[$dao->id] = $options; | |
65 | } | |
66 | $form->assign('premiums', TRUE); | |
67 | } | |
68 | $form->_options = $sel2; | |
69 | $form->assign('mincontribution', $min_amount); | |
353ffa53 | 70 | $sel = &$form->addElement('hierselect', "product_name", ts('Premium'), 'onclick="showMinContrib();"'); |
6a488035 TO |
71 | $js = "<script type='text/javascript'>\n"; |
72 | $formName = 'document.forms.' . $form->getName(); | |
73 | ||
74 | for ($k = 1; $k < 2; $k++) { | |
75 | if (!isset($defaults['product_name'][$k]) || (!$defaults['product_name'][$k])) { | |
76 | $js .= "{$formName}['product_name[$k]'].style.display = 'none';\n"; | |
77 | } | |
78 | } | |
79 | ||
80 | $sel->setOptions(array($sel1, $sel2)); | |
81 | $js .= "</script>\n"; | |
82 | $form->assign('initHideBoxes', $js); | |
83 | ||
84 | $form->addDate('fulfilled_date', ts('Fulfilled'), FALSE, array('formatType' => 'activityDate')); | |
85 | $form->addElement('text', 'min_amount', ts('Minimum Contribution Amount')); | |
86 | } | |
87 | ||
88 | /** | |
c490a46a | 89 | * Build the form object for Additional Details. |
6a488035 | 90 | * |
c490a46a | 91 | * @param CRM_Core_Form $form |
6a488035 | 92 | */ |
00be9182 | 93 | public static function buildAdditionalDetail(&$form) { |
6a488035 TO |
94 | //Additional information section |
95 | $form->add('hidden', 'hidden_AdditionalDetail', 1); | |
96 | ||
97 | $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution'); | |
98 | ||
b25212e8 | 99 | $form->addField('thankyou_date', array('entity' => 'contribution'), FALSE, FALSE); |
6a488035 TO |
100 | |
101 | // add various amounts | |
353ffa53 TO |
102 | $nonDeductAmount = &$form->add('text', 'non_deductible_amount', ts('Non-deductible Amount'), |
103 | $attributes['non_deductible_amount'] | |
6a488035 TO |
104 | ); |
105 | $form->addRule('non_deductible_amount', ts('Please enter a valid monetary value for Non-deductible Amount.'), 'money'); | |
106 | ||
107 | if ($form->_online) { | |
108 | $nonDeductAmount->freeze(); | |
109 | } | |
353ffa53 TO |
110 | $feeAmount = &$form->add('text', 'fee_amount', ts('Fee Amount'), |
111 | $attributes['fee_amount'] | |
6a488035 TO |
112 | ); |
113 | $form->addRule('fee_amount', ts('Please enter a valid monetary value for Fee Amount.'), 'money'); | |
114 | if ($form->_online) { | |
115 | $feeAmount->freeze(); | |
116 | } | |
0e6e8724 | 117 | |
353ffa53 TO |
118 | $element = &$form->add('text', 'invoice_id', ts('Invoice ID'), |
119 | $attributes['invoice_id'] | |
6a488035 TO |
120 | ); |
121 | if ($form->_online) { | |
122 | $element->freeze(); | |
123 | } | |
124 | else { | |
125 | $form->addRule('invoice_id', | |
126 | ts('This Invoice ID already exists in the database.'), | |
127 | 'objectExists', | |
128 | array('CRM_Contribute_DAO_Contribution', $form->_id, 'invoice_id') | |
129 | ); | |
130 | } | |
933c5f44 | 131 | $element = $form->add('text', 'creditnote_id', ts('Credit Note ID'), |
132 | $attributes['creditnote_id'] | |
133 | ); | |
134 | if ($form->_online) { | |
135 | $element->freeze(); | |
136 | } | |
137 | else { | |
138 | $form->addRule('creditnote_id', | |
139 | ts('This Credit Note ID already exists in the database.'), | |
140 | 'objectExists', | |
141 | array('CRM_Contribute_DAO_Contribution', $form->_id, 'creditnote_id') | |
142 | ); | |
143 | } | |
6a488035 TO |
144 | |
145 | $form->add('select', 'contribution_page_id', | |
146 | ts('Online Contribution Page'), | |
147 | array( | |
21dfd5f5 | 148 | '' => ts('- select -'), |
6a488035 TO |
149 | ) + |
150 | CRM_Contribute_PseudoConstant::contributionPage() | |
151 | ); | |
152 | ||
153 | $form->add('textarea', 'note', ts('Notes'), array("rows" => 4, "cols" => 60)); | |
0e6e8724 | 154 | |
6a488035 TO |
155 | $statusName = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); |
156 | if ($form->_id && $form->_values['contribution_status_id'] == array_search('Cancelled', $statusName)) { | |
157 | $netAmount->freeze(); | |
158 | $feeAmount->freeze(); | |
159 | } | |
0e6e8724 | 160 | |
6a488035 TO |
161 | } |
162 | ||
6a488035 | 163 | /** |
dc195289 | 164 | * used by CRM/Pledge/Form/Pledge.php |
6a488035 | 165 | * |
c490a46a | 166 | * Build the form object for PaymentReminders Information. |
6a488035 | 167 | * |
c490a46a | 168 | * @param CRM_Core_Form $form |
6a488035 | 169 | */ |
00be9182 | 170 | public static function buildPaymentReminders(&$form) { |
6a488035 TO |
171 | //PaymentReminders section |
172 | $form->add('hidden', 'hidden_PaymentReminders', 1); | |
173 | $form->add('text', 'initial_reminder_day', ts('Send Initial Reminder'), array('size' => 3)); | |
3f4b742c | 174 | $form->addRule('initial_reminder_day', ts('Please enter a valid reminder day.'), 'positiveInteger'); |
6a488035 | 175 | $form->add('text', 'max_reminders', ts('Send up to'), array('size' => 3)); |
3f4b742c | 176 | $form->addRule('max_reminders', ts('Please enter a valid No. of reminders.'), 'positiveInteger'); |
6a488035 | 177 | $form->add('text', 'additional_reminder_day', ts('Send additional reminders'), array('size' => 3)); |
3f4b742c | 178 | $form->addRule('additional_reminder_day', ts('Please enter a valid additional reminder day.'), 'positiveInteger'); |
6a488035 TO |
179 | } |
180 | ||
181 | /** | |
fe482240 | 182 | * Process the Premium Information. |
6a488035 | 183 | * |
c490a46a | 184 | * @param array $params |
100fef9d CW |
185 | * @param int $contributionID |
186 | * @param int $premiumID | |
d6412fc1 | 187 | * @param array $options |
6a488035 | 188 | */ |
3e6a1f4a EM |
189 | public static function processPremium($params, $contributionID, $premiumID = NULL, $options = array()) { |
190 | $selectedProductID = $params['product_name'][0]; | |
99af166d | 191 | $selectedProductOptionID = CRM_Utils_Array::value(1, $params['product_name']); |
3e6a1f4a | 192 | |
6a488035 TO |
193 | $dao = new CRM_Contribute_DAO_ContributionProduct(); |
194 | $dao->contribution_id = $contributionID; | |
3e6a1f4a | 195 | $dao->product_id = $selectedProductID; |
6a488035 | 196 | $dao->fulfilled_date = CRM_Utils_Date::processDate($params['fulfilled_date'], NULL, TRUE); |
353ffa53 | 197 | $isDeleted = FALSE; |
3e6a1f4a | 198 | |
6a488035 TO |
199 | //CRM-11106 |
200 | $premiumParams = array( | |
3e6a1f4a | 201 | 'id' => $selectedProductID, |
6a488035 | 202 | ); |
3e6a1f4a | 203 | |
6a488035 | 204 | $productDetails = array(); |
37828d4f | 205 | CRM_Contribute_BAO_Product::retrieve($premiumParams, $productDetails); |
6a488035 | 206 | $dao->financial_type_id = CRM_Utils_Array::value('financial_type_id', $productDetails); |
3e6a1f4a EM |
207 | if (!empty($options[$selectedProductID])) { |
208 | $dao->product_option = $options[$selectedProductID][$selectedProductOptionID]; | |
6a488035 TO |
209 | } |
210 | if ($premiumID) { | |
3e6a1f4a EM |
211 | $ContributionProduct = new CRM_Contribute_DAO_ContributionProduct(); |
212 | $ContributionProduct->id = $premiumID; | |
213 | $ContributionProduct->find(TRUE); | |
214 | if ($ContributionProduct->product_id == $selectedProductID) { | |
6a488035 | 215 | $dao->id = $premiumID; |
6a488035 TO |
216 | } |
217 | else { | |
3e6a1f4a | 218 | $ContributionProduct->delete(); |
6a488035 | 219 | $isDeleted = TRUE; |
6a488035 TO |
220 | } |
221 | } | |
3e6a1f4a EM |
222 | |
223 | $dao->save(); | |
6a488035 TO |
224 | //CRM-11106 |
225 | if ($premiumID == NULL || $isDeleted) { | |
3e6a1f4a | 226 | $premiumParams = array( |
6a488035 TO |
227 | 'cost' => CRM_Utils_Array::value('cost', $productDetails), |
228 | 'currency' => CRM_Utils_Array::value('currency', $productDetails), | |
229 | 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $productDetails), | |
21dfd5f5 | 230 | 'contributionId' => $contributionID, |
6a488035 TO |
231 | ); |
232 | if ($isDeleted) { | |
3e6a1f4a EM |
233 | $premiumParams['oldPremium']['product_id'] = $ContributionProduct->product_id; |
234 | $premiumParams['oldPremium']['contribution_id'] = $ContributionProduct->contribution_id; | |
6a488035 | 235 | } |
3e6a1f4a | 236 | CRM_Core_BAO_FinancialTrxn::createPremiumTrxn($premiumParams); |
6a488035 TO |
237 | } |
238 | } | |
239 | ||
240 | /** | |
fe482240 | 241 | * Process the Note. |
6a488035 | 242 | * |
6a488035 | 243 | * |
c490a46a | 244 | * @param array $params |
100fef9d CW |
245 | * @param int $contactID |
246 | * @param int $contributionID | |
247 | * @param int $contributionNoteID | |
6a488035 | 248 | */ |
945f423d | 249 | public static function processNote($params, $contactID, $contributionID, $contributionNoteID = NULL) { |
5888a52d | 250 | if (CRM_Utils_System::isNull($params['note']) && $contributionNoteID) { |
251 | CRM_Core_BAO_Note::del($contributionNoteID); | |
252 | return; | |
253 | } | |
6a488035 TO |
254 | //process note |
255 | $noteParams = array( | |
256 | 'entity_table' => 'civicrm_contribution', | |
257 | 'note' => $params['note'], | |
258 | 'entity_id' => $contributionID, | |
259 | 'contact_id' => $contactID, | |
260 | ); | |
261 | $noteID = array(); | |
262 | if ($contributionNoteID) { | |
263 | $noteID = array("id" => $contributionNoteID); | |
264 | $noteParams['note'] = $noteParams['note'] ? $noteParams['note'] : "null"; | |
265 | } | |
266 | CRM_Core_BAO_Note::add($noteParams, $noteID); | |
267 | } | |
268 | ||
269 | /** | |
fe482240 | 270 | * Process the Common data. |
6a488035 | 271 | * |
c490a46a | 272 | * @param array $params |
95cdcc0f | 273 | * @param array $formatted |
c490a46a | 274 | * @param CRM_Core_Form $form |
6a488035 | 275 | */ |
00be9182 | 276 | public static function postProcessCommon(&$params, &$formatted, &$form) { |
6a488035 TO |
277 | $fields = array( |
278 | 'non_deductible_amount', | |
279 | 'total_amount', | |
280 | 'fee_amount', | |
6a488035 TO |
281 | 'trxn_id', |
282 | 'invoice_id', | |
933c5f44 | 283 | 'creditnote_id', |
6a488035 | 284 | 'campaign_id', |
6a488035 TO |
285 | 'contribution_page_id', |
286 | ); | |
287 | foreach ($fields as $f) { | |
288 | $formatted[$f] = CRM_Utils_Array::value($f, $params); | |
289 | } | |
290 | ||
a7488080 | 291 | if (!empty($params['thankyou_date']) && !CRM_Utils_System::isNull($params['thankyou_date'])) { |
6a488035 TO |
292 | $formatted['thankyou_date'] = CRM_Utils_Date::processDate($params['thankyou_date'], $params['thankyou_date_time']); |
293 | } | |
294 | else { | |
295 | $formatted['thankyou_date'] = 'null'; | |
296 | } | |
297 | ||
a7488080 | 298 | if (!empty($params['is_email_receipt'])) { |
6a488035 TO |
299 | $params['receipt_date'] = $formatted['receipt_date'] = date('YmdHis'); |
300 | } | |
301 | ||
6a488035 TO |
302 | //special case to handle if all checkboxes are unchecked |
303 | $customFields = CRM_Core_BAO_CustomField::getFields('Contribution', | |
304 | FALSE, | |
305 | FALSE, | |
306 | CRM_Utils_Array::value('financial_type_id', | |
307 | $params | |
308 | ) | |
309 | ); | |
310 | $formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($params, | |
6a488035 TO |
311 | CRM_Utils_Array::value('id', $params, NULL), |
312 | 'Contribution' | |
313 | ); | |
314 | } | |
315 | ||
316 | /** | |
100fef9d | 317 | * Send email receipt. |
6a488035 | 318 | * |
c490a46a | 319 | * @param CRM_Core_Form $form |
76e7a76c | 320 | * instance of Contribution form. |
014c4014 TO |
321 | * @param array $params |
322 | * (reference ) an assoc array of name/value pairs. | |
da6b46f4 | 323 | * @param bool $ccContribution |
76e7a76c | 324 | * is it credit card contribution. |
6a488035 | 325 | * |
d77a0a58 | 326 | * @return array |
6a488035 | 327 | */ |
00be9182 | 328 | public static function emailReceipt(&$form, &$params, $ccContribution = FALSE) { |
3f4b742c | 329 | $form->assign('receiptType', 'contribution'); |
6a488035 TO |
330 | // Retrieve Financial Type Name from financial_type_id |
331 | $params['contributionType_name'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', | |
332 | $params['financial_type_id']); | |
a7488080 | 333 | if (!empty($params['payment_instrument_id'])) { |
6a488035 TO |
334 | $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); |
335 | $params['paidBy'] = $paymentInstrument[$params['payment_instrument_id']]; | |
43f77a2c | 336 | if ($params['paidBy'] != 'Check' && isset($params['check_number'])) { |
5e8ae730 | 337 | unset($params['check_number']); |
43f77a2c | 338 | } |
6a488035 TO |
339 | } |
340 | ||
341 | // retrieve individual prefix value for honoree | |
1421174e | 342 | if (isset($params['soft_credit'])) { |
343 | $softCreditTypes = $softCredits = array(); | |
344 | foreach ($params['soft_credit'] as $key => $softCredit) { | |
345 | $softCredits[$key] = array( | |
346 | 'Name' => $softCredit['contact_name'], | |
21dfd5f5 | 347 | 'Amount' => CRM_Utils_Money::format($softCredit['amount'], $softCredit['currency']), |
1421174e | 348 | ); |
349 | $softCreditTypes[$key] = $softCredit['soft_credit_type_label']; | |
350 | } | |
351 | $form->assign('softCreditTypes', $softCreditTypes); | |
352 | $form->assign('softCredits', $softCredits); | |
6a488035 TO |
353 | } |
354 | ||
355 | // retrieve premium product name and assigned fulfilled | |
356 | // date to template | |
a7488080 | 357 | if (!empty($params['hidden_Premium'])) { |
6a488035 TO |
358 | if (isset($params['product_name']) && |
359 | is_array($params['product_name']) && | |
360 | !empty($params['product_name']) | |
361 | ) { | |
362 | $productDAO = new CRM_Contribute_DAO_Product(); | |
363 | $productDAO->id = $params['product_name'][0]; | |
43bf07d6 | 364 | $productOptionID = $params['product_name'][1]; |
6a488035 TO |
365 | $productDAO->find(TRUE); |
366 | $params['product_name'] = $productDAO->name; | |
367 | $params['product_sku'] = $productDAO->sku; | |
368 | ||
43bf07d6 EM |
369 | if (empty($params['product_option']) && !empty($form->_options[$productDAO->id])) { |
370 | $params['product_option'] = $form->_options[$productDAO->id][$productOptionID]; | |
6a488035 TO |
371 | } |
372 | } | |
373 | ||
a7488080 | 374 | if (!empty($params['fulfilled_date'])) { |
3f4b742c | 375 | $form->assign('fulfilled_date', CRM_Utils_Date::processDate($params['fulfilled_date'])); |
6a488035 TO |
376 | } |
377 | } | |
378 | ||
3f4b742c | 379 | $form->assign('ccContribution', $ccContribution); |
6a488035 | 380 | if ($ccContribution) { |
0b50eca0 | 381 | $form->assignBillingName($params); |
382 | $form->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters( | |
383 | $params, | |
384 | $form->_bltID | |
385 | )); | |
6a488035 TO |
386 | |
387 | $date = CRM_Utils_Date::format($params['credit_card_exp_date']); | |
388 | $date = CRM_Utils_Date::mysqlToIso($date); | |
3f4b742c KJ |
389 | $form->assign('credit_card_type', CRM_Utils_Array::value('credit_card_type', $params)); |
390 | $form->assign('credit_card_exp_date', $date); | |
391 | $form->assign('credit_card_number', | |
6a488035 TO |
392 | CRM_Utils_System::mungeCreditCard($params['credit_card_number']) |
393 | ); | |
394 | } | |
395 | else { | |
396 | //offline contribution | |
397 | // assigned various dates to the templates | |
398 | $form->assign('receipt_date', CRM_Utils_Date::processDate($params['receipt_date'])); | |
399 | ||
a7488080 | 400 | if (!empty($params['cancel_date'])) { |
6a488035 TO |
401 | $form->assign('cancel_date', CRM_Utils_Date::processDate($params['cancel_date'])); |
402 | } | |
a7488080 | 403 | if (!empty($params['thankyou_date'])) { |
6a488035 TO |
404 | $form->assign('thankyou_date', CRM_Utils_Date::processDate($params['thankyou_date'])); |
405 | } | |
406 | if ($form->_action & CRM_Core_Action::UPDATE) { | |
407 | $form->assign('lineItem', empty($form->_lineItems) ? FALSE : $form->_lineItems); | |
408 | } | |
409 | } | |
410 | ||
411 | //handle custom data | |
a7488080 | 412 | if (!empty($params['hidden_custom'])) { |
6a488035 TO |
413 | $contribParams = array(array('contribution_id', '=', $params['contribution_id'], 0, 0)); |
414 | if ($form->_mode == 'test') { | |
415 | $contribParams[] = array('contribution_test', '=', 1, 0, 0); | |
416 | } | |
417 | ||
418 | //retrieve custom data | |
419 | $customGroup = array(); | |
420 | ||
421 | foreach ($form->_groupTree as $groupID => $group) { | |
422 | $customFields = $customValues = array(); | |
423 | if ($groupID == 'info') { | |
424 | continue; | |
425 | } | |
426 | foreach ($group['fields'] as $k => $field) { | |
427 | $field['title'] = $field['label']; | |
428 | $customFields["custom_{$k}"] = $field; | |
429 | } | |
430 | ||
431 | //build the array of customgroup contain customfields. | |
432 | CRM_Core_BAO_UFGroup::getValues($params['contact_id'], $customFields, $customValues, FALSE, $contribParams); | |
433 | $customGroup[$group['title']] = $customValues; | |
434 | } | |
435 | //assign all custom group and corresponding fields to template. | |
436 | $form->assign('customGroup', $customGroup); | |
437 | } | |
438 | ||
439 | $form->assign_by_ref('formValues', $params); | |
440 | list($contributorDisplayName, | |
441 | $contributorEmail | |
442 | ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($params['contact_id']); | |
3f4b742c KJ |
443 | $form->assign('contactID', $params['contact_id']); |
444 | $form->assign('contributionID', $params['contribution_id']); | |
6a488035 | 445 | |
a7488080 | 446 | if (!empty($params['currency'])) { |
3f4b742c | 447 | $form->assign('currency', $params['currency']); |
6a488035 TO |
448 | } |
449 | ||
a7488080 | 450 | if (!empty($params['receive_date'])) { |
3f4b742c | 451 | $form->assign('receive_date', CRM_Utils_Date::processDate($params['receive_date'])); |
6a488035 TO |
452 | } |
453 | ||
353ffa53 TO |
454 | $template = CRM_Core_Smarty::singleton(); |
455 | $taxAmt = $template->get_template_vars('dataArray'); | |
456 | $eventTaxAmt = $template->get_template_vars('totalTaxAmount'); | |
aaffa79f | 457 | $prefixValue = Civi::settings()->get('contribution_invoice_settings'); |
353ffa53 TO |
458 | $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue); |
459 | if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) { | |
460 | $isEmailPdf = TRUE; | |
461 | } | |
462 | else { | |
463 | $isEmailPdf = FALSE; | |
464 | } | |
d75f2f47 | 465 | |
c6327d7d | 466 | list($sendReceipt, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( |
6a488035 TO |
467 | array( |
468 | 'groupName' => 'msg_tpl_workflow_contribution', | |
469 | 'valueName' => 'contribution_offline_receipt', | |
470 | 'contactId' => $params['contact_id'], | |
471 | 'contributionId' => $params['contribution_id'], | |
472 | 'from' => $params['from_email_address'], | |
473 | 'toName' => $contributorDisplayName, | |
474 | 'toEmail' => $contributorEmail, | |
475 | 'isTest' => $form->_mode == 'test', | |
92fcb95f | 476 | 'PDFFilename' => ts('receipt') . '.pdf', |
9161952c | 477 | 'isEmailPdf' => $isEmailPdf, |
6a488035 TO |
478 | ) |
479 | ); | |
480 | ||
481 | return $sendReceipt; | |
482 | } | |
483 | ||
484 | } |