Added extension to add address format for country

This commit is contained in:
2018-07-10 03:44:48 +05:30
commit eb00473adb
13 changed files with 1832 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
class CRM_AddressFormat_APIWrapper implements API_Wrapper {
/**
* the wrapper contains a method that allows you to alter the parameters of the api request (including the action and the entity)
*/
public function fromApiInput($apiRequest) {
return $apiRequest;
}
/**
* alter the result before returning it to the caller.
*/
public function toApiOutput($apiRequest, $result) {
if (isset($result['id'])) {
$countryId = CRM_Utils_Array::value('country_id', $apiRequest['params']);
if ($countryId) {
CRM_AddressFormat_BAO_CountryAddressFormat::updateCountry($countryId, $result['id']);
}
}
return $result;
}
}