}
}
elseif ($value['pseudoField'] == 'state_province_abbreviation') {
- $dao->$key = CRM_Core_PseudoConstant::stateProvinceAbbreviation($val);
+ // old bad code:
+// $dao->$key = CRM_Core_PseudoConstant::stateProvinceAbbreviation($val);
+ // iank: Return abbreviation if its a province from a country that uses abbreviations,
+ // otherwise return the name of the province.
+ // https://lab.civicrm.org/dev/core/issues/724
+ if (is_numeric(CRM_Core_PseudoConstant::stateProvinceAbbreviation($val))) {
+ $dao->$key = CRM_Core_PseudoConstant::stateProvince($val);
+ } else {
+ $dao->$key = CRM_Core_PseudoConstant::stateProvinceAbbreviation($val);
+ }
}
// @todo handle this in the section above for pseudoconstants.
elseif (in_array($value['pseudoField'], ['participant_role_id', 'participant_role'])) {
public static function getWildCardedValue($wildcard, $op, $value) {
if ($wildcard && $op === 'LIKE') {
if (CRM_Core_Config::singleton()->includeWildCardInName && (substr($value, 0, 1) != '%')) {
- return "%$value%";
+ $value = "%$value";
}
- else {
- return "$value%";
+ if (substr($value, -1, 1) != '%') {
+ $value = "$value%";
}
}
- else {
- return "$value";
- }
+ return "$value";
}
/**