X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FSelectValues.php;h=9ebe8db0ce6f9374462a8e085c094779b48adfea;hb=ff6f993e56bf4f87caa0317ea3d1f883956b74da;hp=170f348a058a8f154625312f12ddaa8f054c96f5;hpb=57e842c143bb35fef5ae8058b216733f14e16f20;p=civicrm-core.git diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 170f348a05..9ebe8db0ce 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -87,7 +87,7 @@ class CRM_Core_SelectValues { 'month' => ts('month'), 'year' => ts('year'), ]; - if ($unitType == 'duration') { + if ($unitType === 'duration') { $unitList['lifetime'] = ts('lifetime'); } return $unitList; @@ -121,10 +121,10 @@ class CRM_Core_SelectValues { */ public static function emailSelectMethods() { return [ - 'automatic' => ts("Automatic"), - 'location-only' => ts("Only send to email addresses assigned to the specified location"), - 'location-prefer' => ts("Prefer email addresses assigned to the specified location"), - 'location-exclude' => ts("Exclude email addresses assigned to the specified location"), + 'automatic' => ts('Automatic'), + 'location-only' => ts('Only send to email addresses assigned to the specified location'), + 'location-prefer' => ts('Prefer email addresses assigned to the specified location'), + 'location-exclude' => ts('Exclude email addresses assigned to the specified location'), ]; } @@ -294,7 +294,7 @@ class CRM_Core_SelectValues { * * @return array * the date array - * @throws \Exception + * @throws CRM_Core_Exception */ public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') { // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime. @@ -312,7 +312,7 @@ class CRM_Core_SelectValues { $dao = new CRM_Core_DAO_PreferencesDate(); $dao->name = $type; if (!$dao->find(TRUE)) { - CRM_Core_Error::fatal(); + throw new CRM_Core_Exception('Date preferences not configured.'); } if (!$maxOffset) { $maxOffset = $dao->end; @@ -326,7 +326,7 @@ class CRM_Core_SelectValues { } if (empty($date['format'])) { - if ($context == 'Input') { + if ($context === 'Input') { $date['format'] = Civi::settings()->get('dateInputFormat'); } else { @@ -443,6 +443,27 @@ class CRM_Core_SelectValues { return $geo; } + /** + * Get options for displaying tax. + * + * @return array + * + * @throws \CRM_Core_Exception + */ + public function taxDisplayOptions() { + return [ + 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [ + 1 => CRM_Utils_Money::format(120), + ]), + 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [ + 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money::format(120), 2 => CRM_Utils_Money::format(20)]), + ]), + 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [ + 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money::format(120), 2 => CRM_Utils_Money::format(20)]), + ]), + ]; + } + /** * Get the Address Standardization Providers from available plugins. * @@ -477,6 +498,7 @@ class CRM_Core_SelectValues { '{domain.address}' => ts('Domain (organization) address'), '{domain.phone}' => ts('Domain (organization) phone'), '{domain.email}' => ts('Domain (organization) email'), + '{mailing.key}' => ts('Mailing key'), '{mailing.name}' => ts('Mailing name'), '{mailing.group}' => ts('Mailing group'), '{mailing.viewUrl}' => ts('Mailing permalink'), @@ -865,7 +887,7 @@ class CRM_Core_SelectValues { * * @return array */ - public static function getSearchBuilderOperators($fieldType = NULL) { + public static function getSearchBuilderOperators() { return [ '=' => '=', '!=' => '≠', @@ -1098,6 +1120,7 @@ class CRM_Core_SelectValues { * Dropdown options for quicksearch in the menu * * @return array + * @throws \CiviCRM_API3_Exception */ public static function quicksearchOptions() { $includeEmail = civicrm_api3('setting', 'getvalue', ['name' => 'includeEmailInName', 'group' => 'Search Preferences']);