Currently we have a non-std store for invoicing settings that we are checking, yet the form saves it using our stds.
This updates checks for these settings to actually check the right place
if (!$contributionID
&& CRM_Utils_Array::value('membership_id', $params)
- && self::checkContributeSettings('deferred_revenue_enabled')
+ && Civi::settings()->get('deferred_revenue_enabled')
) {
$memberStartDate = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $params['membership_id'], 'start_date');
if ($memberStartDate) {
* @return null
*/
public static function recordAlwaysAccountsReceivable(&$trxnParams, $contributionParams) {
- if (!self::checkContributeSettings('always_post_to_accounts_receivable')) {
+ if (!Civi::settings()->get('always_post_to_accounts_receivable')) {
return NULL;
}
$statusId = $contributionParams['contribution']->contribution_status_id;
}
// CRM-16189, add Revenue Recognition Date
- if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ if (Civi::settings()->get('deferred_revenue_enabled')) {
$revenueDate = $this->add('date', 'revenue_recognition_date', ts('Revenue Recognition Date'), CRM_Core_SelectValues::date(NULL, 'M Y', NULL, 5));
if ($this->_id && !CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($this->_id)) {
$revenueDate->freeze();
$this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'),
['class' => 'crm-form-submit cancel']
);
- if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ if (Civi::settings()->get('deferred_revenue_enabled')) {
$deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType();
$this->assign('deferredFinancialType', array_keys($deferredFinancialType));
}
$contributionParams = ['skipCleanMoney' => TRUE];
$lineItem = [];
$additionalParticipantDetails = [];
- if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ if (Civi::settings()->get('deferred_revenue_enabled')) {
$eventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'start_date');
if (strtotime($eventStartDate) > strtotime(date('Ymt'))) {
$contributionParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate));
);
}
- if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ if (Civi::settings()->get('deferred_revenue_enabled')) {
$eventStartDate = CRM_Utils_Array::value(
'start_date',
CRM_Utils_Array::value(
*
*/
public static function checkFinancialTypeHasDeferred($params, $contributionID = NULL, $priceSetFields = NULL) {
- if (!CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ if (!Civi::settings()->get('deferred_revenue_enabled')) {
return FALSE;
}
$recognitionDate = CRM_Utils_Array::value('revenue_recognition_date', $params);
$this->assign('membershipTypeId', $this->_id);
- if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ if (Civi::settings()->get('deferred_revenue_enabled')) {
$deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType();
$this->assign('deferredFinancialType', array_keys($deferredFinancialType));
}
* Test checkContributeSettings.
*/
public function testCheckContributeSettings() {
- $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
+ $settings = Civi::settings()->get('deferred_revenue_enabled');
$this->assertNull($settings);
$params = array(
'contribution_invoice_settings' => array(
),
);
$this->callAPISuccess('Setting', 'create', $params);
- $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
+ $settings = Civi::settings()->get('deferred_revenue_enabled');
$this->assertEquals($settings, 1, 'Check for settings has failed');
}