*/
public static function deleteObjectWithPrimary($type, $id) {
if (!$id || !is_numeric($id)) {
- return false;
+ return FALSE;
}
$daoName = "CRM_Core_DAO_$type";
$obj = new $daoName();
$obj->delete();
}
else {
- return false;
+ return FALSE;
}
$dao = new $daoName();
$dao->contact_id = $contactId;
$dao->free();
CRM_Utils_Hook::post('delete', $type, $id, $obj);
$obj->free();
+ return TRUE;
}
}
* Call common delete function
*/
static function del($id) {
- CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Address', $id);
+ return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Address', $id);
}
}
* Call common delete function
*/
static function del($id) {
- CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Email', $id);
+ return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Email', $id);
}
}
* Call common delete function
*/
static function del($id) {
- CRM_Contact_BAO_Contact::deleteObjectWithPrimary('IM', $id);
+ return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('IM', $id);
}
}
* Call common delete function
*/
static function del($id) {
- CRM_Contact_BAO_Contact::deleteObjectWithPrimary('OpenID', $id);
+ return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('OpenID', $id);
}
}
* Call common delete function
*/
static function del($id) {
- CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Phone', $id);
+ return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Phone', $id);
}
}
static function del($ids) {
$query = 'DELETE FROM civicrm_website WHERE id IN ( ' . implode(',', $ids) . ')';
CRM_Core_DAO::executeQuery($query);
+ // FIXME: we should return false if the del was unsuccessful
+ return TRUE;
}
/**
*
* @return <type>
*/
-function civicrm_api3_create_error($msg, $data = array(
- ), &$dao = NULL) {
+function civicrm_api3_create_error($msg, $data = array(), &$dao = NULL) {
//fix me - $dao should be param 4 & 3 should be $apiRequest
if (is_object($dao)) {
$dao->free();
$args = array(&$params['id']);
if (method_exists($bao_name, 'del')) {
$bao = call_user_func_array(array($bao_name, 'del'), $args);
- return civicrm_api3_create_success(TRUE);
+ if ($bao !== FALSE) {
+ return civicrm_api3_create_success(TRUE);
+ }
+ return civicrm_api3_create_error('Could not delete entity id ' . $params['id']);
}
elseif (method_exists($bao_name, 'delete')) {
$dao = new $bao_name();