}
}
- /**
- * Function to set is_delete true or restore deleted contact.
- *
- * @param CRM_Contact_DAO_Contact $contact
- * Contact DAO object.
- * @param bool $restore
- * True to set the is_delete = 1 else false to restore deleted contact,
- * i.e. is_delete = 0
- *
- * @deprecated
- *
- * @return bool
- * @throws \CRM_Core_Exception
- */
- public static function contactTrashRestore($contact, $restore = FALSE) {
- CRM_Core_Error::deprecatedFunctionWarning('Use the api');
-
- if ($restore) {
- CRM_Core_Error::deprecatedFunctionWarning('Use contact.create to restore - this does nothing much');
- // @todo deprecate calling contactDelete with the intention to restore.
- $updateParams = [
- 'id' => $contact->id,
- 'is_deleted' => FALSE,
- ];
- self::create($updateParams);
- return TRUE;
- }
- return self::contactTrash($contact);
- }
-
/**
* Get contact type for a contact.
*
return $returnParams;
}
- /**
- * @deprecated Not used anywhere, use the Phone API instead
- * Get the sms number and display name of a contact.
- *
- * @param int $id
- * Id of the contact.
- * @param string|null $type
- *
- * @return array
- * tuple of display_name and sms if found, or (null,null)
- */
- public static function getPhoneDetails($id, $type = NULL) {
- CRM_Core_Error::deprecatedFunctionWarning('Phone.get API instead');
- if (!$id) {
- return [NULL, NULL];
- }
-
- $cond = NULL;
- if ($type) {
- $cond = " AND civicrm_phone.phone_type_id = '$type'";
- }
-
- $sql = "
- SELECT civicrm_contact.display_name, civicrm_phone.phone, civicrm_contact.do_not_sms
- FROM civicrm_contact
-LEFT JOIN civicrm_phone ON ( civicrm_phone.contact_id = civicrm_contact.id )
- WHERE civicrm_phone.is_primary = 1
- $cond
- AND civicrm_contact.id = %1";
-
- $params = [1 => [$id, 'Integer']];
- $dao = CRM_Core_DAO::executeQuery($sql, $params);
- if ($dao->fetch()) {
- return [$dao->display_name, $dao->phone, $dao->do_not_sms];
- }
- return [NULL, NULL, NULL];
- }
-
/**
* Get the information to map a contact.
*
}
}
- /**
- * Check if there is a given column in a specific table.
- *
- * @deprecated
- * @see CRM_Core_BAO_SchemaHandler::checkIfFieldExists
- *
- * @param string $tableName
- * @param string $columnName
- * @param bool $i18nRewrite
- * Whether to rewrite the query on multilingual setups.
- *
- * @return bool
- * true if exists, else false
- */
- public static function checkFieldExists($tableName, $columnName, $i18nRewrite = TRUE) {
- CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_SchemaHandler::checkIfFieldExists');
- return CRM_Core_BAO_SchemaHandler::checkIfFieldExists($tableName, $columnName, $i18nRewrite);
- }
-
/**
* Scans all the tables using a slow query and table name.
*
}
}
- /**
- * @param string $prefix
- * @param bool $addRandomString
- * @param null $string
- *
- * @return string
- * @deprecated
- * @see CRM_Utils_SQL_TempTable
- */
- public static function createTempTableName($prefix = 'civicrm', $addRandomString = TRUE, $string = NULL) {
- CRM_Core_Error::deprecatedFunctionWarning('Use CRM_Utils_SQL_TempTable interface to create temporary tables');
- $tableName = $prefix . "_temp";
-
- if ($addRandomString) {
- if ($string) {
- $tableName .= "_" . $string;
- }
- else {
- $tableName .= "_" . md5(uniqid('', TRUE));
- }
- }
- return $tableName;
- }
-
/**
* @param bool $view
* @param bool $trigger
}
}
- /**
- * @deprecated - use CRM_Core_PseudoConstant::getLabel
- *
- * @param string $groupName
- * @param $value
- * @param bool $onlyActiveValue
- *
- * @return null
- */
- public static function getLabel($groupName, $value, $onlyActiveValue = TRUE) {
- CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_PseudoConstant::getLabel');
- if (empty($groupName) ||
- empty($value)
- ) {
- return NULL;
- }
-
- $query = "
-SELECT v.label as label ,v.value as value
-FROM civicrm_option_value v,
- civicrm_option_group g
-WHERE v.option_group_id = g.id
- AND g.name = %1
- AND g.is_active = 1
- AND v.value = %2
-";
- if ($onlyActiveValue) {
- $query .= " AND v.is_active = 1 ";
- }
- $p = [
- 1 => [$groupName, 'String'],
- 2 => [$value, 'Integer'],
- ];
- $dao = CRM_Core_DAO::executeQuery($query, $p);
- if ($dao->fetch()) {
- return $dao->label;
- }
- return NULL;
- }
-
- /**
- * @deprecated
- *
- * This function is not cached.
- *
- * @param string $groupName
- * @param $label
- * @param string $labelField
- * @param string $labelType
- * @param string $valueField
- *
- * @return null
- */
- public static function getValue(
- $groupName,
- $label,
- $labelField = 'label',
- $labelType = 'String',
- $valueField = 'value'
- ) {
- if (empty($label)) {
- return NULL;
- }
-
- CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_PseudoConstant::getKey');
-
- $query = "
-SELECT v.label as label ,v.{$valueField} as value
-FROM civicrm_option_value v,
- civicrm_option_group g
-WHERE v.option_group_id = g.id
- AND g.name = %1
- AND v.is_active = 1
- AND g.is_active = 1
- AND v.$labelField = %2
-";
-
- $p = [
- 1 => [$groupName, 'String'],
- 2 => [$label, $labelType],
- ];
- $dao = CRM_Core_DAO::executeQuery($query, $p);
- if ($dao->fetch()) {
- return $dao->value;
- }
- return NULL;
- }
-
/**
* Get option_value.value from default option_value row for an option group
*
return $valueFound;
}
-/**
- * Returns field names of the given entity fields.
- *
- * @deprecated
- * @param array $fields
- * Fields array to retrieve the field names for.
- * @return array
- */
-function _civicrm_api3_field_names($fields) {
- CRM_Core_Error::deprecatedFunctionWarning('array_column');
- $result = [];
- foreach ($fields as $key => $value) {
- if (!empty($value['name'])) {
- $result[] = $value['name'];
- }
- }
- return $result;
-}
-
/**
* Get function for query object api.
*