Merge pull request #19321 from colemanw/profileGetFieldsFix
[civicrm-core.git] / CRM / Utils / Check / Component / AddressParsing.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_AddressParsing extends CRM_Utils_Check_Component {
18
19 /**
20 * @return CRM_Utils_Check_Message[]
21 */
22 public static function checkLocaleSupportsAddressParsing() {
23
24 $addressOptions = CRM_Core_BAO_Setting::valueOptions(
25 CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
26 'address_options'
27 );
28
29 $messages = [];
30
31 if ($addressOptions['street_address_parsing']) {
32 if (!CRM_Core_BAO_Address::isSupportedParsingLocale()) {
33 $config = CRM_Core_Config::singleton();
34 $messages[] = new CRM_Utils_Check_Message(
35 __FUNCTION__,
36 ts(
37 '<a href=' .
38 CRM_Utils_System::url('civicrm/admin/setting/preferences/address', 'reset=1') .
39 '">Street address parsing</a> is enabled but not supported by <a href="' .
40 CRM_Utils_System::url('civicrm/admin/setting/localization', 'reset=1') .
41 '">your locale</a> (%1).',
42 [1 => $config->lcMessages]
43 ),
44 ts('Street address parsing'),
45 \Psr\Log\LogLevel::WARNING,
46 'fa-address-card'
47 );
48 }
49 }
50
51 return $messages;
52 }
53
54 }