Merge pull request #19321 from colemanw/profileGetFieldsFix
[civicrm-core.git] / CRM / Utils / Check / Component / FinancialTypeAcls.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 class CRM_Utils_Check_Component_FinancialTypeAcls extends CRM_Utils_Check_Component {
18
19 /**
20 * @return CRM_Utils_Check_Message[]
21 * @throws CiviCRM_API3_Exception
22 */
23 public static function checkFinancialAclReport() {
24 $messages = [];
25 $ftAclSetting = Civi::settings()->get('acl_financial_type');
26 $financialAclExtension = civicrm_api3('extension', 'get', ['key' => 'biz.jmaconsulting.financialaclreport', 'sequential' => 1]);
27 if ($ftAclSetting && (($financialAclExtension['count'] == 1 && $financialAclExtension['values'][0]['status'] != 'installed') || $financialAclExtension['count'] !== 1)) {
28 $messages[] = new CRM_Utils_Check_Message(
29 __FUNCTION__,
30 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 <a href="%2">here</a>', [
31 1 => 'biz.jmaconsulting.financialaclreport',
32 2 => 'https://github.com/JMAConsulting/biz.jmaconsulting.financialaclreport',
33 ]),
34 ts('Extension Missing'),
35 \Psr\Log\LogLevel::WARNING,
36 'fa-server'
37 );
38 }
39
40 return $messages;
41 }
42
43 }