don't try to convert blanks
[civicrm-core.git] / CRM / Utils / DeprecatedUtils.php
index d0a4e1512b8e769b2a7d4da5d8cb5386d9b13790..d7e4fcbce7bee36d5f1fc442ab424df94b185b62 100644 (file)
@@ -410,107 +410,3 @@ function _civicrm_api3_deprecated_duplicate_formatted_contact($params) {
   }
   return civicrm_api3_create_success(TRUE);
 }
-
-/**
- *
- * @param array $params
- *
- * @param bool $checkDuplicate
- *
- * @return array|bool
- *   <type>
- */
-function _civicrm_api3_deprecated_participant_check_params($params, $checkDuplicate = FALSE) {
-
-  // check if participant id is valid or not
-  if (!empty($params['id'])) {
-    $participant = new CRM_Event_BAO_Participant();
-    $participant->id = $params['id'];
-    if (!$participant->find(TRUE)) {
-      return civicrm_api3_create_error(ts('Participant  id is not valid'));
-    }
-  }
-  require_once 'CRM/Contact/BAO/Contact.php';
-  // check if contact id is valid or not
-  if (!empty($params['contact_id'])) {
-    $contact = new CRM_Contact_BAO_Contact();
-    $contact->id = $params['contact_id'];
-    if (!$contact->find(TRUE)) {
-      return civicrm_api3_create_error(ts('Contact id is not valid'));
-    }
-  }
-
-  // check that event id is not an template
-  if (!empty($params['event_id'])) {
-    $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template');
-    if (!empty($isTemplate)) {
-      return civicrm_api3_create_error(ts('Event templates are not meant to be registered.'));
-    }
-  }
-
-  $result = [];
-  if ($checkDuplicate) {
-    if (CRM_Event_BAO_Participant::checkDuplicate($params, $result)) {
-      $participantID = array_pop($result);
-
-      $error = CRM_Core_Error::createError("Found matching participant record.",
-        CRM_Core_Error::DUPLICATE_PARTICIPANT,
-        'Fatal', $participantID
-      );
-
-      return civicrm_api3_create_error($error->pop(),
-        [
-          'contactID' => $params['contact_id'],
-          'participantID' => $participantID,
-        ]
-      );
-    }
-  }
-  return TRUE;
-}
-
-/**
- * @param $result
- * @param int $activityTypeID
- *
- * @return array
- *   <type> $params
- */
-function _civicrm_api3_deprecated_activity_buildmailparams($result, $activityTypeID) {
-  // get ready for collecting data about activity to be created
-  $params = [];
-
-  $params['activity_type_id'] = $activityTypeID;
-
-  $params['status_id'] = 'Completed';
-  if (!empty($result['from']['id'])) {
-    $params['source_contact_id'] = $params['assignee_contact_id'] = $result['from']['id'];
-  }
-  $params['target_contact_id'] = [];
-  $keys = ['to', 'cc', 'bcc'];
-  foreach ($keys as $key) {
-    if (is_array($result[$key])) {
-      foreach ($result[$key] as $key => $keyValue) {
-        if (!empty($keyValue['id'])) {
-          $params['target_contact_id'][] = $keyValue['id'];
-        }
-      }
-    }
-  }
-  $params['subject'] = $result['subject'];
-  $params['activity_date_time'] = $result['date'];
-  $params['details'] = $result['body'];
-
-  $numAttachments = Civi::settings()->get('max_attachments_backend') ?? CRM_Core_BAO_File::DEFAULT_MAX_ATTACHMENTS_BACKEND;
-  for ($i = 1; $i <= $numAttachments; $i++) {
-    if (isset($result["attachFile_$i"])) {
-      $params["attachFile_$i"] = $result["attachFile_$i"];
-    }
-    else {
-      // No point looping 100 times if there's only one attachment
-      break;
-    }
-  }
-
-  return $params;
-}