Per reviewer feedback - we don't need to check more than just the one setting. The
UI (for better or worse) ties the 2 together so under normal operation
they will be set together but we don't need to check that
'toName' => $form->_contributorDisplayName,
'toEmail' => $form->_contributorEmail,
'PDFFilename' => ts('receipt') . '.pdf',
- 'isEmailPdf' => Civi::settings()->get('invoicing') && Civi::settings()->get('invoice_is_email_pdf'),
+ 'isEmailPdf' => Civi::settings()->get('invoice_is_email_pdf'),
'contributionId' => $this->getCurrentRowContributionID(),
'isTest' => (bool) ($form->_action & CRM_Core_Action::PREVIEW),
]
$sendTemplateParams['cc'] = $values['cc_receipt'] ?? NULL;
$sendTemplateParams['bcc'] = $values['bcc_receipt'] ?? NULL;
//send email with pdf invoice
- if (Civi::settings()->get('invoicing') && Civi::settings()->get('invoice_is_email_pdf')) {
+ if (Civi::settings()->get('invoice_is_email_pdf')) {
$sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $values['contribution_id'];
}
'toEmail' => $contributorEmail,
'isTest' => $form->_mode == 'test',
'PDFFilename' => ts('receipt') . '.pdf',
- 'isEmailPdf' => Civi::settings()->get('invoicing') && Civi::settings()->get('invoice_is_email_pdf'),
+ 'isEmailPdf' => Civi::settings()->get('invoice_is_email_pdf'),
]
);
$values['event']
);
- if (Civi::settings()->get('invoicing') && Civi::settings()->get('invoice_is_email_pdf') && !empty($values['contributionId'])) {
+ if (Civi::settings()->get('invoice_is_email_pdf') && !empty($values['contributionId'])) {
$sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $values['contributionId'];
}
);
$prefixValue = Civi::settings()->get('contribution_invoice_settings');
$invoicing = $prefixValue['invoicing'] ?? NULL;
- if (!empty($taxAmt) && (isset($invoicing) && Civi::settings()->get('invoice_is_email_pdf'))) {
+ if (Civi::settings()->get('invoice_is_email_pdf')) {
$sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $contributionId;
}
'toName' => $form->_contributorDisplayName,
'toEmail' => $form->_contributorEmail,
'PDFFilename' => ts('receipt') . '.pdf',
- 'isEmailPdf' => Civi::settings()->get('invoicing') && Civi::settings()->get('invoice_is_email_pdf'),
+ 'isEmailPdf' => Civi::settings()->get('invoice_is_email_pdf'),
'contributionId' => $formValues['contribution_id'],
'isTest' => (bool) ($form->_action & CRM_Core_Action::PREVIEW),
]
/**
* Enable Tax and Invoicing
- *
- * @throws \CRM_Core_Exception
*/
- protected function disableTaxAndInvoicing(): \Civi\Core\SettingsBag {
+ protected function disableTaxAndInvoicing(): void {
$accounts = $this->callAPISuccess('EntityFinancialAccount', 'get', ['account_relationship' => 'Sales Tax Account is'])['values'];
foreach ($accounts as $account) {
$this->callAPISuccess('EntityFinancialAccount', 'delete', ['id' => $account['id']]);
if (!empty(\Civi::$statics['CRM_Core_PseudoConstant']) && isset(\Civi::$statics['CRM_Core_PseudoConstant']['taxRates'])) {
unset(\Civi::$statics['CRM_Core_PseudoConstant']['taxRates']);
}
- return Civi::settings()->set('invoicing', FALSE);
+ Civi::settings()->set('invoice_is_email_pdf', FALSE);
+ Civi::settings()->set('invoicing', FALSE);
}
/**