From 5c3f581971d6478c521edce1f8322f0d616d316c Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sun, 27 Aug 2017 18:29:38 +1000 Subject: [PATCH] CRM-21106 Add Warnings about new required extension to support Financial Type ACLs in reports CRM-21106 Make language less urgent indicating it will in the futre need the extension --- CRM/Upgrade/Incremental/General.php | 9 +++ .../Check/Component/FinancialTypeAcls.php | 55 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 CRM/Utils/Check/Component/FinancialTypeAcls.php diff --git a/CRM/Upgrade/Incremental/General.php b/CRM/Upgrade/Incremental/General.php index dca7b60d5d..a2add64131 100644 --- a/CRM/Upgrade/Incremental/General.php +++ b/CRM/Upgrade/Incremental/General.php @@ -126,6 +126,15 @@ class CRM_Upgrade_Incremental_General { // advanced feature in the hands of the sysadmin. $preUpgradeMessage .= '
' . ts('This database uses InnoDB Full Text Search for optimized searching. The upgrade procedure has not been tested with this feature. You should disable (and later re-enable) the feature by navigating to "Administer => System Settings => Miscellaneous".'); } + + $ftAclSetting = Civi::settings()->get('acl_financial_type'); + $financialAclExtension = civicrm_api3('extension', 'get', array('key' => 'biz.jmaconsulting.financialaclreport')); + if ($ftAclSetting && (($financialAclExtension['count'] == 1 && $financialAclExtension['status'] != 'Installed') || $financialAclExtension['count'] !== 1)) { + $preUpgradeMessage .= '
' . ts('CiviCRM will in the future require the extension %1 for CiviCRM Reports to work correctly with the Financial Type ACLs. The extension can be downloaded here', array( + 1 => 'biz.jmaconsulting.financialaclreport', + 2 => 'https://github.com/JMAConsulting/biz.jmaconsulting.financialaclreport', + )); + } } /** diff --git a/CRM/Utils/Check/Component/FinancialTypeAcls.php b/CRM/Utils/Check/Component/FinancialTypeAcls.php new file mode 100644 index 0000000000..3785d49d79 --- /dev/null +++ b/CRM/Utils/Check/Component/FinancialTypeAcls.php @@ -0,0 +1,55 @@ +get('acl_financial_type'); + $financialAclExtension = civicrm_api3('extension', 'get', array('key' => 'biz.jmaconsulting.financialaclreport')); + if ($ftAclSetting && (($financialAclExtension['count'] == 1 && $financialAclExtension['status'] != 'Installed') || $financialAclExtension['count'] !== 1)) { + $messages[] = new CRM_Utils_Check_Message( + __FUNCTION__, + ts('CiviCRM will in the future require the extension %1 for CiviCRM Reports to work correctly with the Financial Type ACLs. The extension can be downloaded here', array( + 1 => 'biz.jmaconsulting.financialaclreport', + 2 => 'https://github.com/JMAConsulting/biz.jmaconsulting.financialaclreport', + )), + ts('Extension Missing'), + \Psr\Log\LogLevel::WARNING, + 'fa-server' + ); + } + + return $messages; + } + +} -- 2.25.1