*/
include("session.php");
if (file_exists($_SESSION['config']['lang'].'.php')) {
include($_SESSION['config']['lang'].'.php');
} else {
$_SESSION['error'] = "Language file missing...
";
}
require_once("class_functions.php");
require_once("class_db.php");
require_once("class_workflow.php");
$workf = new workflow();
$db = new dbquery();
$db->connect();
$table = "res_x";
//added by lgi for webdav_ws.php
$_SESSION['admin_models'] = array();
if ($_SESSION['config']['webdav'] == "true") {
require_once("class_webdav_tools.php");
$webdav = new webdav_tools();
}
if ($_REQUEST['action'] == "remove" && isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
$db->query("select RES_ID, DOCSERVER_ID, PATH, FILENAME, FORMAT FROM ".$table." where RES_ID = ".$_REQUEST['id']);
$line = $db->fetch_object();
$docserver = $line->DOCSERVER_ID;
$path = $line->PATH;
$filename = $line->FILENAME;
$format = $line->FORMAT;
$db->query("select PATH_TEMPLATE from ".$_SESSION['tablename']['docservers']." where DOCSERVER_ID = '".$docserver."'");
$line_doc = $db->fetch_object();
$docserver = $line_doc->PATH_TEMPLATE;
$file = $docserver.$path.strtolower($filename);
$file = str_replace("#",DIRECTORY_SEPARATOR,$file);
$db->query("Delete from ".$table." where RES_ID = ".$_REQUEST['id']);
if (isset($_REQUEST['ticket']) && !empty($_REQUEST['ticket'])){
$db->query("Delete from ".$_SESSION['tablename']['tickets_amounts']." where TICKET_ID = ".$_REQUEST['ticket']);
$db->query("Delete from ".$_SESSION['tablename']['tickets']." where TICKET_ID = ".$_REQUEST['ticket']);
if ($_SESSION['history']['ticketdel'] == "true") {
require_once("class_history.php");
$users = new history();
$users->add($_SESSION['tablename']['tickets'], $_REQUEST['ticket'],"DEL", _TICKET_DELETED." : ".$_SESSION['courrier']['identifier']." (".$_SESSION['courrier']['type_id'].")");
}
} else {
if ($_SESSION['history']['resdel'] == "true") {
require_once("class_history.php");
$users = new history();
$users->add($table, $_SESSION['courrier']['res_id'],"DEL", _ANSWER_DELETED." : ".$_SESSION['courrier']['identifier']." (".$_SESSION['courrier']['type_id'].")");
}
}
for ($i=0; $i < count($_SESSION['courrier']['reponses']) ; $i++) {
if ($_SESSION['courrier']['reponses'][$i]['ID'] == $_REQUEST['id']) {
unset($_SESSION['courrier']['reponses'][$i]);
$_SESSION['courrier']['reponses'] = array_values($_SESSION['courrier']['reponses']);
break;
}
}
}
unset($_SESSION['courrier']['reponses']);
$_SESSION['courrier']['reponses'] = array();
$db->query("SELECT RES_ID, TITLE, CREATION_DATE, SOURCE, ORIGIN, u.FIRSTNAME AS SIGN_FIRSTNAME,
u.LASTNAME AS SIGN_LASTNAME, u2.FIRSTNAME AS AUTHOR_FIRSTNAME, u2.LASTNAME AS AUTHOR_LASTNAME,
FORMAT
FROM ".$table."
LEFT JOIN ".$_SESSION["tablename"]["users"]." u ON (u.USER_ID = ".$table.".SIGNING)
LEFT JOIN ".$_SESSION["tablename"]["users"]." u2 ON (u2.USER_ID = ".$table.".TYPIST)
WHERE RELATION = '".$_SESSION['courrier']['res_id']."'
AND ".$table.".STATUS <> 'MEL'
ORDER BY CREATION_DATE DESC ");
while ($line = $db->fetch_object()) {
array_push($_SESSION['courrier']['reponses'],
array("ID" => $line->RES_ID,
"TITRE" => stripslashes($line->TITLE),
"DATE" => $line->CREATION_DATE,
'SOURCE' => $line->SOURCE,
"TICKET" => $line->ORIGIN,
"SIGN_FIRSTNAME" => $line->SIGN_FIRSTNAME,
"SIGN_LASTNAME" => $line->SIGN_LASTNAME ,
"AUTHOR_FIRSTNAME" => $line->AUTHOR_FIRSTNAME,
"AUTHOR_LASTNAME" => $line->AUTHOR_LASTNAME,
"FORMAT" => $line->FORMAT));
}
//updated by lgi for oo_generate selon le type de model choisi !!!!
$fenetre = 'choose_model.php?id=' . $_SESSION['courrier']['res_id'];
?>