+--------------------------------------------------------------------+
*/
-use Civi\ActionSchedule\RecipientBuilder;
/**
* Class CRM_Contact_ActionMapping
'casEntityIdField' => 'e.id',
'casContactTableAlias' => NULL,
]);
- $query->where('1'); // possible to have no "where" in this case
+ // possible to have no "where" in this case
+ $query->where('1');
}
$query['casDateField'] = 'e.' . $dateDBField;
*
* @var array
*/
- static $_commPrefs = array(
+ public static $_commPrefs = array(
'do_not_phone',
'do_not_email',
'do_not_mail',
*
* @var array
*/
- static $_greetingTypes = array(
+ public static $_greetingTypes = array(
'addressee',
'email_greeting',
'postal_greeting',
*
* @var array
*/
- static $_importableFields = array();
+ public static $_importableFields = array();
/**
* Static field for all the contact information that we can potentially export.
*
* @var array
*/
- static $_exportableFields = NULL;
+ public static $_exportableFields = NULL;
/**
* Class constructor.
if (!empty($params['contact_id']) && !empty($missingGreetingParams)) {
$savedGreetings = civicrm_api3('Contact', 'getsingle', array(
'id' => $params['contact_id'],
- 'return' => array_keys($missingGreetingParams))
+ 'return' => array_keys($missingGreetingParams),
+ )
);
foreach (array_keys($missingGreetingParams) as $missingGreetingParam) {
* True when used during search, might conflict with export param?.
*
* @param bool $withMultiRecord
- *
+ * @param bool $checkPermissions
* @return array
* array of exportable Fields
*/
'Household',
'Organization',
'All',
- )
- )) {
+ ))) {
$fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
}
// add current employer for individuals
}
else {
foreach (array(
- 'Individual',
- 'Household',
- 'Organization',
- ) as $type) {
+ 'Individual',
+ 'Household',
+ 'Organization',
+ ) as $type) {
$fields = array_merge($fields,
CRM_Core_BAO_CustomField::getFieldsForImport($type, FALSE, FALSE, $search, $checkPermissions, $withMultiRecord)
);
}
}
}
- elseif (in_array($key,
- array(
- 'nick_name',
- 'job_title',
- 'middle_name',
- 'birth_date',
- 'gender_id',
- 'current_employer',
- 'prefix_id',
- 'suffix_id',
- )) &&
- ($value == '' || !isset($value)) &&
- ($session->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0 ||
- ($key == 'current_employer' && empty($params['current_employer']))) {
- // CRM-10128: if auth source is not checksum / login && $value is blank, do not fill $data with empty value
- // to avoid update with empty values
- continue;
+ elseif (in_array($key, array(
+ 'nick_name',
+ 'job_title',
+ 'middle_name',
+ 'birth_date',
+ 'gender_id',
+ 'current_employer',
+ 'prefix_id',
+ 'suffix_id',
+ )) && ($value == '' || !isset($value)) &&
+ ($session->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0 ||
+ ($key == 'current_employer' && empty($params['current_employer']))) {
+ // CRM-10128: if auth source is not checksum / login && $value is blank, do not fill $data with empty value
+ // to avoid update with empty values
+ continue;
}
else {
$data[$key] = $value;
array('table' => 'civicrm_im', 'column' => 'contact_id'),
array('table' => 'civicrm_phone', 'column' => 'contact_id'),
array('table' => 'civicrm_website', 'column' => 'contact_id'),
- )
- )
+ ))
->alterTriggerInfo($info, $tableName);
// Update phone table to populate phone_numeric field
* @see CRM_Contact_BAO_Contact_Permission::allow
*
* @return array
- * list of contact IDs the logged in user has the given permission for
+ * list of contact IDs the logged in user has the given permission for
*/
public static function allowList($contact_ids, $type = CRM_Core_Permission::VIEW) {
$result_set = [];
// if some have been rejected, double check for permissions inherited by relationship
if (count($result_set) < count($contact_ids)) {
- $rejected_contacts = array_diff_key($contact_ids, $result_set);
+ $rejected_contacts = array_diff_key($contact_ids, $result_set);
// @todo consider storing these to the acl cache for next time, since we have fetched.
$allowed_by_relationship = self::relationshipList($rejected_contacts, $type);
foreach ($allowed_by_relationship as $contact_id) {
return array_keys($result_set);
}
-
/**
* @param int $contactID
* @param CRM_Core_Form $form
* @todo there seems little reason for the small number of functions that call this to pass in
* params that then need to be translated in this function since they are coding them when calling
*/
- static public function getGroupListSelector(&$params) {
+ public static function getGroupListSelector(&$params) {
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$values[$object->id]['org_info'] = "<a href='{$contactUrl}'>{$object->org_name}</a>";
}
else {
- $values[$object->id]['org_info'] = ''; // Empty cell
+ // Empty cell
+ $values[$object->id]['org_info'] = '';
}
}
else {
- $values[$object->id]['org_info'] = NULL; // Collapsed column if all cells are NULL
+ // Collapsed column if all cells are NULL
+ $values[$object->id]['org_info'] = NULL;
}
if ($object->created_id) {
$contactUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$object->created_id}");
* @param bool $includeSmartGroups
* Include or Exclude Smart Group(s)
*
- * @return array|int $values
+ * @return array|int
* the relevant data object values for the contact or the total count when $count is TRUE
*/
public static function getContactGroup(
*/
class CRM_Contact_BAO_GroupContactCache extends CRM_Contact_DAO_GroupContactCache {
- static $_alreadyLoaded = [];
+ public static $_alreadyLoaded = [];
/**
* Get a list of caching modes.
*
* @throws \Exception
*/
- static public function update() {
+ public static function update() {
// lets build the tree in memory first
$sql = "
* This version has been taken from Drupal's location module: http://drupal.org/project/location
*/
+ /**
+ * @var string
+ */
static protected $_earthFlattening;
static protected $_earthRadiusSemiMinor;
static protected $_earthRadiusSemiMajor;
*
* @var array
*/
- static $_defaultReturnProperties = NULL;
+ public static $_defaultReturnProperties = NULL;
/**
* The default set of hier return properties.
*
* @var array
*/
- static $_defaultHierReturnProperties;
+ public static $_defaultHierReturnProperties;
/**
* The set of input params.
/**
* Should we just display one contact record
+ * @var bool
*/
public $_useGroupBy = FALSE;
*
* @var array
*/
- static $_relType;
+ public static $_relType;
/**
* The activity role
*
* @var array
*/
- static $_activityRole;
+ public static $_activityRole;
/**
* Consider the component activity type
*
* @var array
*/
- static $_considerCompActivities;
+ public static $_considerCompActivities;
/**
* Consider with contact activities only,
*
* @var array
*/
- static $_withContactActivitiesOnly;
+ public static $_withContactActivitiesOnly;
/**
* Use distinct component clause for component searches
*
* @var array
*/
- static $_dependencies = [
+ public static $_dependencies = [
'civicrm_state_province' => 1,
'civicrm_country' => 1,
'civicrm_county' => 1,
/**
* List of location specific fields.
+ * @var array
*/
- static $_locationSpecificFields = [
+ public static $_locationSpecificFields = [
'street_address',
'street_number',
'street_name',
/**
* Remember if we handle either end of a number or date range
* so we can skip the other
+ * @var array
*/
protected $_rangeCache = [];
/**
* Set to the name of the temp table if one has been created
* @var String
*/
- static $_relationshipTempTable = NULL;
+ public static $_relationshipTempTable = NULL;
public $_pseudoConstantsSelect = [];
$this->_qill[0][] = ts("%1 %2 %3", [
1 => $field['title'],
2 => $qillop,
- 3 => $qillVal
+ 3 => $qillVal,
]);
}
else {
$this->_qill[$grouping][] = ts("%1 %2 %3", [
1 => $field['title'],
2 => $qillop,
- 3 => (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) ? $qillVal : "'$qillVal'"]);
+ 3 => (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) ? $qillVal : "'$qillVal'",
+ ]);
if (is_array($value)) {
// traditionally an array being passed has been a fatal error. We can take advantage of this to add support
}
if ((!empty($tables['civicrm_state_province']) || !empty($tables['civicrm_country']) ||
- CRM_Utils_Array::value('civicrm_county', $tables)
- ) && empty($tables['civicrm_address'])
- ) {
+ CRM_Utils_Array::value('civicrm_county', $tables)) && empty($tables['civicrm_address'])) {
$tables = array_merge(['civicrm_address' => 1],
$tables
);
// add group_contact and group table is subscription history is present
if (!empty($tables['civicrm_subscription_history']) && empty($tables['civicrm_group'])) {
$tables = array_merge([
- 'civicrm_group' => 1,
- 'civicrm_group_contact' => 1,
- ],
+ 'civicrm_group' => 1,
+ 'civicrm_group_contact' => 1,
+ ],
$tables
);
}
public static function getGroupByFromOrderBy(&$groupBy, $orderBys) {
if (!CRM_Utils_SQL::disableFullGroupByMode()) {
foreach ($orderBys as $orderBy) {
- $orderBy = str_ireplace([' DESC', ' ASC', '`'], '', $orderBy); // remove sort syntax from ORDER BY clauses if present
+ // remove sort syntax from ORDER BY clauses if present
+ $orderBy = str_ireplace([' DESC', ' ASC', '`'], '', $orderBy);
// if ORDER BY column is not present in GROUP BY then append it to end
if (preg_match('/(MAX|MIN)\(/i', trim($orderBy)) !== 1 && !strstr($groupBy, $orderBy)) {
$groupBy .= ", {$orderBy}";
}
}
-
/**
* @param $values
* @param string $tableName
list($name, $op, $value, $grouping, $wildcard) = $values;
$asofDateValues = $this->getWhereValues("{$fieldName}_asof_date", $grouping);
- $asofDate = NULL; // will be treated as current day
+ // will be treated as current day
+ $asofDate = NULL;
if ($asofDateValues) {
$asofDate = CRM_Utils_Date::processDate($asofDateValues[2]);
$asofDateFormat = CRM_Utils_Date::customFormat(substr($asofDate, 0, 8));
* @return bool
*/
public static function caseImportant($op) {
- return
- in_array($op, ['LIKE', 'IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY']) ? FALSE : TRUE;
+ return in_array($op, ['LIKE', 'IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY']) ? FALSE : TRUE;
}
/**
public static function parseSearchBuilderString($string, $dataType = 'Integer') {
$string = trim($string);
if (substr($string, 0, 1) != '(' || substr($string, -1, 1) != ')') {
- Return FALSE;
+ return FALSE;
}
$string = substr($string, 1, -1);
}
if (!$usedForAPI) {
foreach ([
- 'gender_id' => 'gender',
- 'prefix_id' => 'individual_prefix',
- 'suffix_id' => 'individual_suffix',
- 'communication_style_id' => 'communication_style',
- ] as $realField => $labelField) {
+ 'gender_id' => 'gender',
+ 'prefix_id' => 'individual_prefix',
+ 'suffix_id' => 'individual_suffix',
+ 'communication_style_id' => 'communication_style',
+ ] as $realField => $labelField) {
// This is a temporary routine for handling these fields while
// we figure out how to handled them based on metadata in
/// export and search builder. CRM-19815, CRM-19830.
'=',
'1',
'0',
- '0'
+ '0',
], $this->_params);
// if we’re explicitly looking for a certain contact’s contribs, events, etc.
$this->_where[$grouping][] = $fieldSpec['where'] . " <= '{$dates[1]}'";
$this->_qill[$grouping][] = ts('%1 is ', [$fieldSpec['title']]) . $filters[$value] . ' (' . ts("to %1", [
- CRM_Utils_Date::customFormat($dates[1]),
- ]) . ')';
+ CRM_Utils_Date::customFormat($dates[1]),
+ ]) . ')';
}
elseif (empty($dates[1])) {
// ie. no end date we only have start date
$this->_where[$grouping][] = $fieldSpec['where'] . " >= '{$dates[1]}'";
$this->_qill[$grouping][] = ts('%1 is ', [$fieldSpec['title']]) . $filters[$value] . ' (' . ts("from %1", [
- CRM_Utils_Date::customFormat($dates[0]),
- ]) . ')';
+ CRM_Utils_Date::customFormat($dates[0]),
+ ]) . ')';
}
else {
// we have start and end dates.
$this->_where[$grouping][] = $fieldSpec['where'] . " BETWEEN '{$dates[0]}' AND '{$dates[1]}'";
$this->_qill[$grouping][] = ts('%1 is ', [$fieldSpec['title']]) . $filters[$value] . ' (' . ts("between %1 and %2", [
- CRM_Utils_Date::customFormat($dates[0]),
- CRM_Utils_Date::customFormat($dates[1]),
- ]) . ')';
+ CRM_Utils_Date::customFormat($dates[0]),
+ CRM_Utils_Date::customFormat($dates[1]),
+ ]) . ')';
}
}
return [
$aName,
- $addressJoin
+ $addressJoin,
];
}
);
}
-
/**
* Check if there is data to create the object.
*
* @return array
* array reference of all relationship types with context to current contact type .
*/
- static public function getRelationType($targetContactType) {
+ public static function getRelationType($targetContactType) {
$relationshipType = array();
$allRelationshipType = CRM_Core_PseudoConstant::relationshipType();
}
}
-
/**
* Wrapper for contact relationship selector.
*
* BAO object for crm_email table.
*/
class CRM_Contact_BAO_SubscriptionHistory extends CRM_Contact_DAO_SubscriptionHistory {
+
/**
* Class constructor.
*/
/**
* Do we want to parse street address.
+ * @var bool
*/
public $_parseStreetAddress;
/**
* Check contact has a subtype or not.
+ * @var bool
*/
public $_isContactSubType;
* Lets keep a cache of all the values that we retrieved.
* THis is an attempt to avoid the number of update statements
* during the write phase
+ * @var array
*/
public $_preEditValues;
* List of errors to be posted back to the form.
* @param int $contactId
* Contact id if doing update.
+ * @param string $contactType
*
* @return bool
* email/openId
$duplicateContactsLinks = '<div class="matching-contacts-found">';
$duplicateContactsLinks .= ts('One matching contact was found. ', [
- 'count' => count($contactLinks['rows']),
- 'plural' => '%count matching contacts were found.<br />',
- ]);
+ 'count' => count($contactLinks['rows']),
+ 'plural' => '%count matching contacts were found.<br />',
+ ]);
if ($contactLinks['msg'] == 'view') {
$duplicateContactsLinks .= ts('You can View the existing contact', [
- 'count' => count($contactLinks['rows']),
- 'plural' => 'You can View the existing contacts',
- ]);
+ 'count' => count($contactLinks['rows']),
+ 'plural' => 'You can View the existing contacts',
+ ]);
}
else {
$duplicateContactsLinks .= ts('You can View or Edit the existing contact', [
- 'count' => count($contactLinks['rows']),
- 'plural' => 'You can View or Edit the existing contacts',
- ]);
+ '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
$buildStreetAddress = FALSE;
$parseFieldName = 'street_address';
foreach ([
- '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 ([
- '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, [
'street_name',
'street_unit',
/**
* Custom group id
*
- * @int
+ * @var int
*/
public $_groupID;
$this->assign('multiRecordDisplay', $this->_multiRecordDisplay);
$saveButtonName = $this->_copyValueId ? ts('Save a Copy') : ts('Save');
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => $saveButtonName,
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'upload',
- 'name' => ts('Save and New'),
- 'subName' => 'new',
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => $saveButtonName,
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'upload',
+ 'name' => ts('Save and New'),
+ 'subName' => 'new',
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
}
return CRM_Custom_Form_CustomData::buildQuickForm($this);
// make this form an upload since we dont know if the custom data injected dynamically
// is of type file etc
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
/**
/**
* Indicate if this form should warn users of unsaved changes
+ * @var bool
*/
protected $unsavedChangesWarn = FALSE;
$this->add('text', 'limit', ts('No of contacts to find matches for '));
}
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Continue'),
- 'isDefault' => TRUE,
- ],
- //hack to support cancel button functionality
- [
- 'type' => 'submit',
- 'class' => 'cancel',
- 'icon' => 'fa-times',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Continue'),
+ 'isDefault' => TRUE,
+ ],
+ //hack to support cancel button functionality
+ [
+ 'type' => 'submit',
+ 'class' => 'cancel',
+ 'icon' => 'fa-times',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
/**
*
* @return array
*/
+
/**
* @return array
*/
if ($dao->fetch()) {
// set the length to null for all the fields where prefix length is not supported. eg. int,tinyint,date,enum etc dataTypes.
if ($dao->COLUMN_NAME == $field && !in_array($dao->DATA_TYPE, [
- 'char',
- 'varchar',
- 'binary',
- 'varbinary',
- 'text',
- 'blob',
- ])
- ) {
+ 'char',
+ 'varchar',
+ 'binary',
+ 'varbinary',
+ 'text',
+ 'blob',
+ ])) {
$length = NULL;
}
elseif ($dao->COLUMN_NAME == $field && !empty($dao->CHARACTER_MAXIMUM_LENGTH) && ($length > $dao->CHARACTER_MAXIMUM_LENGTH)) {
"address[$blockId][is_primary]", [
'entity' => 'address',
'label' => ts('Primary location for this contact'),
- 'text' => ts('Primary location for this contact')] + $js);
+ 'text' => ts('Primary location for this contact'),
+ ] + $js);
if (!$inlineEdit) {
$js = ['id' => 'Address_' . $blockId . '_IsBilling', 'onClick' => 'singleSelect( this.id );'];
"address[$blockId][is_billing]", [
'entity' => 'address',
'label' => ts('Billing location for this contact'),
- 'text' => ts('Billing location for this contact')] + $js);
+ 'text' => ts('Billing location for this contact'),
+ ] + $js);
// hidden element to store master address id
$form->addField("address[$blockId][master_id]", ['entity' => 'address', 'type' => 'hidden']);
$continue = TRUE;
//Don't skip street parsed fields when parsing is enabled.
if (in_array($nameWithoutID, [
- 'street_number',
- 'street_name',
- 'street_unit',
- ]) && !empty($addressOptions['street_address_parsing'])
- ) {
+ 'street_number',
+ 'street_name',
+ 'street_unit',
+ ]) && !empty($addressOptions['street_address_parsing'])) {
$continue = FALSE;
}
if ($continue) {
'address' => $addressValue['display'],
'name' => $shareAddressContactNames[$addressValue['master_id']]['name'],
'options' => CRM_Core_BAO_Address::getValues([
- 'entity_id' => $master_cid,
- 'contact_id' => $master_cid,
- ]),
+ 'entity_id' => $master_cid,
+ 'contact_id' => $master_cid,
+ ]),
'master_id' => $addressValue['master_id'],
];
$defaults['address'][$key]['master_contact_id'] = $master_cid;
foreach ($defaults['address'] as $cnt => & $address) {
$streetAddress = NULL;
foreach ([
- '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, [
'street_name',
'street_unit',
*
* @var array
*/
- static $greetings = [];
+ public static $greetings = [];
/**
* Build the form object elements for Communication Preferences object.
//Block type select
$form->addField("phone[$blockId][location_type_id]", [
'entity' => 'phone',
- 'class' => 'eight',
- 'placeholder' => NULL,
- 'option_url' => NULL,
- ]);
+ 'class' => 'eight',
+ 'placeholder' => NULL,
+ 'option_url' => NULL,
+ ]);
//is_Primary radio
$js = ['id' => 'Phone_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );', 'aria-label' => ts('Phone %1 is primary?', [1 => $blockId])];
$this->addField('group_id', ['class' => 'crm-action-menu fa-plus', 'placeholder' => $msg, 'options' => $groupSelect]);
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Add'),
- 'isDefault' => TRUE,
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Add'),
+ 'isDefault' => TRUE,
+ ],
+ ]);
}
}
/**
* Id of the contact that is being edited
+ * @var int
*/
public $_contactId;
/**
* Type of contact being edited
+ * @var string
*/
public $_contactType;
/**
* Sub type of contact being edited
+ * @var string
*/
public $_contactSubType;
/**
* Location block no
+ * @var int
*/
private $_locBlockNo;
/**
* Do we want to parse street address.
+ * @var bool
*/
public $_parseStreetAddress;
/**
* Store address values
+ * @var array
*/
public $_values;
/**
* Form action
+ * @var string
*/
public $_action;
/**
* Address id
+ * @var int
*/
public $_addressId;
/**
* Custom group id.
*
- * @int
+ * @var int
*/
public $_groupID;
/**
* Email addresses of the contact that is been viewed.
+ * @var array
*/
private $_emails = [];
/**
* No of email blocks for inline edit.
+ * @var int
*/
private $_blockCount = 6;
/**
* Ims of the contact that is been viewed.
+ * @var array
*/
private $_ims = [];
/**
* No of im blocks for inline edit.
+ * @var int
*/
private $_blockCount = 6;
/**
* Ims of the contact that is been viewed.
+ * @var array
*/
private $_openids = [];
/**
* No of openid blocks for inline edit.
+ * @var int
*/
private $_blockCount = 6;
/**
* Phones of the contact that is been viewed
+ * @var array
*/
private $_phones = [];
/**
* No of phone blocks for inline edit
+ * @var int
*/
private $_blockCount = 6;
/**
* Websitess of the contact that is been viewed.
+ * @var array
*/
private $_websites = [];
/**
* No of website blocks for inline edit.
+ * @var int
*/
private $_blockCount = 6;
*/
class CRM_Contact_Form_Merge extends CRM_Core_Form {
// The id of the contact that there's a duplicate for; this one will
- // possibly inherit some of $_oid's properties and remain in the system.
- var $_cid = NULL;
+ /**
+ * possibly inherit some of $_oid's properties and remain in the system.
+ * @var int
+ */
+ public $_cid = NULL;
- // The id of the other contact - the duplicate one that will get deleted.
- var $_oid = NULL;
+ /**
+ * The id of the other contact - the duplicate one that will get deleted.
+ * @var int
+ */
+ public $_oid = NULL;
- var $_contactType = NULL;
+ public $_contactType = NULL;
/**
* @var array
*
* @var int
*/
- var $limit;
+ public $limit;
/**
* String for quickform bug handling.
*
* @var string
*/
- var $_qfZeroBug = 'e8cddb72-a257-11dc-b9cc-0016d3330ee9';
+ public $_qfZeroBug = 'e8cddb72-a257-11dc-b9cc-0016d3330ee9';
public function preProcess() {
try {
$this->prev = $this->next = NULL;
foreach ([
- 'prev',
- 'next',
- ] as $position) {
+ 'prev',
+ 'next',
+ ] as $position) {
if (!empty($pos[$position])) {
if ($pos[$position]['id1'] && $pos[$position]['id2']) {
$rowParams = array_merge($urlParams, [
$locType = CRM_Core_BAO_LocationType::getDefault();
foreach ([
- 'phone',
- 'email',
- 'address',
- ] as $locFld) {
+ 'phone',
+ 'email',
+ 'address',
+ ] as $locFld) {
if (!empty($this->_defaults[$locFld]) && $this->_defaults[$locFld][1]['location_type_id']) {
$params[$locFld][1]['is_primary'] = $this->_defaults[$locFld][1]['is_primary'];
$params[$locFld][1]['location_type_id'] = $this->_defaults[$locFld][1]['location_type_id'];
/**
* This is a string which is either a_b or b_a used to determine the relationship between to contacts
+ * @var string
*/
public $_rtype;
/**
* This is a string which is used to determine the relationship between to contacts
+ * @var string
*/
public $_rtypeId;
/**
* Display name of contact a
+ * @var string
*/
public $_display_name_a;
/**
* Display name of contact b
+ * @var string
*/
public $_display_name_b;
/**
* The relationship values if Updating relationship
+ * @var array
*/
public $_values;
/**
* Case id if it called from case context
+ * @var int
*/
public $_caseId;
public function buildQuickForm() {
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Delete'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Delete'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
return;
}
return [$params, $relationshipIds];
}
-
/**
* Prepares parameters to be used for create/update actions
*
*
* @var array
*/
- static $_validContext = NULL;
+ public static $_validContext = NULL;
/**
* List of values used when we want to display other objects.
*
* @var array
*/
- static $_modeValues = NULL;
+ public static $_modeValues = NULL;
/**
* The contextMenu.
*
* @var array
*/
- static $csv = ['contact_type', 'group', 'tag'];
+ public static $csv = ['contact_type', 'group', 'tag'];
/**
* @var string how to display the results. Should we display as
/**
* Name of the selector to use.
+ * @var string
*/
- static $_selectorName = 'CRM_Contact_Selector';
+ public static $_selectorName = 'CRM_Contact_Selector';
protected $_customSearchID = NULL;
protected $_customSearchClass = NULL;
// FIXME: we should generalise in a way that components could inject url-filters
// just like they build their own form elements
foreach ([
- 'mailing_id',
- 'mailing_delivery_status',
- 'mailing_open_status',
- 'mailing_click_status',
- 'mailing_reply_status',
- 'mailing_optout',
- 'mailing_forward',
- 'mailing_unsubscribe',
- 'mailing_date_low',
- 'mailing_date_high',
- ] as $mailingFilter) {
+ 'mailing_id',
+ 'mailing_delivery_status',
+ 'mailing_open_status',
+ 'mailing_click_status',
+ 'mailing_reply_status',
+ 'mailing_optout',
+ 'mailing_forward',
+ 'mailing_unsubscribe',
+ 'mailing_date_low',
+ 'mailing_date_high',
+ ] as $mailingFilter) {
$type = 'String';
if ($mailingFilter == 'mailing_id' &&
$filterVal = CRM_Utils_Request::retrieve('mailing_id', 'Positive', $this)
*
* @return string
*/
+
/**
* @return string
*/
// FIXME: so leaving this as a dependency for now
if (array_key_exists('contribution_amount_low', $this->_formValues)) {
foreach (array(
- 'contribution_amount_low',
- 'contribution_amount_high',
- ) as $f) {
+ 'contribution_amount_low',
+ 'contribution_amount_high',
+ ) as $f) {
$this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
}
}
!$this->_force
) {
foreach (array(
- 'case_type_id',
- 'case_status_id',
- 'case_deleted',
- 'case_tags',
- ) as $caseCriteria) {
+ 'case_type_id',
+ 'case_status_id',
+ 'case_deleted',
+ 'case_tags',
+ ) as $caseCriteria) {
if (!empty($this->_formValues[$caseCriteria])) {
$allCases = TRUE;
$this->_formValues['case_owner'] = 1;
*
* @var array
*/
- static $csv = ['contact_type', 'group', 'tag'];
+ public static $csv = ['contact_type', 'group', 'tag'];
/**
* Build the form object.
$groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($this->_group, NULL, ' ', TRUE);
if (!empty($searchOptions['groups'])) {
$this->addField('group', [
- 'entity' => 'group_contact',
- 'label' => ts('in'),
- 'placeholder' => ts('- any group -'),
- 'options' => $groupHierarchy,
- ]);
+ 'entity' => 'group_contact',
+ 'label' => ts('in'),
+ 'placeholder' => ts('- any group -'),
+ 'options' => $groupHierarchy,
+ ]);
}
if (!empty($searchOptions['tags'])) {
// tag criteria
if (!empty($this->_tag)) {
$this->addField('tag', [
- 'entity' => 'entity_tag',
- 'label' => ts('with'),
- 'placeholder' => ts('- any tag -'),
- ]);
+ 'entity' => 'entity_tag',
+ 'label' => ts('with'),
+ 'placeholder' => ts('- any tag -'),
+ ]);
}
}
* If Go is pressed then we must select some checkboxes and an action.
*
* @param array $fields
+ * @param array $files
+ * @param object $form
*
* @return array|bool
*/
*
* @return string
*/
+
/**
* @return string
*/
$v[2] = self::checkArrayKeyEmpty($v[2]);
if (in_array($v[1], [
- 'IS NULL',
- 'IS NOT NULL',
- 'IS EMPTY',
- 'IS NOT EMPTY',
- ]) &&
- !empty($v[2])
- ) {
+ 'IS NULL',
+ 'IS NOT NULL',
+ 'IS EMPTY',
+ 'IS NOT EMPTY',
+ ]) && !empty($v[2])) {
$errorMsg["value[$v[3]][$v[4]]"] = ts('Please clear your value if you want to use %1 operator.', [1 => $v[1]]);
}
elseif (substr($v[0], 0, 7) === 'do_not_' or substr($v[0], 0, 3) === 'is_') {
}
}
elseif (in_array(substr($field, 0, 3), [
- 'is_',
- 'do_',
- ]) || CRM_Utils_Array::value('data_type', $info) == 'Boolean'
+ 'is_',
+ 'do_',
+ ]) || CRM_Utils_Array::value('data_type', $info) == 'Boolean'
) {
$options[$field] = 'yesno';
if ($entity != 'contact') {
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Contact_Form_Search_Criteria {
+
/**
* @param CRM_Core_Form $form
*/
'all_tag_types' => [
'name' => 'all_tag_types',
'class' => 'search-field__span-3 search-field__checkbox',
- 'help' => ['id' => 'id-all-tag-types']
+ 'help' => ['id' => 'id-all-tag-types'],
],
'phone_numeric' => [
'name' => 'phone_numeric',
]);
}
-
/**
* @param CRM_Core_Form $form
*/
*
* @return string
*/
+
/**
* @return string
*/
foreach ($this->_columns as $name => $field) {
if (in_array($field, [
- 'street_address',
- 'city',
- 'state_province',
- 'postal_code',
- 'country',
- ]) && empty($addressOptions[$field])
- ) {
+ 'street_address',
+ 'city',
+ 'state_province',
+ 'postal_code',
+ 'country',
+ ]) && empty($addressOptions[$field])) {
unset($this->_columns[$name]);
continue;
}
protected $_aclFrom = NULL;
protected $_aclWhere = NULL;
- protected $_datesTable = NULL, $_xgTable = NULL, $_igTable = NULL;
+ protected $_datesTable = NULL;
+ protected $_xgTable = NULL;
+ protected $_igTable = NULL;
/**
* Class constructor.
* for the search form.
*/
$form->assign('elements', [
- 'paid_online',
- 'start_date',
- 'end_date',
- 'show_payees',
- 'event_type_id',
- 'event_id',
- ]);
+ 'paid_online',
+ 'start_date',
+ 'end_date',
+ 'show_payees',
+ 'event_type_id',
+ 'event_id',
+ ]);
}
/**
return implode(' AND ', $clauses);
}
-
/* This function does a query to get totals for some of the search result columns and returns a totals array. */
+
/**
* @return array
*/
protected $_limitDetailClause = NULL;
protected $_limitNumber = 10;
- protected $_limitNumberPlus1 = 11; // this should be one more than self::LIMIT
+ /**
+ * this should be one more than self::LIMIT
+ * @var int
+ */
+ protected $_limitNumberPlus1 = 11;
protected $_foundRows = [];
'membership_status' => 'varchar(255)',
// We may have multiple files to list on one record.
// The temporary-table approach can't store full details for all of them
- 'file_ids' => 'varchar(255)', // comma-separate id listing
+ // comma-separate id listing
+ 'file_ids' => 'varchar(255)',
];
$sql = "
* keys: match-descriptor
* - count: int
*/
- public abstract function fillTempTable($queryText, $entityIDTableName, $detailTable, $queryLimit, $detailLimit);
+ abstract public function fillTempTable($queryText, $entityIDTableName, $detailTable, $queryLimit, $detailLimit);
/**
* @return bool
$query = $tableValues + [
'text' => CRM_Utils_QueryFormatter::singleton()
- ->format($queryText, CRM_Utils_QueryFormatter::LANG_SOLR),
+ ->format($queryText, CRM_Utils_QueryFormatter::LANG_SOLR),
];
list($intLimit, $intOffset) = $this->parseLimitOffset($limit);
$files = $searcher->search($query, $intLimit, $intOffset);
}
}
else {
- $fullTextFields = []; // array (string $sqlColumnName)
- $clauses = []; // array (string $sqlExpression)
+ // array (string $sqlColumnName)
+ $fullTextFields = [];
+ // array (string $sqlExpression)
+ $clauses = [];
foreach ($tableValues['fields'] as $fieldName => $fieldType) {
if ($fieldType == 'Int') {
'amount_level' => NULL,
'trxn_Id' => NULL,
'invoice_id' => NULL,
- 'check_number' => 'Int', // Odd: This is really a VARCHAR, so why are we searching like an INT?
+ // Odd: This is really a VARCHAR, so why are we searching like an INT?
+ 'check_number' => 'Int',
'total_amount' => 'Int',
],
],
class CRM_Contact_Form_Search_Custom_PostalMailing extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
protected $_aclFrom = NULL;
protected $_aclWhere = NULL;
+
/**
* Class constructor.
*
//unused
return '';
}
+
/**
* @param bool $includeContactIDs
*
/**
* @return mixed
*/
+
/**
* @return mixed
*/
class CRM_Contact_Form_Search_Custom_Sample extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
protected $_aclFrom = NULL;
protected $_aclWhere = NULL;
+
/**
* Class constructor.
*
* WHERE clause is an array built from any required JOINS plus conditional filters based on search criteria field values
*
*/
+
/**
* @param bool $includeContactIDs
*
return implode(' AND ', $clauses);
}
-
/*
* Functions below generally don't need to be modified
*/
class CRM_Contact_Form_Search_Custom_ZipCodeRange extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
protected $_aclFrom = NULL;
protected $_aclWhere = NULL;
+
/**
* Class constructor.
*
/**
* This includes the submitted values of the search form
+ * @var array
*/
static protected $_searchFormValues;
return $contactIds;
}
-
/**
* Set default values for the form. Relationship that in edit/view action.
*
*/
public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons([
- [
- 'type' => $nextType,
- 'name' => $title,
- 'isDefault' => TRUE,
- ],
- [
- 'type' => $backType,
- 'name' => ts('Cancel'),
- 'icon' => 'fa-times',
- ],
- ]
- );
+ [
+ 'type' => $nextType,
+ 'name' => $title,
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => $backType,
+ 'name' => ts('Cancel'),
+ 'icon' => 'fa-times',
+ ],
+ ]);
}
/**
$searchParams = $this->controller->exportValues();
if ($searchParams['radio_ts'] == 'ts_sel') {
// Create a static group.
- $randID = md5(time() . rand(1, 1000)); // groups require a unique name
+ // groups require a unique name
+ $randID = md5(time() . rand(1, 1000));
$grpTitle = "Hidden Group {$randID}";
$grpID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $grpTitle, 'id', 'title');
$status = [
ts('%count contact added to group', [
- 'count' => $added,
- 'plural' => '%count contacts added to group',
+ 'count' => $added,
+ 'plural' => '%count contacts added to group',
]),
];
if ($notAdded) {
$status[] = ts('%count contact was already in group', [
- 'count' => $notAdded,
- 'plural' => '%count contacts were already in group',
- ]);
+ 'count' => $notAdded,
+ 'plural' => '%count contacts were already in group',
+ ]);
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts('Added Contact to %1', [
- 1 => $groupName,
- 'count' => $added,
- 'plural' => 'Added Contacts to %1',
- ]), 'success', ['expires' => 0]);
+ 1 => $groupName,
+ 'count' => $added,
+ 'plural' => 'Added Contacts to %1',
+ ]), 'success', ['expires' => 0]);
if ($this->_context === 'amtg') {
CRM_Core_Session::singleton()
$this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), ['class' => 'crm-form-submit']);
$this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), ['class' => 'crm-form-submit']);
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Add to %1', [1 => $contactType]),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Add to %1', [1 => $contactType]),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
+
/**
* Add relationships from form.
*/
$status = [ts('%count contact tagged', ['count' => $added, 'plural' => '%count contacts tagged'])];
if ($notAdded) {
$status[] = ts('%count contact already had this tag', [
- 'count' => $notAdded,
- 'plural' => '%count contacts already had this tag',
- ]);
+ 'count' => $notAdded,
+ 'plural' => '%count contacts already had this tag',
+ ]);
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Added Tag <em>%1</em>", [1 => $this->_tags[$key]]), 'success', ['expires' => 0]);
/**
* Maximum contacts that should be allowed to update.
+ * @var int
*/
protected $_maxContacts = 100;
/**
* Maximum profile fields that will be displayed.
+ * @var int
*/
protected $_maxFields = 9;
/**
* Variable to store redirect path.
+ * @var string
*/
protected $_userContext;
/**
* When not to reset sort_name.
+ * @var bool
*/
protected $_preserveDefault = TRUE;
//$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
$this->addButtons([
- [
- 'type' => 'submit',
- 'name' => ts('Update Contact(s)'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'submit',
+ 'name' => ts('Update Contact(s)'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_contactIds);
CRM_Core_Session::setStatus('', ts("Updates Saved"), 'success');
if ($inValidSubtypeCnt) {
CRM_Core_Session::setStatus(ts('Contact Subtype field of 1 contact has not been updated.', [
- 'plural' => 'Contact Subtype field of %count contacts has not been updated.',
- 'count' => $inValidSubtypeCnt,
- ]), ts('Invalid Subtype'));
+ 'plural' => 'Contact Subtype field of %count contacts has not been updated.',
+ 'count' => $inValidSubtypeCnt,
+ ]), ts('Invalid Subtype'));
}
}
/**
* Cache shared address message so we don't query twice
+ * @var string
*/
protected $_sharedAddressMessage = NULL;
if (count($this->_contactIds) > 1) {
// more than one contact deleted
$message = ts('One of the selected contacts has an address record that is shared with 1 other contact.', [
- 'plural' => 'One or more selected contacts have address records which are shared with %count other contacts.',
- 'count' => $sharedAddressCount,
- ]);
+ 'plural' => 'One or more selected contacts have address records which are shared with %count other contacts.',
+ 'count' => $sharedAddressCount,
+ ]);
}
else {
// only one contact deleted
$message = ts('This contact has an address record which is shared with 1 other contact.', [
- 'plural' => 'This contact has an address record which is shared with %count other contacts.',
- 'count' => $sharedAddressCount,
- ]);
+ 'plural' => 'This contact has an address record which is shared with %count other contacts.',
+ 'count' => $sharedAddressCount,
+ ]);
}
CRM_Core_Session::setStatus($message . ' ' . ts('Shared addresses will not be removed or altered but will no longer be shared.'), ts('Shared Addesses Owner'));
}
if ($this->_restore) {
$title = ts('Restored');
$status = ts('%1 has been restored from the trash.', [
- 1 => $name,
- 'plural' => '%count contacts restored from trash.',
- 'count' => $deleted,
- ]);
+ 1 => $name,
+ 'plural' => '%count contacts restored from trash.',
+ 'count' => $deleted,
+ ]);
}
elseif ($this->_skipUndelete) {
$status = ts('%1 has been permanently deleted.', [
- 1 => $name,
- 'plural' => '%count contacts permanently deleted.',
- 'count' => $deleted,
- ]);
+ 1 => $name,
+ 'plural' => '%count contacts permanently deleted.',
+ 'count' => $deleted,
+ ]);
}
else {
$status = ts('%1 has been moved to the trash.', [
- 1 => $name,
- 'plural' => '%count contacts moved to trash.',
- 'count' => $deleted,
- ]);
+ 1 => $name,
+ 'plural' => '%count contacts moved to trash.',
+ 'count' => $deleted,
+ ]);
}
$session->setStatus($status, $title, 'success');
}
$count_success = count($form->_toContactDetails);
CRM_Core_Session::setStatus(ts('One message was sent successfully. ', array(
- 'plural' => '%count messages were sent successfully. ',
- 'count' => $count_success,
- )) . $followupStatus, ts('Message Sent', array('plural' => 'Messages Sent', 'count' => $count_success)), 'success');
+ 'plural' => '%count messages were sent successfully. ',
+ 'count' => $count_success,
+ )) . $followupStatus, ts('Message Sent', array('plural' => 'Messages Sent', 'count' => $count_success)), 'success');
}
// Display the name and number of contacts for those email is not sent.
}
$status = '(' . ts('because no email address on file or communication preferences specify DO NOT EMAIL or Contact is deceased or Primary email address is On Hold') . ')<ul><li>' . implode('</li><li>', $not_sent) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts('One Message Not Sent', array(
- 'count' => count($emailsNotSent),
- 'plural' => '%count Messages Not Sent',
- )), 'info');
+ 'count' => count($emailsNotSent),
+ 'plural' => '%count Messages Not Sent',
+ )), 'info');
}
if (isset($form->_caseId)) {
$pdf->Output($fileName, 'D');
}
-
/**
* Get the rows for the labels.
*
*/
public function buildQuickForm() {
$this->addButtons([
- [
- 'type' => 'done',
- 'name' => ts('Done'),
- 'isDefault' => TRUE,
- ],
- ]
- );
+ [
+ 'type' => 'done',
+ 'name' => ts('Done'),
+ 'isDefault' => TRUE,
+ ],
+ ]);
}
/**
/**
* Maximum contacts that should be allowed to update
+ * @var int
*/
protected $_maxContacts = 100;
/**
* Maximum profile fields that will be displayed
+ * @var int
*/
protected $_maxFields = 9;
/**
* Variable to store redirect path
+ * @var string
*/
protected $_userContext;
//validations
if (count($this->_contactIds) > $this->_maxContacts) {
CRM_Core_Session::setStatus(ts("The maximum number of contacts you can select for Update multiple contacts is %1. You have selected %2. Please select fewer contacts from your search results and try again.", [
- 1 => $this->_maxContacts,
- 2 => count($this->_contactIds),
- ]), ts('Maximum Exceeded'), 'error');
+ 1 => $this->_maxContacts,
+ 2 => count($this->_contactIds),
+ ]), ts('Maximum Exceeded'), 'error');
$validate = TRUE;
}
// just need to add a javacript to popup the window for printing
//
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Print Contact List'),
- 'js' => ['onclick' => 'window.print()'],
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'back',
- 'name' => ts('Done'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Print Contact List'),
+ 'js' => ['onclick' => 'window.print()'],
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'back',
+ 'name' => ts('Done'),
+ ],
+ ]);
}
/**
* @param CRM_Core_Form $form
* @param int $proxSearch
*/
- static public function buildQuickForm($form, $proxSearch) {
+ public static function buildQuickForm($form, $proxSearch) {
// is proximity search required (2) or optional (1)?
$proxRequired = ($proxSearch == 2 ? TRUE : FALSE);
$form->assign('proximity_search', TRUE);
if (empty($fields['prox_state_province_id']) || empty($fields['prox_country_id'])) {
$errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance.");
}
- if (!CRM_Utils_Array::value('prox_postal_code', $fields) AND
+ if (!CRM_Utils_Array::value('prox_postal_code', $fields) and
!CRM_Utils_Array::value('prox_city', $fields)
) {
$errors["prox_distance"] = ts("City OR Postal Code are required to search by distance.");
* @return array
* the default array reference
*/
- static public function setDefaultValues($form) {
+ public static function setDefaultValues($form) {
$defaults = [];
$config = CRM_Core_Config::singleton();
$countryDefault = $config->defaultContactCountry;
];
if ($notRemoved) {
$status[] = ts('1 contact was already not in this group', [
- 'count' => $notRemoved,
- 'plural' => '%count contacts were already not in this group',
- ]);
+ 'count' => $notRemoved,
+ 'plural' => '%count contacts were already not in this group',
+ ]);
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Removed Contact From Group", [
- 'plural' => "Removed Contacts From Group",
- 'count' => $removed,
- ]), 'success', ['expires' => 0]);
+ 'plural' => "Removed Contacts From Group",
+ 'count' => $removed,
+ ]), 'success', ['expires' => 0]);
}
}
$status = [
ts('%count contact un-tagged', [
- 'count' => $removed,
- 'plural' => '%count contacts un-tagged',
- ]),
+ 'count' => $removed,
+ 'plural' => '%count contacts un-tagged',
+ ]),
];
if ($notRemoved) {
$status[] = ts('1 contact already did not have this tag', [
- 'count' => $notRemoved,
- 'plural' => '%count contacts already did not have this tag',
- ]);
+ 'count' => $notRemoved,
+ 'plural' => '%count contacts already did not have this tag',
+ ]);
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Removed Tag <em>%1</em>", [1 => $this->_tags[$key]]), 'success', ['expires' => 0]);
*/
public function buildQuickForm() {
$this->addButtons([
- [
- 'type' => 'done',
- 'name' => ts('Done'),
- 'isDefault' => TRUE,
- ],
- ]
- );
+ [
+ 'type' => 'done',
+ 'name' => ts('Done'),
+ 'isDefault' => TRUE,
+ ],
+ ]);
}
}
public $_toContactPhone = [];
-
/**
* Pre process the provider.
*
if ($countSuccess > 0) {
CRM_Core_Session::setStatus(ts('One message was sent successfully.', [
- 'plural' => '%count messages were sent successfully.',
- 'count' => $countSuccess,
- ]), ts('Message Sent', ['plural' => 'Messages Sent', 'count' => $countSuccess]), 'success');
+ 'plural' => '%count messages were sent successfully.',
+ 'count' => $countSuccess,
+ ]), ts('Message Sent', ['plural' => 'Messages Sent', 'count' => $countSuccess]), 'success');
}
if (is_array($sent)) {
}
$status .= '</ul>';
CRM_Core_Session::setStatus($status, ts('One Message Not Sent', [
- 'count' => count($sent),
- 'plural' => '%count Messages Not Sent',
- ]), 'info');
+ 'count' => count($sent),
+ 'plural' => '%count Messages Not Sent',
+ ]), 'info');
}
else {
//Display the name and number of contacts for those sms is not sent.
}
$status .= ')<ul><li>' . implode('</li><li>', $not_sent) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts('One Message Not Sent', [
- 'count' => count($smsNotSent),
- 'plural' => '%count Messages Not Sent',
- ]), 'info');
+ 'count' => count($smsNotSent),
+ 'plural' => '%count Messages Not Sent',
+ ]), 'info');
}
}
}
if ($rowCount) {
CRM_Core_Session::setStatus(ts('%count email was found on hold and updated.', [
- 'count' => $rowCount,
- 'plural' => '%count emails were found on hold and updated.',
- ]), ts('Emails Restored'), 'success');
+ 'count' => $rowCount,
+ 'plural' => '%count emails were found on hold and updated.',
+ ]), ts('Emails Restored'), 'success');
}
else {
CRM_Core_Session::setStatus(ts('The selected contact does not have an email on hold.', [
- 'plural' => 'None of the selected contacts have an email on hold.',
- ]), ts('No Emails to Restore'), 'info');
+ 'plural' => 'None of the selected contacts have an email on hold.',
+ ]), ts('No Emails to Restore'), 'info');
}
}
else {
*/
class CRM_Contact_Import_Field {
- /**#@+
+ /**
+ * #@+
* @var string
*/
/**
* Name of the field
+ * @var string
*/
public $_name;
/**
* Title of the field to be used in display
+ * @var string
*/
public $_title;
closedir($handler);
if (!empty($results)) {
CRM_Core_Error::fatal(ts('<b>%1</b> file(s) in %2 directory are not writable. Listed file(s) might be used during the import to log the errors occurred during Import process. Contact your site administrator for assistance.', [
- 1 => implode(', ', $results),
- 2 => $config->uploadDir,
- ]));
+ 1 => implode(', ', $results),
+ 2 => $config->uploadDir,
+ ]));
}
$this->_dataSourceIsValid = FALSE;
}
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => ts('Continue'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => ts('Continue'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
/**
if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) {
//Mark Dedupe Rule Fields as required, since it's used in matching contact
foreach (array(
- 'Individual',
- 'Household',
- 'Organization',
- ) as $cType) {
+ 'Individual',
+ 'Household',
+ 'Organization',
+ ) as $cType) {
$ruleParams = array(
'contact_type' => $cType,
'used' => 'Unsupervised',
'type' => 'cancel',
'name' => ts('Cancel'),
),
- )
+ )
);
}
if (!empty($groups)) {
$this->addElement('select', 'groups', ts('Add imported records to existing group(s)'), $groups, array(
- 'multiple' => "multiple",
- 'class' => 'crm-select2',
- ));
+ 'multiple' => "multiple",
+ 'class' => 'crm-select2',
+ ));
}
//display new tag
* via a form post) and asynchronously (i.e. by the workflow system)
*/
class CRM_Contact_Import_Importer {
+
/**
*/
public function __construct() {
/**
* Running total number of un-matched Contacts.
+ * @var int
*/
protected $_unMatchCount;
/**
* Array of unmatched lines
+ * @var array
*/
protected $_unMatch;
/**
* Total number of contacts with unparsed addresses
+ * @var int
*/
protected $_unparsedAddressCount;
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
$headers = array_merge([
- ts('Line Number'),
- ts('Reason'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Reason'),
+ ], $customHeaders);
$this->_errorFileName = self::errorFileName(self::ERROR);
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_conflictCount) {
$headers = array_merge([
- ts('Line Number'),
- ts('Reason'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Reason'),
+ ], $customHeaders);
$this->_conflictFileName = self::errorFileName(self::CONFLICT);
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
$headers = array_merge([
- ts('Line Number'),
- ts('View Contact URL'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('View Contact URL'),
+ ], $customHeaders);
$this->_duplicateFileName = self::errorFileName(self::DUPLICATE);
self::exportCSV($this->_duplicateFileName, $headers, $this->_duplicates);
}
if ($this->_unMatchCount) {
$headers = array_merge([
- ts('Line Number'),
- ts('Reason'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Reason'),
+ ], $customHeaders);
$this->_misMatchFilemName = self::errorFileName(self::NO_MATCH);
self::exportCSV($this->_misMatchFilemName, $headers, $this->_unMatch);
}
if ($this->_unparsedAddressCount) {
$headers = array_merge([
- ts('Line Number'),
- ts('Contact Edit URL'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Contact Edit URL'),
+ ], $customHeaders);
$this->_errorFileName = self::errorFileName(self::UNPARSED_ADDRESS_WARNING);
self::exportCSV($this->_errorFileName, $headers, $this->_unparsedAddresses);
}
/**
* @param $elements
*/
+
/**
* @param $elements
*/
/**
* Array of successfully imported contact id's
*
- * @array
+ * @var array
*/
protected $_newContacts;
/**
* Array of successfully imported related contact id's
*
- * @array
+ * @var array
*/
protected $_newRelatedContacts;
$this->_updateWithId = FALSE;
if (in_array('id', $this->_mapperKeys) || ($this->_externalIdentifierIndex >= 0 && in_array($this->_onDuplicate, [
- CRM_Import_Parser::DUPLICATE_UPDATE,
- CRM_Import_Parser::DUPLICATE_FILL,
- ]))
- ) {
+ CRM_Import_Parser::DUPLICATE_UPDATE,
+ CRM_Import_Parser::DUPLICATE_FILL,
+ ]))) {
$this->_updateWithId = TRUE;
}
//check if external identifier exists in database
if (!empty($params['external_identifier']) && (!empty($params['id']) || in_array($onDuplicate, [
- CRM_Import_Parser::DUPLICATE_SKIP,
- CRM_Import_Parser::DUPLICATE_NOCHECK,
- ]))
- ) {
+ CRM_Import_Parser::DUPLICATE_SKIP,
+ CRM_Import_Parser::DUPLICATE_NOCHECK,
+ ]))) {
$extIDResult = civicrm_api3('Contact', 'get', [
'external_identifier' => $params['external_identifier'],
}
// check for valid related contact id in update/fill mode, CRM-4424
if (in_array($onDuplicate, [
- CRM_Import_Parser::DUPLICATE_UPDATE,
- CRM_Import_Parser::DUPLICATE_FILL,
- ]) && !empty($params[$key]['id'])
- ) {
+ CRM_Import_Parser::DUPLICATE_UPDATE,
+ CRM_Import_Parser::DUPLICATE_FILL,
+ ]) && !empty($params[$key]['id'])) {
$relatedContactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$key]['id'], 'contact_type');
if (!$relatedContactType) {
$errorMessage = ts("No contact found for this related contact ID: %1", [1 => $params[$key]['id']]);
$error = TRUE;
foreach ([
- $countryNames,
- $countryIsoCodes,
- $limitCodes,
- ] as $values) {
+ $countryNames,
+ $countryIsoCodes,
+ $limitCodes,
+ ] as $values) {
if (in_array(trim($countryValue), $values)) {
$error = FALSE;
break;
* is the time window in which they can check usernames
* (without reloading the overall form).
*/
- const CHECK_USERNAME_TTL = 10800; // 3hr; 3*60*60
+ // 3hr; 3*60*60
+ const CHECK_USERNAME_TTL = 10800;
- const AUTOCOMPLETE_TTL = 21600; // 6hr; 6*60*60
+ // 6hr; 6*60*60
+ const AUTOCOMPLETE_TTL = 21600;
/**
* Ajax callback for custom fields of type ContactReference
/**
* check the CMS username.
*/
- static public function checkUserName() {
+ public static function checkUserName() {
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), ['for', 'ts']);
$sig = CRM_Utils_Request::retrieve('sig', 'String');
$for = CRM_Utils_Request::retrieve('for', 'String');
CRM_Utils_System::civiExit();
}
-
public static function buildSubTypes() {
$parent = CRM_Utils_Request::retrieve('parentId', 'Positive');
$whereClause = $orderByClause = '';
$cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, json_decode($criteria, TRUE));
- $searchRows = [];
+ $searchRows = [];
$searchParams = self::getSearchOptionsFromRequest();
$queryParams = [];
}
if ($isOrQuery) {
- $whereClause = ' ( ' . implode(' OR ', $where) . ' ) ';
+ $whereClause = ' ( ' . implode(' OR ', $where) . ' ) ';
}
else {
if (!empty($where)) {
- $whereClause = implode(' AND ', $where);
+ $whereClause = implode(' AND ', $where);
}
}
$whereClause .= $whereClause ? ' AND de.id IS NULL' : ' de.id IS NULL';
if (!empty($pairInfo['data']['canMerge'])) {
$mergeParams = [
'reset' => 1,
- 'cid' => $pairInfo['entity_id1'],
- 'oid' => $pairInfo['entity_id2'],
- 'action' => 'update',
- 'rgid' => $rgid,
- 'criteria' => $criteria,
- 'limit' => CRM_Utils_Request::retrieve('limit', 'Integer'),
- ];
+ 'cid' => $pairInfo['entity_id1'],
+ 'oid' => $pairInfo['entity_id2'],
+ 'action' => 'update',
+ 'rgid' => $rgid,
+ 'criteria' => $criteria,
+ 'limit' => CRM_Utils_Request::retrieve('limit', 'Integer'),
+ ];
if ($gid) {
$mergeParams['gid'] = $gid;
}
$params = [
1 => [$isSelected, 'Boolean'],
- 3 => ["$cacheKeyString%", 'String'], // using % to address rows with conflicts as well
+ // using % to address rows with conflicts as well
+ 3 => ["$cacheKeyString%", 'String'],
];
//check pnid is_array or integer
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* @return array
* Main page for viewing contact.
*/
class CRM_Contact_Page_DedupeException extends CRM_Core_Page {
+
/**
* the main function that is called when the page loads,
* it decides the which action has to be taken for the page.
$where = NULL;
$onlyProcessSelected = ($action == CRM_Core_Action::MAP) ? 1 : 0;
- $total = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, NULL, ($onlyProcessSelected ? "pn.is_selected = 1" : NULL));
+ $total = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, NULL, ($onlyProcessSelected ? "pn.is_selected = 1" : NULL));
if ($total <= 0) {
// Nothing to do.
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry));
CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
for ($i = 1; $i <= ceil($total / self::BATCHLIMIT); $i++) {
- $task = new CRM_Queue_Task(
+ $task = new CRM_Queue_Task(
['CRM_Contact_Page_DedupeMerge', 'callBatchMerge'],
[$rgid, $gid, $mode, self::BATCHLIMIT, $onlyProcessSelected, $criteria],
"Processed " . $i * self::BATCHLIMIT . " pair of duplicates out of " . $total
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* Get BAO Name.
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* Delete a saved search.
/**
* The id of the object being viewed (note/relationship etc)
*
- * @int
+ * @var int
*/
protected $_id;
/**
* The contact id of the contact being viewed
*
- * @int
+ * @var int
*/
protected $_contactId;
/**
* The action that we are performing
*
- * @string
+ * @var string
*/
protected $_action;
/**
* The permission we have on this contact
*
- * @string
+ * @var string
*/
protected $_permission;
$mergedToContactID = $mergedTo['id'];
$mergedToDisplayName = $mergedTo['values'][$mergedToContactID]['api.Contact.get']['values'][0]['display_name'];
$title .= ' ' . ts('(This contact has been merged to <a href="%1">%2</a>)', [
- 1 => CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'cid' => $mergedToContactID]),
- 2 => $mergedToDisplayName,
- ]);
+ 1 => CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'cid' => $mergedToContactID]),
+ 2 => $mergedToDisplayName,
+ ]);
}
}
/**
* The id of the object being viewed (note/relationship etc).
*
- * @int
+ * @var int
*/
public $_groupId;
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* The action links for comments that we need to display for the browse screen
*
* @var array
*/
- static $_commentLinks = NULL;
+ public static $_commentLinks = NULL;
/**
* View details of a note.
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* Casid set if called from case context.
'url' => '#contact-summary',
'title' => ts('Summary'),
'weight' => 0,
- 'icon' => 'crm-i fa-address-card-o'
+ 'icon' => 'crm-i fa-address-card-o',
],
[
'id' => 'activity',
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* @throws Exception
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* We use desc to remind us what that column is, name is used in the tpl
*
* @var array
*/
- static $_columnHeaders;
+ public static $_columnHeaders;
/**
* Properties of contact we're interested in displaying
* @var array
*/
- static $_properties = [
+ public static $_properties = [
'contact_id',
'contact_type',
'contact_sub_type',
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Contact_Selector_Controller extends CRM_Core_Selector_Controller {
+
/**
* Default function for qill.
*
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* We use desc to remind us what that column is, name is used in the tpl
*
* @var array
*/
- static $_columnHeaders;
+ public static $_columnHeaders;
/**
* Properties of contact we're interested in displaying
* @var array
*/
- static $_properties = ['contact_id', 'contact_type', 'display_name'];
+ public static $_properties = ['contact_id', 'contact_type', 'display_name'];
/**
* FormValues is the array returned by exportValues called on
/**
* The object that implements the search interface
+ * @var object
*/
protected $_search;
*/
class CRM_Contact_Task extends CRM_Core_Task {
+ /**
+ * Contact tasks
+ */
const
- // Contact tasks
HOUSEHOLD_CONTACTS = 101,
ORGANIZATION_CONTACTS = 102,
RECORD_CONTACTS = 103,
INDIVIDUAL_CONTACTS = 110,
ADD_TO_CASE = 111;
- static $objectType = 'contact';
+ /**
+ * @var string
+ */
+ public static $objectType = 'contact';
public static function tasks() {
if (!self::$_tasks) {
foreach ([
self::MAP_CONTACTS,
self::CREATE_MAILING,
- self::TASK_SMS
+ self::TASK_SMS,
] as $task) {
if (isset(self::$_tasks[$task]) &&
!empty(self::$_tasks[$task]['title'])