diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index a1c22621351d..5f3a49995388 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -29,6 +29,7 @@ class CRM_Contact_BAO_Contact_Utils { * If profile overlay class should be added. * * @return string + * @throws \CRM_Core_Exception */ public static function getImage($contactType, $urlOnly = FALSE, $contactId = NULL, $addProfileOverlay = TRUE) { static $imageInfo = []; @@ -136,6 +137,7 @@ public static function checkContactType(&$contactIds) { * * @return array * ( $cs, $ts, $live ) + * @throws \CRM_Core_Exception */ public static function generateChecksum($entityId, $ts = NULL, $live = NULL, $hash = NULL, $entityType = 'contact', $hashSize = NULL) { // return a warning message if we dont get a entityId @@ -200,6 +202,8 @@ public static function generateChecksum($entityId, $ts = NULL, $live = NULL, $ha * * @return bool * true if valid, else false + * + * @throws \CRM_Core_Exception */ public static function validChecksum($contactID, $inputCheck) { @@ -236,6 +240,8 @@ public static function validChecksum($contactID, $inputCheck) { * @param int $previousEmployerID * @param bool $newContact * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public static function createCurrentEmployerRelationship($contactID, $organization, $previousEmployerID = NULL, $newContact = FALSE) { //if organization name is passed. CRM-15368,CRM-15547 @@ -266,7 +272,7 @@ public static function createCurrentEmployerRelationship($contactID, $organizati // get the relationship type id of "Employee of" $relTypeId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', 'Employee of', 'id', 'name_a_b'); if (!$relTypeId) { - CRM_Core_Error::fatal(ts("You seem to have deleted the relationship type 'Employee of'")); + throw new CRM_Core_Exception(ts("You seem to have deleted the relationship type 'Employee of'")); } // create employee of relationship @@ -312,6 +318,7 @@ public static function createCurrentEmployerRelationship($contactID, $organizati * @param int $previousEmpID * * @throws CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ public static function currentEmployerRelatedMembership($contactID, $employerID, $relationshipParams, $duplicate = FALSE, $previousEmpID = NULL) { $ids = []; @@ -374,6 +381,9 @@ public static function updateCurrentEmployer($organizationId) { * Contact id ( mostly individual contact id). * @param int $employerId * Contact id ( mostly organization contact id). + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public static function clearCurrentEmployer($contactId, $employerId = NULL) { $query = "UPDATE civicrm_contact @@ -390,7 +400,7 @@ public static function clearCurrentEmployer($contactId, $employerId = NULL) { //get the relationship type id of "Employee of" $relTypeId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', 'Employee of', 'id', 'name_a_b'); if (!$relTypeId) { - CRM_Core_Error::fatal(ts("You seem to have deleted the relationship type 'Employee of'")); + throw new CRM_Core_Exception(ts("You seem to have deleted the relationship type 'Employee of'")); } $relMembershipParams['relationship_type_id'] = $relTypeId . '_a_b'; $relMembershipParams['contact_check'][$employerId] = 1; @@ -424,6 +434,7 @@ public static function clearCurrentEmployer($contactId, $employerId = NULL) { * @param string $title * fieldset title. * + * @throws \CiviCRM_API3_Exception */ public static function buildOnBehalfForm(&$form, $contactType, $countryID, $stateID, $title) { $form->assign('contact_type', $contactType); @@ -902,7 +913,7 @@ public static function updateGreeting($params) { $allGreetings = CRM_Core_PseudoConstant::greeting($filter); $originalGreetingString = $greetingString = CRM_Utils_Array::value($valueID, $allGreetings); if (!$greetingString) { - CRM_Core_Error::fatal(ts('Incorrect greeting value id %1, or no default greeting for this contact type and greeting type.', [1 => $valueID])); + throw new CRM_Core_Exception(ts('Incorrect greeting value id %1, or no default greeting for this contact type and greeting type.', [1 => $valueID])); } // build return properties based on tokens @@ -1119,7 +1130,9 @@ public static function processGreetingTemplate(&$templateString, $contactDetails * * @param int $contactId * The hypothetical contact ID + * * @return bool + * @throws \CRM_Core_Exception */ public static function isContactId($contactId) { if ($contactId) {