| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
class CRM_Contact_Form_Contact extends CRM_Core_Form {
/**
- * The contact type of the form
+ * The contact type of the form.
*
* @var string
*/
public $_contactType;
/**
- * The contact type of the form
+ * The contact type of the form.
*
* @var string
*/
public $_contactId;
/**
- * The default group id passed in via the url
+ * The default group id passed in via the url.
*
* @var int
*/
public $_gid;
/**
- * The default tag id passed in via the url
+ * The default tag id passed in via the url.
*
* @var int
*/
protected $_dedupeButtonName;
/**
- * Name of optional save duplicate button
+ * Name of optional save duplicate button.
*
* @var string
*/
public $_customValueCount;
/**
- * The array of greetings with option group and filed names
+ * The array of greetings with option group and filed names.
*
* @var array
*/
public $_parseStreetAddress;
/**
- * Check contact has a subtype or not
+ * Check contact has a subtype or not.
*/
public $_isContactSubType;
public $_preEditValues;
/**
- * Build all the data structures needed to build the form
+ * Build all the data structures needed to build the form.
*
* @return void
*/
$this->_dedupeButtonName = $this->getButtonName('refresh', 'dedupe');
$this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
+ CRM_Core_Resources::singleton()
+ ->addStyleFile('civicrm', 'css/contactSummary.css', 2, 'html-header');
+
$session = CRM_Core_Session::singleton();
if ($this->_action == CRM_Core_Action::ADD) {
// check for add contacts permissions
if ($this->_contactId) {
$defaults = array();
$params = array('id' => $this->_contactId);
- $returnProperities = array('id', 'contact_type', 'contact_sub_type', 'modified_date');
+ $returnProperities = array('id', 'contact_type', 'contact_sub_type', 'modified_date', 'is_deceased');
CRM_Core_DAO::commonRetrieve('CRM_Contact_DAO_Contact', $params, $defaults, $returnProperities);
if (empty($defaults['id'])) {
}
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
+ if ($defaults['is_deceased']) {
+ $displayName .= ' <span class="crm-contact-deceased">(deceased)</span>';
+ }
$displayName = ts('Edit %1', array(1 => $displayName));
// Check if this is default domain contact CRM-10482
//set address block defaults
CRM_Contact_Form_Edit_Address::setDefaultValues($defaults, $this);
-
if (!empty($defaults['image_URL'])) {
list($imageWidth, $imageHeight) = getimagesize(CRM_Utils_String::unstupifyUrl($defaults['image_URL']));
list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
// make we require one primary block, CRM-5505
if ($updateMode) {
if (!$hasPrimary) {
- $hasPrimary =
- CRM_Utils_Array::value(
- 'is_primary',
- CRM_Utils_Array::value($instance, $defaults[$name])
- );
+ $hasPrimary = CRM_Utils_Array::value(
+ 'is_primary',
+ CRM_Utils_Array::value($instance, $defaults[$name])
+ );
}
continue;
}
}
/**
- * Global validation rules for the form
+ * Global validation rules for the form.
*
* @param array $fields
* Posted values of the form.
if (!$primaryID &&
in_array($name, array(
'email',
- 'openid'
+ 'openid',
)) && !empty($blockValues[$name])
) {
$primaryID = $blockValues[$name];
}
/**
- * Build the form object
+ * Build the form object.
*
* @return void
*/
if ($this->_action == CRM_Core_Action::UPDATE) {
$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;"',
- ),
+ 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;"',
+ ),
);
$deleteURL = CRM_Core_Action::formLink($deleteURL,
CRM_Core_Action::DELETE,
}
/**
- * Is there any real significant data in the hierarchical location array
+ * Is there any real significant data in the hierarchical location array.
*
* @param array $fields
* The hierarchical value representation of this location.
*
- * @return boolean
+ * @return bool
* true if data exists, false otherwise
*/
public static function blockDataExists(&$fields) {
'provider_id',
'country_id',
'website_type_id',
- 'master_id'
+ 'master_id',
);
foreach ($fields as $name => $value) {
$skipField = FALSE;
}
/**
- * That checks for duplicate contacts
+ * That checks for duplicate contacts.
*
* @param array $fields
* Fields array which are submitted.
$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 />'
+ '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'
+ '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'
+ 'plural' => 'You can View or Edit the existing contacts',
));
}
if ($contactLinks['msg'] == 'merge') {
$errors['_qf_default'] = $duplicateContactsLinks;
-
// let smarty know that there are duplicates
$template = CRM_Core_Smarty::singleton();
$template->assign('isDuplicate', 1);
}
/**
- * Use the form name to create the tpl file name
+ * Use the form name to create the tpl file name.
*
* @return string
*/
foreach (array(
'street_number',
'street_name',
- 'street_unit'
+ 'street_unit',
) as $fld) {
if (!empty($address[$fld])) {
$parseFieldName = 'street_number';
'street_number',
'street_number_suffix',
'street_name',
- 'street_unit'
+ 'street_unit',
) as $fld) {
if (in_array($fld, array(
'street_name',
- 'street_unit'
+ 'street_unit',
))) {
$streetAddress .= ' ';
}
}
/**
- * Update membership status to deceased
+ * Update membership status to deceased.
* function return the status message for updated membership.
*
* @param array $deceasedParams
$userId = $contactId;
}
-
// get deceased status id
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$deceasedStatusId = array_search('Deceased', $allStatus);
'max_related' => $dao->max_related,
);
-
CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
//create activity when membership status is changed