dev/core#1724 - Backward-compatible handling of 'contribution_invoice_settings.invoicing'
authorTim Otten <totten@civicrm.org>
Wed, 29 Apr 2020 04:54:12 +0000 (21:54 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 29 Apr 2020 23:34:36 +0000 (16:34 -0700)
commit84d52986c4ebd93b55741bc62dcabe2c8a4e610e
tree63b8029d67fea952bb7aa5842da53121228e51b7
parent6f306db38752ff81d5def481e3490b63a88d4c99
dev/core#1724 - Backward-compatible handling of 'contribution_invoice_settings.invoicing'

In the old setting `contribution_invoice_settings`, the `invoicing`
property (aka "CiviContribute Component Settings" => "Enable Tax and
Invoicing") could take one of two values:

1. If enabled, it's an array with trueish subkey: `['invoicing'=>1]`
2. If disabled, it's a numeric zero.

This encoding is weird, and `contribution_invoice_settings` is generally deprecated
and has been replaced by a virtual rendition which needs to be consistent with the
old representation -- so that a couple-dozen things continue working.

For testing, it helped me to try these commands at different points:

```
cv ev 'return CRM_Invoicing_Utils::isInvoicingEnabled();'
cv api setting.get return=invoicing
cv api setting.get return=contribution_invoice_settings

select * from civicrm_setting where name like 'contrib%' or name like 'invoic%';
```
Civi/Core/SettingsBag.php