*/ session_name('LetterBox2'); session_start(); if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } else { $_SESSION['error'] = "Language file missing...
"; } $s_id=$_SESSION['courrier']['res_id']; require_once("class_functions.php"); require_once("class_db.php"); require_once("class_history.php"); $_SESSION['error'] =""; //if($_REQUEST['cancel']) //{ // $_SESSION['courrier'] = array(); //exit; //} $conn= new dbquery(); $conn -> connect(); $table="res_x"; $num = ""; $rue = ""; $notes = ""; $cp = ""; $ville = ""; $qualite = ""; $custom_t5 = 'false'; $cutom_t15 = 'false'; $custom_t6 = 'false'; $custom_t7 = 'false'; $custom_t16 = 'false'; $custom_t17 = 'false'; $quartier = ""; ?> html_entity_decode("["._NUM."]", ENT_NOQUOTES, 'UTF-8')) {$num=$_POST['num'];} if (isset($_POST['rue']) && trim($_POST['rue']) <> html_entity_decode('['._CHRONO_DEP_VALUE.']', ENT_NOQUOTES, 'UTF-8')) {$rue=$_POST['rue'];} if (isset($_POST['cp']) && trim($_POST['cp']) <> html_entity_decode('['._CHRONO_START_VALUE.']', ENT_NOQUOTES, 'UTF-8')) {$cp=$_POST['cp'];} if (isset($_POST['ville']) && trim($_POST['ville']) <> html_entity_decode('['._START_END_DATE.']', ENT_NOQUOTES, 'UTF-8')) {$ville=$_POST['ville'];} } else { if (isset($_POST['num']) && trim($_POST['num']) <> html_entity_decode("["._NUM."]", ENT_NOQUOTES, 'UTF-8')) {$num=$_POST['num'];} if (isset($_POST['rue']) && trim($_POST['rue']) <> html_entity_decode("["._ROAD."]", ENT_NOQUOTES, 'UTF-8')) {$rue=$_POST['rue'];} if (isset($_POST['cp']) && ereg('^[0-9][0-9][0-9][0-9][0-9]$', $_POST['cp'])) {$cp=$_POST['cp'];} if (isset($_POST['ville']) && trim($_POST['ville']) <> html_entity_decode("["._CITY."]", ENT_NOQUOTES, 'UTF-8')) {$ville=$_POST['ville'];} } if (isset($_POST['qualite'])) {$qualite=$_POST['qualite'];} if (isset($_POST['notes'])) {$notes=$_POST['notes'];} if (isset($_POST['rep_courrier'])){$custom_t5=$_POST['rep_courrier'];} if (isset($_POST['rep_AR'])) {$custom_t15=$_POST['rep_AR'];} if (isset($_POST['direct'])) {$custom_t6=$_POST['direct'];} if (isset($_POST['mail'])) {$custom_t7=$_POST['mail'];} if (($_POST['autre']=="true") && $_POST['info_autre'] <> html_entity_decode("["._DEFINE."]", ENT_NOQUOTES, 'UTF-8')) {$info_autre=$_POST['info_autre'];} else {$info_autre='false';} if (isset($_POST['fax'])) {$custom_t16=$_POST['fax'];} if (isset($_POST['none'])) {$custom_t17=$_POST['none'];} if (isset($_POST['quartier'])) {$quartier=$_POST['quartier'];} if(isset($_POST['notes'])){$notes =$_POST['notes']; } $conn->query( "UPDATE ".$table." SET CUSTOM_T14 = '".addslashes($quartier)."', CUSTOM_T17='".$custom_t17."' ,CUSTOM_T5='".$custom_t5."' ,CUSTOM_T6='".$custom_t6."' ,CUSTOM_T7='".$custom_t7."' ,CUSTOM_T8='".$info_autre."' ,CUSTOM_T15='".$custom_t15."' ,CUSTOM_T16='".$custom_t16."' ,CUSTOM_T10='".addslashes($num)."' ,CUSTOM_T11='".addslashes($rue)."', CUSTOM_T12='".addslashes($ville)."' , CUSTOM_T13='".$cp."' ,CUSTOM_T9='".addslashes($qualite)."' ,CUSTOM_T1='".addslashes($notes)."', STATUS = 'COU' WHERE RES_ID=".$s_id); if($_POST['finish']=="redirect") { $_SESSION['chosen_doc'] = array(); array_push($_SESSION['chosen_doc'],$s_id); header("location:red_doc_popup_process.php?process=true"); exit(); } if($_SESSION['history']['resup'] == "true") { $users = new history(); $users->add($table, $s_id,"UP", _N_PROCESS_LETTER.$s_id." (".$_SESSION['courrier']['type_id'].")"); sleep(1); } if($_POST['finish'] == "cloture") { $conn->query( "UPDATE ".$table." SET STATUS = 'END', CUSTOM_D3 = now() WHERE RES_ID = ".$s_id); if($_SESSION['history']['resup'] == "true") { $hist = new history(); $hist->add($table, $s_id,"UP", _MAIL_PROCESS_END_NUM.$s_id." (".$_SESSION['courrier']['type_id'].")"); } $db = new dbquery(); $db->connect(); $conn->query("select SOURCE, TITLE, FILESIZE, PATH, DOCSERVER_ID, FILENAME, RES_ID from ".$table." where RELATION = ".$s_id); while($res = $conn->fetch_object()) { $docserver = $res->DOCSERVER_ID; $path = $res->PATH; $filename = $res->FILENAME; $filesize = $res->FILESIZE; $title = $res->TITLE; $res_id = $res->RES_ID; $source = $res->SOURCE; $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); if ($_SESSION['config']['system'] == "true") { $file = str_replace("#","/",$file); } else { $file = str_replace("#","\\",$file); } if($source == 'Editor') { $myfile = fopen($file, "r"); if(!$myfile) { $_SESSION['error'] .= _FILE_OPEN_ERROR.'.
'; header("location: process_frame?id=".$s_id); exit; } $data = fread($myfile, $filesize+1); fclose($myfile); $data = stripslashes($data); $header = ' '.$title.' '; $footer = ' '; $oldfile = fopen($file, 'w'); if(!$oldfile) { $_SESSION['error'] .= _FILE_OPEN_ERROR.'.
'; header("location: process_frame?id=".$_SESSION['courrier']['res_id']); exit; } $data = str_replace('query("update ".$table." set FILESIZE = ".$filesize.", FORMAT = 'HTML', FINGERPRINT = '".$md5."', FILENAME = '".$newfilename."', SOURCE = 'Local File' where RES_ID = ".$res_id); } elseif($source == 'Local File') { $md5 = md5($file); $db->query(" Update ".$table." set FINGERPRINT = '".$md5."'"); } } } else if($_POST['finish'] == 'redirect_courrier') { $conn->query( "UPDATE ".$table." SET STATUS = 'VAL' WHERE RES_ID = ".$s_id); if($_SESSION['history']['resup'] == "true") { $hist = new history(); $hist->add($table, $s_id,"RED", _LETTER_N.$s_id." (".$s_id.")"._REDIRECTED_TO_GENERAL." (".$_SESSION['courrier']['type_id'].")"); } } ?>