//changes for freezing the invoices/credit notes checkbox if invoicing is uncheck
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
- $this->assign('invoicing', $invoicing);
+ $this->assign('invoicing', CRM_Invoicing_Utils::isInvoicingEnabled());
$this->addElement('submit', 'ckeditor_config', ts('Configure CKEditor'));
// build price set form.
$buildPriceSet = FALSE;
- $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled();
$this->assign('invoicing', $invoicing);
$buildRecurBlock = FALSE;
// assign values to the template
$this->assign($values);
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = CRM_Invoicing_Utils::isInvoicingEnabled();
$this->assign('invoicing', $invoicing);
$this->assign('isDeferred', CRM_Utils_Array::value('deferred_revenue_enabled', $invoiceSettings));
if ($invoicing && isset($values['tax_amount'])) {
*/
public function run() {
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$defaultInvoicePage = CRM_Utils_Array::value('default_invoice_page', $invoiceSettings);
- $this->assign('invoicing', $invoicing);
+ $this->assign('invoicing', CRM_Invoicing_Utils::isInvoicingEnabled());
$this->assign('defaultInvoicePage', $defaultInvoicePage);
parent::preProcess();
$this->listContribution();
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2018
*/
-
class CRM_Invoicing_Utils {
/**
return;
}
$existingUserViewOptions = civicrm_api3('Setting', 'get', ['return' => 'user_dashboard_options'])['values'][CRM_Core_Config::domainID()]['user_dashboard_options'];
- $optionValues= civicrm_api3('Setting', 'getoptions', ['field' => 'user_dashboard_options'])['values'];
+ $optionValues = civicrm_api3('Setting', 'getoptions', ['field' => 'user_dashboard_options'])['values'];
$invoiceKey = array_search('Invoices / Credit Notes', $optionValues);
$existingIndex = in_array($invoiceKey, $existingUserViewOptions);
$this->listenForPageContent();
}
+ /**
+ * Clean up after each test.
+ */
+ public function tearDown() {
+ $this->quickCleanUpFinancialEntities();
+ $this->quickCleanup(['civicrm_uf_match']);
+ }
+
/**
* Test the content of the dashboard.
*/
*/
public function testDashboardContentContributionsWithInvoicingEnabled() {
$this->contributionCreate(['contact_id' => $this->contactID]);
- $this->callAPISuccess('Setting', 'create', ['invoicing' => 1, 'contribution_invoice_settings' => [
- 'invoicing' => 1,
- ]]);
+ $this->callAPISuccess('Setting', 'create', ['invoicing' => 1]);
$this->runUserDashboard();
$expectedStrings = [
'Your Contribution(s)',