/** * Delete a contact * * @param Integer $c_id contact_id * @return Boolean */ function DeleteContact($c_id) { global $cdg_sql, $c_use_connectors; $sql_id = sql_parse_id($c_id, true); $this->logger->debug("Delete contact $c_id"); $obm_q = new DB_OBM; $query = "SELECT contact_company_id, contact_birthday_id, contact_usercreate, contact_addressbook_id FROM Contact WHERE contact_id $sql_id"; $this->logger->core($query); $obm_q->query($query); $obm_q->next_record(); $comp_id = $obm_q->f('contact_company_id'); $birthday_id = $obm_q->f('contact_birthday_id'); $uid = $obm_q->f('contact_usercreate'); $ad = $obm_q->f('contact_addressbook_id'); // Hook : Pre if (function_exists('hook_pre_run_query_contact_delete')) { if (! hook_pre_run_query_contact_delete($c_id)) { return false; } } run_query_global_delete_document_links($c_id, 'contact'); $ret = of_userdata_query_delete('contact', $c_id); // BEGIN birthday support $query = "DELETE FROM Event WHERE event_id = '$birthday_id'"; $this->logger->core($query); $obm_q->query($query); // END birthday support of_entity_delete('contact', $c_id); $query = "DELETE FROM Contact WHERE contact_id $sql_id"; $this->logger->core($query); $obm_q->query($query); // If connectors in use if ($c_use_connectors) { $query = "INSERT INTO DeletedContact (deletedcontact_contact_id, deletedcontact_addressbook_id, deletedcontact_timestamp, deletedcontact_origin) VALUES ($c_id, $ad, NOW(), '$GLOBALS[c_origin_cron]')"; $this->logger->core($query); $obm_q->query($query); } // After contact deletion to get correct number run_query_global_company_contact_number_update($comp_id); // Delete index OBM_IndexingService::delete('contact', $c_id); }
} $display['title'] = dis_portlet_navbar($params, $current_view); display_page($display); exit(); /////////////////////////////////////////////////////////////////////////////// } elseif ($action == 'draw') { echo dis_calendar_draw($current_view, $params['ndays']); // Store current_view in session $_SESSION['cal_current_view'] = serialize($current_view); exit(); } elseif ($action == 'async_indexing') { /////////////////////////////////////////////////////////////////////////////// if ($params['remove']) { OBM_IndexingService::delete('event', $params['id']); } else { run_query_calendar_solr_store($params['id']); } exit(); } elseif ($action == 'share_calendar') { /////////////////////////////////////////////////////////////////////////////// if(OBM_Acl::areAllowed($obm['uid'], 'calendar',array($params['entity_id']), 'admin' )) { run_query_calendar_update_token($params); $display['msg'] .= display_ok_msg("$l_shares : $l_update_ok"); } else { $display['msg'] .= display_warn_msg($l_share_err_auth); } $display['detail'] = dis_calendar_right_dis_admin($params['entity_id']);
public static function delete($contact) { global $obm, $cdg_sql, $c_use_connectors; if (!$contact->id) return false; //else $obm_q = new DB_OBM; $multidomain = sql_multidomain('contact'); $sql_id = sql_parse_id($contact->id); $comp_id = sql_parse_id($contact->company_id); run_query_global_delete_document_links($contact->id, 'contact'); $ret = of_userdata_query_delete('contact', $contact->id); //FIXME: do it better // BEGIN birthday and anniversary support run_query_contact_birthday_update('birthday', null, null, $contact->birthday_event, null, null, null); run_query_contact_birthday_update('anniversary', null, null, $contact->anniversary_event, null, null, null); // END birthday and anniversary support of_entity_delete('contact', $contact->id); $query = "DELETE FROM Contact WHERE contact_id = $sql_id $multidomain"; display_debug_msg($query, $cdg_sql, 'OBM_Contact::delete(1)'); $retour = $obm_q->query($query); OBM_AddressBook::timestamp($contact->addressbook_id); // If connectors in use if ($c_use_connectors) { $uid = sql_parse_id($obm['uid']); $query = "INSERT INTO DeletedContact ( deletedcontact_contact_id, deletedcontact_addressbook_id, deletedcontact_timestamp, deletedcontact_origin) VALUES ( $contact->id, $contact->addressbook_id, NOW(), '$GLOBALS[c_origin_web]' ) "; display_debug_msg($query, $cdg_sql, 'OBM_Contact::delete(2)'); $retour = $obm_q->query($query); } // After contact deletion to get correct number run_query_global_company_contact_number_update($comp_id); // Delete index OBM_IndexingService::delete('contact', $contact->id); return $retour; }