Delete long-deprecated functions
authorColeman Watts <coleman@civicrm.org>
Wed, 1 Mar 2023 00:04:36 +0000 (19:04 -0500)
committerColeman Watts <coleman@civicrm.org>
Wed, 1 Mar 2023 00:04:36 +0000 (19:04 -0500)
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Contact/Location.php
CRM/Core/DAO.php
CRM/Core/OptionGroup.php
api/v3/utils.php

index f3ca57be8047a5f31484f21b62b92c50dc1712e8..c9c9dc964c852f1ff6d3487acdacc409300b2210 100644 (file)
@@ -1147,36 +1147,6 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
     }
   }
 
-  /**
-   * 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.
    *
index 2e3a0fdb993e95d334895e0e1f94a90d2a13e0d1..13f533ba6629a54e6228a135a9b30b6e90105af4 100644 (file)
@@ -59,44 +59,6 @@ class CRM_Contact_BAO_Contact_Location {
     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.
    *
index b8c672a596dd715afc24e560692d67d1a99cc3b7..f63391c46d2821ba820e314d128c5c39093b0edc 100644 (file)
@@ -1080,25 +1080,6 @@ class CRM_Core_DAO extends DB_DataObject {
     }
   }
 
-  /**
-   * 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.
    *
@@ -2441,30 +2422,6 @@ SELECT contact_id
     }
   }
 
-  /**
-   * @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
index 04e989436c426b0f97dbae1df19de24040c93b0b..b0701cc5f2cb2211713464f9f7289267df8326dd 100644 (file)
@@ -328,94 +328,6 @@ WHERE  v.option_group_id = g.id
     }
   }
 
-  /**
-   * @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
    *
index 2a03f8e4a7cb203133f8b033ad8244796ffa16eb..11507b7c0aa2ccbecca8cc4c8fdfdb050e8742dc 100644 (file)
@@ -457,25 +457,6 @@ function _civicrm_api3_store_values(array $fields, array $params, &$values): boo
   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.
  *