* @author Loic Vinet */ require("test_page.php"); require_once("class_functions.php"); require_once("class_db.php"); require_once("class_security.php"); require_once("class_letterbox.php"); $func = new functions(); $connexion = new dbquery(); $sec = new security(); $connexion->connect(); if(($_SESSION['origin'] == "file" || $_SESSION['origin'] == "scan") && isset($_SESSION['indexation_id']) && !empty($_SESSION['indexation_id'])) { $s_id = $_SESSION['indexation_id']; $_SESSION['indexation_id'] = ""; } else { $s_id = addslashes($func->wash($_GET['id'], "num", _THE_DOC)); } $table =""; if(isset($_SESSION['tablechoice']) && !empty($_SESSION['tablechoice'])) { $table = $_SESSION['tablechoice']; } else { $table = $_SESSION['ressources'][0]['tablename']; } if($_SESSION['origin'] <> "basket" ) { $right = $sec->test_right_doc($table, $s_id); } else { $right = true; } if(!$right) { ?> query("UPDATE ".$table." SET STATUS = 'DEL' WHERE RES_ID = ".$s_id); /*if($_SESSION['history']['resup'] ) { require_once("class_history.php"); $hist = new history(); $hist->add('res_x', $s_id, "DEL",_DELETED_DOC); }*/ if($_SESSION['history']['resdel'] == "true") { require_once("class_history.php"); $hist = new history(); $hist->add('res_x', $s_id, "DEL", _DOC_DELETED.$s_id); } ?> show_array($_POST); //$connexion->show_array($_SESSION['courrier']); //exit(); $connexion->query("select IDENTIFIER, CREATION_DATE, CUSTOM_T3, AUTHOR, CUSTOM_T4, CUSTOM_D2 from ".$table." where RES_ID = ".$s_id); $res = $connexion->fetch_object(); $ref = $res->IDENTIFIER; $date_crea = $res->CREATION_DATE; $emetteur = stripslashes($res->CUSTOM_T3)." ".stripslashes($res->AUTHOR)." ".stripslashes($res->CUSTOM_T4); $date_lim = $res->CUSTOM_D2; $query = ""; if($_SESSION['config']['gdi_index'] == "true") { if($_POST['gid_id'] <> '') { $query .= " GID_ID = '".$_POST['gid_id']."' ,"; } else { $_SESSION['error'] .= _GID_ID_MISSING.".
"; } } if(isset($_POST['emetteur']) && !empty($_POST['emetteur'])) { $query .= " AUTHOR = '".$_POST['emetteur']."' ,"; } else { $_SESSION['error'] .= _SHIPPER_FORGOTTEN."
"; } if($_SESSION['config']['corporate'] == "true") { if(isset($_POST['societe']) ) { $query .= " SOCIETE= '".$_POST['societe']."' ,"; } else { $_SESSION['error'] .= _SOCIETY_FORGOTTEN."
"; } } if(isset($_POST['service']) && !empty($_POST['service'])) { $query .= " DESTINATION = '".$_POST['service']."' ,"; } elseif(isset($_SESSION['courrier']['service']) && !empty($_SESSION['courrier']['service'])) { $query .= " DESTINATION = '".$_SESSION['courrier']['service']."' ,"; } else { $_SESSION['error'] .= _DEPARTMENT_FORGOTTEN."
"; } if(isset($_POST['type_list']) && !empty($_POST['type_list'])) { $query .= " TYPE_ID = '".$_POST['type_list']."' ,"; } else { $_SESSION['error'] .= _TYPE_FORGOTTEN."
"; } if(isset($_POST['nature']) && !empty($_POST['nature'])) { $query .= " CUSTOM_T2 = '".$_POST['nature']."' ,"; } else { $_SESSION['error'] .= _INVOICE_TYPE_FORGOTTEN."
"; } if(isset($_POST['objet']) && !empty($_POST['objet'])) { $query .= " DESCRIPTION = '".$_POST['objet']."' ,"; } if( isset($_POST['priority']) ) { $query .= " PRIORITY = '".$_POST['priority']."' ,"; } if(isset($_POST['date_doc_date']) && !empty($_POST['date_doc_date'])) { $tmp = $func->inverse_date($_POST['date_doc_date']); $tmp = str_replace(' ', '', $tmp); if( ereg("[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]",$_POST['date_doc_date'])==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_POST['date_doc_date']; } else { $query .= " DOC_DATE = '".$tmp."' , "; } } if(isset($_POST['date_shipping_date']) && !empty($_POST['date_shipping_date'])) { $tmp = $func->inverse_date($_POST['date_shipping_date']); $tmp = str_replace(' ', '', $tmp); if( ereg("[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]",$_POST['date_shipping_date'])==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_POST['date_shipping_date']; } else { if ($_POST['hidden_out']) { $query .= " CREATION_DATE = '".$tmp."' , "; } else { $query .= " CUSTOM_D1 = '".$tmp."' , "; } } } if(isset($_POST['date_limit_date']) && !empty($_POST['date_limit_date'])) { $tmp = $func->inverse_date($_POST['date_limit_date']); $tmp = str_replace(' ', '', $tmp); if( ereg("[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]",$_POST['date_limit_date'])==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_POST['date_limit_date']; } else { $query .= " CUSTOM_D2 = '".$tmp."' , "; // With this update, we need to change date in CUSTOM_D4 and CUSTOM_D5 by types // First, we need restore value of this doctypes, no need to doctypes?? $update_db_types = new dbquery(); $update_db_types -> connect(); $update_db_types -> query("SELECT DATEDIFF('".$tmp."',CUSTOM_D2) as HOW_LONG from ".$_SESSION['ressources'][0]['tablename']." WHERE RES_ID = '".$s_id."'; "); //$update_db_types -> show(); $result_interval = $update_db_types->fetch_object(); $pos = strpos($result_interval->HOW_LONG, "-"); if ($pos === false) { $negative = false; } else { $negative = true; } if ($negative == true) { $my_interval_value = str_replace('-', '',$result_interval->HOW_LONG); $query .= "CUSTOM_D4 = (CUSTOM_D4 - INTERVAL ".$my_interval_value." DAY) , "; $query .= "CUSTOM_D5 = (CUSTOM_D5 - INTERVAL ".$my_interval_value." DAY) , "; } else { $my_interval_value = $result_interval->HOW_LONG; $query .= "CUSTOM_D4 = (CUSTOM_D4 + INTERVAL ".$my_interval_value." DAY) , "; $query .= "CUSTOM_D5 = (CUSTOM_D5 + INTERVAL ".$my_interval_value." DAY) , "; } } } if(count($_SESSION['diff']) < 1) { $_SESSION['error'] .= _DEST_FORGOTTEN."
"; } else { $query .= " DEST_USER = '".$_SESSION['diff'][0]['UserID']."' ,"; if(empty($_SESSION['error'])) { //Prepare Mailing if( $_SESSION['is_diff']) { if($_SESSION['config']['enablechangenotif'] == "true") { $mail_trait = "
"._MAIL_TO_PROCESS.".

"._HELLO.",
"._NEED_PROCESS_LETTER." :


"; $mail_copie = "
"._MAIL_IN_COPY."

"._HELLO.",
"._YOU_HAVE_MAIL_COPY." :


\n\n"; } } //BEGIN : CREATE LISTINSTANCE //Store the old viewed and by_user_id values $mem_by_user_id = array(); $mem_viewed = array(); for($j=1;$j < (count($_SESSION['diff']) + 1); $j++) { $connexion->query("SELECT USER_ID, BY_USER_ID, VIEWED FROM ".$_SESSION['tablename']['listinstance']." WHERE res_id = ".$s_id." and user_id = '".$_SESSION['diff'][$j-1]['UserID']."'"); if($result = $connexion->fetch_object()) { $mem_viewed[$result->USER_ID] = $result->VIEWED; $mem_by_user_id[$result->USER_ID] = $result->BY_USER_ID; } } //Delete listInstance $connexion->query("DELETE from ".$_SESSION['tablename']['listinstance']." where res_id = ".$s_id); //Insert into listinstance the new mailing list with the values of viewed and by_user_id saved before for($j=1; $j < ( count($_SESSION['diff']) + 1 ); $j++ ) { $viewed = 0; $by_user_id = $_SESSION['user']['UserId']; if( isset($mem_viewed[$_SESSION['diff'][$j-1]['UserID']] ) ) { $viewed = $mem_viewed[$_SESSION['diff'][$j-1]['UserID']]; $by_user_id = $mem_by_user_id[$_SESSION['diff'][$j-1]['UserID']]; } $connexion->query("INSERT INTO ".$_SESSION['tablename']['listinstance']." ( RES_TABLE, RES_ID, SEQUENCE, USER_ID, VIEWED, BY_USER_ID ) VALUES ('res_x',".$s_id.",".$j.",'".$_SESSION['diff'][$j-1]['UserID']."',".$viewed.",'".$by_user_id."')"); if($_SESSION['config']['enablechangenotif'] == "true") { $connexion->query("select MAIL from ".$_SESSION['tablename']['users']." where USER_ID = '".$_SESSION['diff'][$j-1]['UserID']."'"); $res = $connexion->fetch_object(); $mail = $res->MAIL; if($_SESSION['is_diff'] && ($j-1) == 0) { mail($mail, _PROCESS_MAIL, $mail_trait , "From: ".$_SESSION['config']['adminmail']."\nReply-To: ".$_SESSION['config']['adminmail']." \nContent-Type: text/html; charset=\"iso-8859-1\"\n"); } elseif($_SESSION['is_diff'] && ($j-1) > 0) { mail($mail, _FIRST_WARNING_TXT, $mail_copie , "From: ".$_SESSION['config']['adminmail']."\nReply-To: ".$_SESSION['config']['adminmail']." \nContent-Type: text/html; charset=\"iso-8859-1\"\n"); } } } //END : CREATE LISTINSTANCE $connexion->query("UPDATE ".$table." SET FLAG_NOTIF = 'N' WHERE RES_ID = '".$s_id."' AND (STATUS ='COU' OR STATUS = 'NEW') "); $_SESSION['diff'] = array(); } } if(empty($_SESSION['error'])) { $query = trim($query); $query = ereg_replace(",$", "", $query); $connexion->query("UPDATE ".$table." set ".$query." where RES_ID = ".$s_id); $connexion->query("update ".$table." set destination = '".$_POST['service']."' where is_folder = 'N' and folder_id = '".$s_id."'"); if($_SESSION['history']['resup'] ) { require_once("class_history.php"); $hist = new history(); $hist->add($table, $s_id, "UP",_MODIF_MAIL_INDEX.$s_id); } } } $_SESSION['detail_id'] =$s_id; if(empty($_SESSION['error']) || $_SESSION['indexation']) { $connexion->query("SELECT TITLE, DESCRIPTION, TYPE_ID, FORMAT, TYPIST, date(CREATION_DATE) as CREATION_DATE, DOC_DATE, FINGERPRINT, IDENTIFIER, CUSTOM_T1 as DEPARTMENT, AUTHOR, FILESIZE, STATUS, CUSTOM_D1, date(CUSTOM_D2) as CUSTOM_D2, VALIDATION_DATE, AUTHOR, AUTHOR_NAME, DEST_USER, DESTINATION, CUSTOM_T2, CUSTOM_T5, CUSTOM_T6, CUSTOM_T7, CUSTOM_T8, CUSTOM_D3, CUSTOM_T1, CUSTOM_T15, CUSTOM_T16, CUSTOM_T17, IS_INGOING, PRIORITY, SOCIETE, GID_ID, COLL_ID FROM ".$table." where RES_ID = ".$s_id); } ?>

< ( "._SHOW_MAIL_FOLDER." "; ?>)








nb_result() == 0) { ?>



.


test_reserved_time($s_id, $table); if( $by_user_id == $_SESSION['user']['UserId'] || $by_user_id == null) $locked = true; $details = $connexion->fetch_object(); $title = stripslashes($details->TITLE); $description = stripslashes($details->DESCRIPTION); $format = $details->FORMAT; $filesize = $details->FILESIZE; $creation_date = $details->CREATION_DATE; $doc_date = $details->DOC_DATE; $fingerprint = $details->FINGERPRINT; $ref = $details->IDENTIFIER; $_SESSION['courrier']['reference'] = $ref; $tmp = ""; $type = $details->TYPE_ID; $_SESSION['courrier']['type_courrier'] = $type; $status= $details-> STATUS; $datearrivee= $details -> CUSTOM_D1; $validation_date= $details -> VALIDATION_DATE; $datelimitetraitement=$details -> CUSTOM_D2; $author = stripslashes($details->AUTHOR); $author_name = $details->AUTHOR_NAME; $dest_user = $details->DEST_USER; $destination = $details->DESTINATION; $coll = $details->COLL_ID; $_SESSION['courrier']['service'] = $destination; $nature_envoi = $details -> CUSTOM_T2; $courrier = $details -> CUSTOM_T5; $direct = $details -> CUSTOM_T6; $mail = $details -> CUSTOM_T7; $courrierAR = $details -> CUSTOM_T15; $fax = $details -> CUSTOM_T16; $norep = $details -> CUSTOM_T17; $autre = $details -> CUSTOM_T8; $date_traitement = $details->CUSTOM_D3; $notes = $details->CUSTOM_T1; $typist = $details->TYPIST; $is_ingoing = $details->IS_INGOING; $priority = $details->PRIORITY; $societe = $details->SOCIETE; $gid_id = $details->GID_ID; $out = false; if($is_ingoing == 'N' || $status == 'OUT') { $out = true; $connexion->query('select LASTNAME, FIRSTNAME from '.$_SESSION['tablename']['users'].' where USER_ID = "'.$author.'"'); if ($connexion->nb_result()>0) { $res = $connexion->fetch_object(); $author = $res->FIRSTNAME.' '.$res->LASTNAME; } } $connexion->query("select LASTNAME, FIRSTNAME, STATUS, ENABLED from ".$_SESSION['tablename']['users']." where USER_ID = '".$typist."'"); $res = $connexion->fetch_object(); if($typist <> "AUTOIMPORT") { $typist = $res->FIRSTNAME.' '.$res->LASTNAME; } if($res->STATUS == 'OK') { if($res->ENABLED == 'N') { $typist .= ' ('._NOT_ENABLED.')'; } } else { if($typist <> "AUTOIMPORT") { $typist .= ' ('._DELETED.')'; } } $connexion->query("select date(CREATION_DATE) as CREATION_DATE, RES_ID, TITLE FROM res_x WHERE STATUS='REP' AND RELATION=".$s_id." order by CREATION_DATE desc"); $rep = array(); while($line = $connexion->fetch_object()) { array_push($rep, array("ID" => $line->RES_ID, "DATE" => $connexion->inverse_date($line->CREATION_DATE), 'TITLE' => $line->TITLE)); } $connexion->query("select SERVICE FROM ".$_SESSION['tablename']['services']." WHERE ID ='".$destination."' "); $res = $connexion->fetch_object(); $service = $res->SERVICE; $copies = array(); $connexion->query("select u.USER_ID as ID, u.FIRSTNAME as FIRST_NAME, u.LASTNAME as LAST_NAME from ".$_SESSION['tablename']['listinstance']." l, ".$_SESSION['tablename']['users']." u where l.RES_TABLE = 'res_x' and l.RES_ID = ".$s_id." and l.SEQUENCE > 1 and u.USER_ID = l.USER_ID"); while ($res = $connexion->fetch_object()) { array_push($copies, array( 'ID' => $res->ID, 'FIRST_NAME' => $res->FIRST_NAME, 'LAST_NAME'=> $res->LAST_NAME)); } if($_SESSION['user']['modif_rights'] && $status <> "END") { //$connexion->query("select * from ".$_SESSION['tablename']['services']." where ENABLED = 'Y' order by SERVICE"); $services = $_SESSION['user']['services']; $modif_services = array(); for($i=0; $i < count($services);$i++) { array_push($modif_services, array('ID' => $services[$i]['ID'], 'LABEL' => $services[$i]['LABEL'])); } //while($res = $connexion->fetch_object()) //{ // array_push($modif_services, array('ID' => $res->ID, 'LABEL' => $res->SERVICE)); //} $types_list = array(); $connexion->query("select TYPE_ID, DESCRIPTION from ".$_SESSION['tablename']['doctypes']." where ENABLED = 'Y' order by description"); $types_list = array(); while($res = $connexion->fetch_object()) { array_push($types_list, array('ID' => $res->TYPE_ID, 'LABEL' => $res->DESCRIPTION)); } } else { $dest = ""; $connexion->query("select FIRSTNAME, LASTNAME from ".$_SESSION['tablename']['users']." where USER_ID = '".$dest_user."'"); $res = $connexion->fetch_object(); $dest = $res->FIRSTNAME." ".$res->LASTNAME; } if(!empty($type)) { $connexion->query("select DESCRIPTION, RES_TABLE from ".$_SESSION['tablename']['doctypes']." where TYPE_ID = '".$type."'"); $line_sql = $connexion->fetch_object(); $type = $line_sql->DESCRIPTION; $tmp = $line_sql->RES_TABLE; for($i=0; $i < count($_SESSION['ressources']); $i++) { if($_SESSION['ressources'][$i]['tablename'] == $tmp) { $table = $_SESSION['ressources'][$i]['comment']; break; } } } ?>

:

'._GID_ID.' : '; echo ''; } else { echo ''; echo '
: "END") { ?>
: "END") { ?>   '; if($_SESSION['user']['modif_rights'] && $status <> "END") { echo ''; } else { echo ''; } echo ' '; } ?>
: "END") { ?>   : "END") { ?>
: "END") { ?>   : " />
<?php echo addslashes(_CALENDAR); ?>   : <?php echo addslashes(_CALENDAR); ?>
:   : NULL ) { ?> <?php echo addslashes(_CALENDAR); ?>
: "END") { ?>   : "END") { if ($_SESSION['config']['redirect_list'] == 'true') { ?>
:   :

:

:

:

 

:

'#courrier#' && $status <> 'DEL' && $status <> 'END') { if($_SESSION['config']['private_notes'] == "true") { $windowSize = '500, 700'; } else{ $windowSize = '500, 250'; } ?>

 


false && $courrier <>'false') { $types_rep .= _MAIL2.', '; } if($courrierAR <> false && $courrierAR <>'false') { $types_rep .= _AR_MAIL.', '; } if($direct <> false && $direct <>'false') { $types_rep .= _DIRECT_CONTACT.', '; } if($mail <> false && $mail <> 'false') { $types_rep .= _MAIL.', '; } if($fax <> false && $fax <>'false') { $types_rep .= _FAX.', '; } if($noresp <> false && $norep <>'false') { $types_rep .= _NO_ANSWER_NECESSARY.', '; } if($autre <> false && $autre <>'false') { $types_rep .= " ".$autre."".', '; } $types_rep = ereg_replace(', $', '', $types_rep); ?>


0) { echo "
    "; for($i=0; $i < count($rep); $i++) { ?>
  •   
  • "; } else { echo ""._ACTUALLY_NO_ANSWER.""; } ?>

 

:

:   :
:   : " />
:   :

:

"DEL" )) { ?> ?\n'));"/>