. */ /** * @brief Delete a structure * * * @file * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup admin */ require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_contacts_v2.php"); $contact = new contacts_v2(); $core_tools = new core_tools(''); $core_tools->test_admin('admin_contacts', 'apps'); $core_tools->load_lang(); $db = new Database(); /****************Management of the location bar ************/ $init = false; if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") { $init = true; } $level = ""; if (isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1) ) { $level = $_REQUEST['level']; } $pagePath = $_SESSION['config']['businessappurl'] . 'index.php?page=contact_purposes_del'; $pageLabel = _CONTACT_PURPOSE_DEL; $pageId = "contact_purposes_del"; $core_tools->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); /***********************************************************/ if(isset($_GET['id'])) { $id = addslashes(functions::wash($_GET['id'], "no", _THE_CONTACT_PURPOSE)); } else { $id = ""; } if ($_REQUEST['valid']) { $id = $_POST['id']; if ($_POST['new']){ $newid = $_POST['new']; // delete contact types $db->query("DELETE FROM ".$_SESSION['tablename']['contact_purposes']." WHERE id = ?", array($id)); $db->query("UPDATE ".$_SESSION['tablename']['contact_addresses']." SET contact_purpose_id = ? WHERE contact_purpose_id = ?", array($newid, $id)); if($_SESSION['history']['contact_purposes_del'] == "true") { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); $users = new history(); $users->add($_SESSION['tablename']['contact_purposes'], $id,"DEL",'contact_purposes_del',_CONTACT_TYPE_DEL." ".strtolower(_NUM).$id."", $_SESSION['config']['databasetype']); } $_SESSION['info'] = _DELETED_CONTACT_PURPOSE."."; unset($_SESSION['m_admin']); ?> type_purpose_address_del($id, true, $_SESSION['tablename']['contact_purposes'], 'contact_purpose', _DELETED_CONTACT_PURPOSE, _WARNING_MESSAGE_DEL_CONTACT_PURPOSE, _CONTACT_PURPOSE_DEL, _CONTACT_PURPOSE_REAFFECT, _NEW_CONTACT_PURPOSE, _CHOOSE_CONTACT_PURPOSES, 'contact_purposes', 'contact_purposes_del', _CONTACT_PURPOSE); } } else { $contact->type_purpose_address_del($id, true, $_SESSION['tablename']['contact_purposes'], 'contact_purpose', _DELETED_CONTACT_PURPOSE, _WARNING_MESSAGE_DEL_CONTACT_PURPOSE, _CONTACT_PURPOSE_DEL, _CONTACT_PURPOSE_REAFFECT, _NEW_CONTACT_PURPOSE, _CHOOSE_CONTACT_PURPOSES, 'contact_purposes', 'contact_purposes_del', _CONTACT_PURPOSE); }