'user_dashboard_options'])['values'][CRM_Core_Config::domainID()]['user_dashboard_options']; $optionValues = civicrm_api3('Setting', 'getoptions', ['field' => 'user_dashboard_options'])['values']; $invoiceKey = array_search('Invoices / Credit Notes', $optionValues); $existingIndex = array_search($invoiceKey, $existingUserViewOptions); if ($newValue && $existingIndex === FALSE) { $existingUserViewOptions[] = $invoiceKey; } elseif (!$newValue && $existingIndex !== FALSE) { unset($existingUserViewOptions[$existingIndex]); } civicrm_api3('Setting', 'create', ['user_dashboard_options' => $existingUserViewOptions]); } /** * Function to call to determine if invoicing is enabled. * * Historically the invoicing was declared as a setting but actually * set within contribution_invoice_settings (which stores multiple settings * as an array in a non-standard way). * * We check both here. But will deprecate the latter in time. */ public static function isInvoicingEnabled() { if (Civi::settings()->get('invoicing')) { return TRUE; } $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); return $invoiceSettings['invoicing'] ?? NULL; } /** * Function to get the tax term. * * The value is nested in the contribution_invoice_settings setting - which * is unsupported. Here we have a wrapper function to make later cleanup easier. */ public static function getTaxTerm() { return Civi::settings()->get('tax_term'); } }