Merge pull request #1373 from ravishnair/CRM-13037
[civicrm-core.git] / CRM / Contact / BAO / RelationshipType.php
index 4a0e1b2192ac8c53e8c90efd4120b953484ac3da..ad6bdff9d68944fd31de4dec9b47d58169dce9ed 100644 (file)
@@ -137,8 +137,10 @@ class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType
    */
   static function del($relationshipTypeId) {
     // make sure relationshipTypeId is an integer
+    // @todo review this as most delete functions rely on the api & form layer for this
+    // or do a find first & throw error if no find
     if (!CRM_Utils_Rule::positiveInteger($relationshipTypeId)) {
-      CRM_Core_Error::fatal(ts('Invalid relationship type'));
+      throw new CRM_Core_Exception(ts('Invalid relationship type'));
     }
 
 
@@ -155,7 +157,7 @@ UPDATE civicrm_membership_type
   SET  relationship_type_id = NULL
  WHERE relationship_type_id = %1
 ";
-    $params = array(1 => array($relationshipTypeId, 'Integer'));
+    $params = array(1 => array(CRM_Core_DAO::VALUE_SEPARATOR . $relationshipTypeId . CRM_Core_DAO::VALUE_SEPARATOR, 'String'));
     CRM_Core_DAO::executeQuery($query, $params);
 
     //fixed for CRM-3323