$this, TRUE, NULL, 'REQUEST'
);
if (!in_array($this->_contactType,
- array('Individual', 'Household', 'Organization')
- )) {
+ array('Individual', 'Household', 'Organization')
+ )
+ ) {
CRM_Core_Error::statusBounce(ts('Could not get a contact id and/or contact type'));
}
if (
$this->_contactSubType &&
- !(CRM_Contact_BAO_ContactType::isExtendsContactType($this->_contactSubType, $this->_contactType, TRUE))) {
+ !(CRM_Contact_BAO_ContactType::isExtendsContactType($this->_contactSubType, $this->_contactType, TRUE))
+ ) {
CRM_Core_Error::statusBounce(ts("Could not get a valid contact subtype for contact type '%1'", array(1 => $this->_contactType)));
}
FALSE, NULL, 'GET'
);
$typeLabel = CRM_Contact_BAO_ContactType::contactTypePairs(TRUE, $this->_contactSubType ?
- $this->_contactSubType : $this->_contactType
+ $this->_contactSubType : $this->_contactType
);
$typeLabel = implode(' / ', $typeLabel);
}
if ($this->_contactId) {
- $defaults = array();
- $params = array('id' => $this->_contactId);
+ $defaults = array();
+ $params = array('id' => $this->_contactId);
$returnProperities = array('id', 'contact_type', 'contact_sub_type', 'modified_date');
CRM_Core_DAO::commonRetrieve('CRM_Contact_DAO_Contact', $params, $defaults, $returnProperities);
if (!empty($_POST['hidden_custom'])) {
$customGroupCount = CRM_Utils_Array::value('hidden_custom_group_count', $_POST);
- if ($contactSubType = CRM_Utils_Array::value( 'contact_sub_type', $_POST)) {
+ if ($contactSubType = CRM_Utils_Array::value('contact_sub_type', $_POST)) {
$paramSubType = implode(',', $contactSubType);
}
//custom field to load
if ($this->_contactSubType || isset($paramSubType)) {
$paramSubType = (isset($paramSubType)) ? $paramSubType :
- str_replace( CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($this->_contactSubType, CRM_Core_DAO::VALUE_SEPARATOR));
+ str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($this->_contactSubType, CRM_Core_DAO::VALUE_SEPARATOR));
$this->assign('paramSubType', $paramSubType);
}
}
//set address block defaults
- CRM_Contact_Form_Edit_Address::setDefaultValues( $defaults, $this );
+ CRM_Contact_Form_Edit_Address::setDefaultValues($defaults, $this);
if (!empty($defaults['image_URL'])) {
/**
* Do the set default related to location type id,
* primary location, default country
- *
*/
public function blockSetDefaults(&$defaults) {
$locationTypeKeys = array_filter(array_keys(CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id')), 'is_int');
// get default phone and im provider id.
$defPhoneTypeId = key(CRM_Core_OptionGroup::values('phone_type', FALSE, FALSE, FALSE, ' AND is_default = 1'));
$defIMProviderId = key(CRM_Core_OptionGroup::values('instant_messenger_service',
- FALSE, FALSE, FALSE, ' AND is_default = 1'
- ));
+ FALSE, FALSE, FALSE, ' AND is_default = 1'
+ ));
$defWebsiteTypeId = key(CRM_Core_OptionGroup::values('website_type',
FALSE, FALSE, FALSE, ' AND is_default = 1'
));
}
/**
- * This function is used to add the rules (mainly global rules) for form.
+ * add the rules (mainly global rules) for form.
* All local rules are added near the element
*
* @return void
* @param int $contactId
* Contact id if doing update.
*
- * @return bool $primaryID email/openId@static
+ * @return bool
+ * email/openId
+ * @static
*/
public static function formRule($fields, &$errors, $contactId = NULL) {
$config = CRM_Core_Config::singleton();
$hasPrimary[] = $instance;
if (!$primaryID &&
in_array($name, array(
- 'email', 'openid')) && !empty($blockValues[$name])) {
+ 'email',
+ 'openid'
+ )) && !empty($blockValues[$name])
+ ) {
$primaryID = $blockValues[$name];
}
}
}
if ($name == 'openid' && !empty($blockValues[$name])) {
- $oid = new CRM_Core_DAO_OpenID();
+ $oid = new CRM_Core_DAO_OpenID();
$oid->openid = $openIds[$instance] = CRM_Utils_Array::value($name, $blockValues);
- $cid = isset($contactId) ? $contactId : 0;
+ $cid = isset($contactId) ? $contactId : 0;
if ($oid->find(TRUE) && ($oid->contact_id != $cid)) {
$errors["{$name}[$instance][openid]"] = ts('%1 already exist.', array(1 => $blocks['OpenID']));
}
if (!empty($invalidStreetNumbers)) {
$first = $invalidStreetNumbers[0];
- foreach ($invalidStreetNumbers as & $num) $num = CRM_Contact_Form_Contact::ordinalNumber($num);
+ foreach ($invalidStreetNumbers as & $num) {
+ $num = CRM_Contact_Form_Contact::ordinalNumber($num);
+ }
$errors["address[$first][street_number]"] = ts('The street number you entered for the %1 address block(s) is not in an expected format. Street numbers may include numeric digit(s) followed by other characters. You can still enter the complete street address (unparsed) by clicking "Edit Complete Street Address".', array(1 => implode(', ', $invalidStreetNumbers)));
}
}
$deleteExtra = ts('Are you sure you want to delete contact image.');
$deleteURL = array(
CRM_Core_Action::DELETE =>
- array(
- 'name' => ts('Delete Contact Image'),
- 'url' => 'civicrm/contact/image',
- 'qs' => 'reset=1&cid=%%id%%&action=delete',
- 'extra' =>
- 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
- ),
+ array(
+ 'name' => ts('Delete Contact Image'),
+ 'url' => 'civicrm/contact/image',
+ 'qs' => 'reset=1&cid=%%id%%&action=delete',
+ 'extra' =>
+ 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
+ ),
);
$deleteURL = CRM_Core_Action::formLink($deleteURL,
CRM_Core_Action::DELETE,
}
}
- CRM_Contact_BAO_Contact_Optimizer::edit( $params, $this->_preEditValues );
+ CRM_Contact_BAO_Contact_Optimizer::edit($params, $this->_preEditValues);
if (!empty($params['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($params);
if (isset($params['contact_id'])) {
// process membership status for deceased contact
- $deceasedParams = array('contact_id' => CRM_Utils_Array::value('contact_id', $params),
+ $deceasedParams = array(
+ 'contact_id' => CRM_Utils_Array::value('contact_id', $params),
'is_deceased' => CRM_Utils_Array::value('is_deceased', $params, FALSE),
'deceased_date' => CRM_Utils_Array::value('deceased_date', $params, NULL),
);
* @param array $fields
* The hierarchical value representation of this location.
*
- * @return boolean true if data exists, false otherwise
+ * @return boolean
+ * true if data exists, false otherwise
* @static
*/
public static function blockDataExists(&$fields) {
return FALSE;
}
- static $skipFields = array('location_type_id', 'is_primary', 'phone_type_id', 'provider_id', 'country_id', 'website_type_id', 'master_id');
+ static $skipFields = array(
+ 'location_type_id',
+ 'is_primary',
+ 'phone_type_id',
+ 'provider_id',
+ 'country_id',
+ 'website_type_id',
+ 'master_id'
+ );
foreach ($fields as $name => $value) {
$skipField = FALSE;
foreach ($skipFields as $skip) {
* Contact id.
* @param string $contactType
* Contact type.
- *
*/
public static function checkDuplicateContacts(&$fields, &$errors, $contactID, $contactType) {
// if this is a forced save, ignore find duplicate rule
$contactLinks = CRM_Contact_BAO_Contact_Utils::formatContactIDSToLinks($ids, TRUE, TRUE, $contactID);
$duplicateContactsLinks = '<div class="matching-contacts-found">';
- $duplicateContactsLinks .= ts('One matching contact was found. ', array('count' => count($contactLinks['rows']), 'plural' => '%count matching contacts were found.<br />'));
+ $duplicateContactsLinks .= ts('One matching contact was found. ', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => '%count matching contacts were found.<br />'
+ ));
if ($contactLinks['msg'] == 'view') {
- $duplicateContactsLinks .= ts('You can View the existing contact', array('count' => count($contactLinks['rows']), 'plural' => 'You can View the existing contacts'));
+ $duplicateContactsLinks .= ts('You can View the existing contact', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => 'You can View the existing contacts'
+ ));
}
else {
- $duplicateContactsLinks .= ts('You can View or Edit the existing contact', array('count' => count($contactLinks['rows']), 'plural' => 'You can View or Edit the existing contacts'));
+ $duplicateContactsLinks .= ts('You can View or Edit the existing contact', array(
+ 'count' => count($contactLinks['rows']),
+ 'plural' => 'You can View or Edit the existing contacts'
+ ));
}
if ($contactLinks['msg'] == 'merge') {
// We should also get a merge link if this is for an existing contact
$errors['_qf_default'] = $duplicateContactsLinks;
-
// let smarty know that there are duplicates
$template = CRM_Core_Smarty::singleton();
$template->assign('isDuplicate', 1);
* This function either parse street address in to child
* elements or build street address from child elements.
*
- * @param $params
- * Array of key value consist of address blocks.
+ * @param array $params
+ * of key value consist of address blocks.
*
- * @return array $parseSuccess as array of sucess/fails for each address block@static
+ * @return array
+ * as array of sucess/fails for each address block
+ * @static
*/
public function parseAddress(&$params) {
$parseSuccess = $parsedFields = array();
$buildStreetAddress = FALSE;
$parseFieldName = 'street_address';
foreach (array(
- 'street_number', 'street_name', 'street_unit') as $fld) {
+ 'street_number',
+ 'street_name',
+ 'street_unit'
+ ) as $fld) {
if (!empty($address[$fld])) {
$parseFieldName = 'street_number';
$buildStreetAddress = TRUE;
$streetAddress = NULL;
foreach (array(
- 'street_number', 'street_number_suffix', 'street_name', 'street_unit') as $fld) {
+ 'street_number',
+ 'street_number_suffix',
+ 'street_name',
+ 'street_unit'
+ ) as $fld) {
if (in_array($fld, array(
- 'street_name', 'street_unit'))) {
+ 'street_name',
+ 'street_unit'
+ ))) {
$streetAddress .= ' ';
}
$streetAddress .= CRM_Utils_Array::value($fld, $address);
* Check parse result and if some address block fails then this
* function return the status message for all address blocks.
*
- * @param $parseResult
+ * @param array $parseResult
* An array of address blk instance and its status.
*
- * @return null|string $statusMsg string status message for all address blocks.@static
+ * @return null|string
+ * $statusMsg string status message for all address blocks.
+ * @static
*/
public static function parseAddressStatusMsg($parseResult) {
$statusMsg = NULL;
* Convert normal number to ordinal number format.
* like 1 => 1st, 2 => 2nd and so on...
*
- * @param $number
- * Int number to convert in to ordinal number.
+ * @param int $number
+ * number to convert in to ordinal number.
*
- * @return ordinal number for given number.
+ * @return string
+ * ordinal number for given number.
* @static
*/
public static function ordinalNumber($number) {
* Update membership status to deceased
* function return the status message for updated membership.
*
- * @param $deceasedParams
- * Array having contact id and deceased value.
+ * @param array $deceasedParams
+ * having contact id and deceased value.
*
- * @return null|string $updateMembershipMsg string status message for updated membership.
+ * @return null|string
+ * $updateMembershipMsg string status message for updated membership.
*/
public function updateMembershipStatus($deceasedParams) {
$updateMembershipMsg = NULL;
- $contactId = CRM_Utils_Array::value('contact_id', $deceasedParams);
- $deceasedDate = CRM_Utils_Array::value('deceased_date', $deceasedParams);
+ $contactId = CRM_Utils_Array::value('contact_id', $deceasedParams);
+ $deceasedDate = CRM_Utils_Array::value('deceased_date', $deceasedParams);
// process to set membership status to deceased for both active/inactive membership
if ($contactId &&
- $this->_contactType == 'Individual' && !empty($deceasedParams['is_deceased'])) {
+ $this->_contactType == 'Individual' && !empty($deceasedParams['is_deceased'])
+ ) {
$session = CRM_Core_Session::singleton();
$userId = $session->get('userID');
$dao->whereAdd("status_id != $deceasedStatusId");
$dao->find();
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
- $allStatus = CRM_Member_PseudoConstant::membershipStatus();
+ $allStatus = CRM_Member_PseudoConstant::membershipStatus();
$memCount = 0;
while ($dao->fetch()) {
// update status to deceased (for both active/inactive membership )