*/ require("test_page.php"); require("class_search.php"); include("session.php"); if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } else { $_SESSION['error'] = "Language file missing...
"; } $func = new functions(); $the_search = new search(); $fields = ""; $orderby = ""; $copies = ""; $_SESSION['copies'] = "false"; // define the row of the start if(isset($_GET['start'])) { $start = $_GET['start']; } else { $start = 0; } $where_request = ""; $_SESSION['s_services_chosen']=array(); $s_societe= ""; $_SESSION['societe_search']=""; $s_multifield= ""; $_SESSION['multifield_search']=""; $priority= 0; $_SESSION['s_priority_chosen']=""; $s_numcourrier = ""; $_SESSION['numcourrier'] = ""; $s_doc_notes = ""; $_SESSION['doc_notes'] = ""; $s_process_notes = ""; $_SESSION['process_notes'] = ""; $s_numged = ""; $_SESSION['numged'] = ""; $s_gid_id = ""; $_SESSION['search_gid_id'] = ""; //$s_destinataire = ""; //$_SESSION['destinataire'] = ""; $_SESSION['s_destinataire_chosen'] = array(); $s_objet = ""; $_SESSION['objet'] = ""; $_SESSION['s_doctypes_chosen'] = array(); $destinataire_chosen_tmp = ''; $_SESSION['civilities_chosen'] = array(); $_SESSION['civ_chosen'] = array(); $doctypes_chosen_tmp = ''; $s_invoice_type = ""; $_SESSION['invoice_type'] = $s_invoice_type; $_SESSION['enr_from']=""; $_SESSION['enr_to']=""; $_SESSION['trait_from']=""; $_SESSION['trait_to']=""; $s_quartier = ""; $_SESSION['quartier'] = $s_quartier; $adr_quartier = ""; $_SESSION['adr_quartier'] = $adr_quartier; $s_num = ""; $_SESSION['num'] = $s_num; $s_rue = ""; $_SESSION['rue'] = $s_rue; $s_Cp = ""; $_SESSION['Cp'] = $s_Cp; $s_ville = ""; $_SESSION['ville'] = $s_ville; $s_arrondissement = ""; $_SESSION['arrondissement'] = $s_arrondissement; $s_canton = ""; $_SESSION['canton'] = $s_canton; $s_epci = ""; $_SESSION['epci'] = $s_epci; $s_epci_type = ""; $_SESSION['epci_type'] = $s_epci_type; $s_commune = ""; $_SESSION['commune'] = $s_commune; $_SESSION['adr_num'] = $adr_num; $adr_num = ""; $_SESSION['adr_rue'] = $adr_rue; $adr_rue = ""; $_SESSION['adr_cp'] = $adr_cp; $adr_cp = ""; $_SESSION['adr_ville'] = $adr_ville; $adr_ville = ""; $_SESSION['adr_arrondissement'] = $adr_arrondissement; $adr_arrondissement = ""; $_SESSION['adr_canton'] = $adr_canton; $adr_canton = ""; $_SESSION['adr_epci'] = $adr_epci; $adr_epci = ""; $adr_commune = ""; $_SESSION['adr_commune'] = $adr_commune; $_SESSION['s_status_chosen'] = array(); $s_to = ''; $_SESSION['to'] = $s_to; $s_object = ''; $_SESSION['object'] = $s_object; $s_message = ''; $_SESSION['message'] = $s_message; $s_courrier = ""; $_SESSION['courrier_search'] = $s_courrier; $s_ar = ""; $_SESSION['AR'] = $s_ar; $s_fax = ""; $_SESSION['fax'] = $s_fax; $s_autre = ""; $_SESSION['autre'] = $s_autre; $s_direct = ""; $_SESSION['direct'] = $s_direct; $s_norep = ""; $s_simple_mail = ''; $_SESSION['simple_mail'] = $s_simple_mail; $_SESSION['norep'] = $s_norep; $s_is_ingoing = ""; $_SESSION['is_ingoing'] = $s_is_ingoing; $s_shipper = ""; $_SESSION['search_shipper'] = $s_shipper; $s_sender = ""; $_SESSION['search_shipper'] = $s_sender; $copies = "false"; $_SESSION['copies'] = "false"; $courriel = "false"; $_SESSION['courriel'] = "false"; $response = "false"; $_SESSION['response'] = "false"; $_SESSION['meta_search'] = array(); $lim_date_from = ''; $_SESSION['lim_date_from'] = ''; $lim_date_to = ''; $_SESSION['lim_date_to'] = ''; $_SESSION['sender_firstname'] = ''; $_SESSION['shipper_firstname'] = ''; $_SESSION['sender_lastname'] = ''; $_SESSION['shipper_lastname'] = ''; $_SESSION['sender_society'] = ''; $_SESSION['shipper_society'] = ''; $sender_firstname = ''; $sender_lastname = ''; $sender_society = ''; $shipper_firstname = ''; $shipper_lastname = ''; $shipper_society = ''; $_SESSION['shipper_function'] = ''; $shipper_function = ''; $_SESSION['sender_function'] = ''; $sender_function = ''; $_SESSION['date_start_to'] = ''; $_SESSION['date_start_from'] = ''; $date_start_to = ''; $date_start_from = ''; $_SESSION['doc_date_to'] = ''; $_SESSION['doc_date_from'] = ''; $doc_date_to = ''; $doc_date_from = ''; $_SESSION['s_coll'] = ''; $json_txt = '{'; if(count($_REQUEST['meta']) > 0) { $_SESSION['meta_search'] = $_REQUEST['meta']; for($i=0; $iwash($_GET['societe'],"no",_SOCIETY,"no"); $_SESSION['societe_search']= stripslashes(trim($_GET['societe'])); $where_request .= "r.SOCIETE LIKE '%".$_SESSION['societe_search']."%' "; $where_request .=" and "; $json_txt .= "'societe' : ['".trim($_GET['societe'])."'],"; } else if($tab_id_fields[$j] == 'multifield' && !empty($_REQUEST['multifield'])) { $json_txt .= "'multifield' : ['".trim($_GET['multifield'])."'],"; $s_multifield = $func->wash($_GET['multifield'],"no",_MULTI_FIELD,"no"); $_SESSION['multifield_search']= stripslashes(trim($_GET['multifield'])); // ATTENTION : !!!! $where_request .= " (r.CUSTOM_T9 LIKE '%".trim($_GET['multifield'])."%' or r.SOCIETE LIKE '%".trim($_GET['multifield'])."%' or r.CUSTOM_T4 LIKE '%".trim($_GET['multifield'])."%' or r.AUTHOR LIKE '%".trim($_GET['multifield'])."%' or r.DESCRIPTION LIKE '%".trim($_GET['multifield'])."%' or r.IDENTIFIER LIKE '%".trim($_GET['multifield'])."%' or r.TITLE LIKE '%".trim($_GET['multifield'])."%' or r.CUSTOM_T1 LIKE '%".trim($_GET['multifield'])."%') "; //ATTENTION : !!!! //VERIFIER QUE LA REQUETE MULTIFIELD SOIT ENTOURE DE PARENTHESE, SINON TOUS LES DOCUMENTS SONT ACCESSIBLES DANS LA BASE, PEUT CREER UN BUG DE SECURITE IMPORTANT $where_request .=" and "; } else if($tab_id_fields[$j] == 'priority_chosen' && isset($_REQUEST['priority_chosen'])) { $json_txt .= " 'priority_chosen' : ["; $_SESSION['s_priority_chosen'] = $_REQUEST['priority_chosen']; $where_request .=" r.PRIORITY IN ( "; for ($get_i = 0; $get_i wash($_GET['numcourrier'], "no", _MAIL_IDENTIFIER,"no"); $_SESSION['numcourrier'] = stripslashes($s_numcourrier); $where_request .= "r.IDENTIFIER LIKE '%".$s_numcourrier."%' and "; } else if($tab_id_fields[$j] == 'process_notes' && !empty($_REQUEST['process_notes'])) { $json_txt .= " 'process_notes' : ['".trim($_GET['process_notes'])."'],"; $s_process_notes = $func->wash($_GET['process_notes'], "no", _PROCESS_NOTES,"no"); $_SESSION['process_notes'] = stripslashes($s_process_notes); $where_request .= "r.CUSTOM_T1 LIKE '%".$s_process_notes."%' and "; } else if($tab_id_fields[$j] == 'doc_notes' && !empty($_REQUEST['doc_notes'])) { $json_txt .= " 'doc_notes' : ['".trim($_GET['doc_notes'])."'],"; $s_doc_notes = $func->wash($_GET['doc_notes'], "no", _NOTES,"no"); $_SESSION['doc_notes'] = stripslashes($s_process_notes); $where_request .= "r.res_id in(select record_id from ".$_SESSION['tablename']['notes']." where info LIKE '%".$s_doc_notes."%') and "; } else if($tab_id_fields[$j] == 'numged' && !empty($_REQUEST['numged'])) { $json_txt .= " 'numged' : ['".trim($_GET['numged'])."'],"; $s_numged = $func->wash($_GET['numged'], "num", _N_GED,"no"); $_SESSION['numged'] = stripslashes($s_numged); $where_request .= "r.RES_ID = ".$s_numged." and "; } else if($tab_id_fields[$j] == 'gid_id' && !empty($_REQUEST['gid_id'])) { $json_txt .= " 'gid_id' : ['".trim($_GET['gid_id'])."'],"; $s_gid_id = $_GET['gid_id']; $_SESSION['search_gid_id'] = stripslashes($s_gid_id); $where_request .= "r.GID_ID LIKE '%".$s_gid_id."%' and "; } else if($tab_id_fields[$j] == 'destinataire_chosen' && !empty($_REQUEST['destinataire_chosen'])) { $json_txt .= " 'destinataire_chosen' : ["; $_SESSION['s_destinataire_chosen'] = $_GET['destinataire_chosen']; $destinataire_chosen_tmp = " ("; for ($get_i = 0; $get_i wash($_GET['destinataire'], "no", _RECIPIENT , "no"); $_SESSION['destinataire'] = $s_destinataire; $where_request .= "r.DEST_USER LIKE '%".$s_destinataire."%' and ";*/ } else if($tab_id_fields[$j] == 'objet' && !empty($_REQUEST['objet'])) { $json_txt .= " 'objet' : ['".trim($_GET['objet'])."'],"; $_SESSION['objet'] = stripslashes(trim($_GET['objet'])); //$where_request .= "r.DESCRIPTION LIKE '%".$_SESSION['objet']."%' or r.CUSTOM_T1 LIKE '%".$_SESSION['multifield_search']."%' and "; $where_request .= "r.DESCRIPTION LIKE '%".addslashes($_SESSION['objet'])."%' and "; } //FULLTEXT START else if($tab_id_fields[$j] == 'fulltext' && !empty($_REQUEST['fulltext'])) { $json_txt .= " 'fulltext' : ['".addslashes(trim($_REQUEST['fulltext']))."'],"; set_include_path("full_text".PATH_SEPARATOR.get_include_path()); require_once('full_text/Zend/Search/Lucene.php'); $path_to_lucene_index = $_SESSION['config']['path_to_lucene_index']; if(is_dir($path_to_lucene_index)) { if(!$func->isDirEmpty($path_to_lucene_index)) { $index = Zend_Search_Lucene::open($path_to_lucene_index); $hits = $index->find($_REQUEST['fulltext']); $Liste_Ids = "0"; foreach ($hits as $hit) { $Liste_Ids .= ", '". $hit->Id ."'"; } $where_request .= " res_id IN ($Liste_Ids) and "; } } else { $where_request .= " 1=-1 and "; } } //FULLTEXT END else if($tab_id_fields[$j] == 'doctypes_chosen' && !empty($_REQUEST['doctypes_chosen'])) { $json_txt .= " 'doctypes_chosen' : ["; $_SESSION['s_doctypes_chosen'] = $_GET['doctypes_chosen']; $doctypes_chosen_tmp = " ("; for ($get_i = 0; $get_i wash($_GET['invoice_type'], "no", _INVOICE_TYPE,"no"); $_SESSION['invoice_type'] = stripslashes(trim($s_invoice_type)); $where_request .= "r.CUSTOM_T2 = '".$s_invoice_type."' and "; } else if($tab_id_fields[$j] == 'enr_from' && !empty($_REQUEST['enr_from'])) { $tmp = $func->inverse_date($_GET['enr_from']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp)==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_GET['enr_from']; } else { $enr_from = ""; $enr_from = str_replace('-','',$tmp); $_SESSION['enr_from'] = $_GET['enr_from'] ; $where_request .= " (r.CREATION_DATE >= ".$enr_from."000000) and "; $json_txt .= " 'enr_from' : ['".trim($_GET['enr_from'])."'],"; } } else if($tab_id_fields[$j] == 'enr_to' && !empty($_REQUEST['enr_to'])) { $tmp = $func->inverse_date($_GET['enr_to']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp )==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_GET['enr_to']; } else { $enr_to = ""; //$tmp = $func->add_days_in_date($tmp,1); $enr_to = str_replace('-','',$tmp); $_SESSION['enr_to'] = $_GET['enr_to']; $where_request .= " (r.CREATION_DATE <= ".$enr_to."235999) and "; $json_txt .= " 'enr_to' : ['".trim($_GET['enr_to'])."'],"; } } else if($tab_id_fields[$j] == 'trait_from' && !empty($_REQUEST['trait_from'])) { $tmp = $func->inverse_date($_GET['trait_from']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp)==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_GET['trait_from']; } else { $trait_from = ""; $trait_from = str_replace('-','',$tmp); $_SESSION['trait_from'] = $_GET['trait_from']; $where_request .= " (r.CUSTOM_D3 >= ".$trait_from."000000) and "; $json_txt .= "'trait_from' : ['".trim($_GET['trait_from'])."'],"; } } else if($tab_id_fields[$j] == 'trait_to' && !empty($_REQUEST['trait_to'])) { $tmp = $func->inverse_date($_GET['trait_to']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp)==false ) { $_SESSION['error'] = _WRONG_DATE_FORMAT.' : '.$_GET['trait_to']; } else { $trait_to = ""; //$tmp = $func->add_days_in_date($tmp,1); $trait_to = str_replace('-','',$tmp); $_SESSION['trait_to'] = $_GET['trait_to']; $where_request .= " (r.CUSTOM_D3 <= ".$trait_to."235999) and "; $json_txt .= "'trait_to' : ['".trim($_GET['trait_to'])."'],"; } } else if($tab_id_fields[$j] == 'lim_date_from' && !empty($_REQUEST['lim_date_from'])) { $tmp = $func->inverse_date($_GET['lim_date_from']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp)==false ) { $_SESSION['error'] = _WRONG_DATE_FORMAT.' : '.$_GET['lim_date_from']; } else { $lim_date_from = ""; //$tmp = $func->add_days_in_date($tmp,1); $lim_date_from = str_replace('-','',$tmp); $_SESSION['lim_date_from'] = $_GET['lim_date_from']; $where_request .= " (r.CUSTOM_D2 >= ".$lim_date_from."000000) and "; $json_txt .= "'lim_date_from' : ['".trim($_GET['lim_date_from'])."'],"; } } else if($tab_id_fields[$j] == 'lim_date_to' && !empty($_REQUEST['lim_date_to'])) { $tmp = $func->inverse_date($_GET['lim_date_to']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp)==false ) { $_SESSION['error'] = _WRONG_DATE_FORMAT.' : '.$_GET['lim_date_to']; } else { $lim_date_to = ""; //$tmp = $func->add_days_in_date($tmp,1); $lim_date_to = str_replace('-','',$tmp); $_SESSION['lim_date_to'] = $_GET['lim_date_to']; $where_request .= " (r.CUSTOM_D2 <= ".$lim_date_to."235999) and "; $json_txt .= "'lim_date_to' : ['".trim($_GET['lim_date_to'])."'],"; } } else if($tab_id_fields[$j] == 'quartier' && !empty($_REQUEST['quartier'])) { //$s_quartier = $func->wash($_GET['quartier'], "no", _THE_DISTRICT,"no"); $_SESSION['quartier'] = stripslashes(trim($_GET['quartier'])); $where_request .= "r.CUSTOM_T14 like '".trim($_GET['quartier'])."%' and "; $json_txt .= "'quartier' : ['".trim($_GET['quartier'])."'],"; } else if($tab_id_fields[$j] == 'adr_quartier' && !empty($_REQUEST['adr_quartier'])) { //$s_quartier = $func->wash($_GET['quartier'], "no", _THE_DISTRICT,"no"); $_SESSION['adr_quartier'] = stripslashes(trim($_GET['adr_quartier'])); $where_request .= "r.CUSTOM_T14 like '".trim($_GET['adr_quartier'])."%' and "; $json_txt .= "'adr_quartier' : ['".trim($_GET['adr_quartier'])."'],"; } else if($tab_id_fields[$j] == 'num' && !empty($_REQUEST['num'])) { //$s_num = $func->wash($_GET['num'], "no", _THE_ROAD_NUM,"no"); $_SESSION['num'] = stripslashes(trim($s_num)); $where_request .= "r.CUSTOM_T10 like '".trim($s_num)."%' and "; $json_txt .= " 'num' : ['".trim($_GET['num'])."'],"; } else if($tab_id_fields[$j] == 'rue' && !empty($_REQUEST['rue'])) { //$s_rue = $func->wash($_GET['rue'], "no",_THE_ROAD,"no"); $_SESSION['rue'] = stripslashes(trim($s_rue)); $where_request .= "r.CUSTOM_T11 like '".$s_rue."%' and "; $json_txt .= " 'rue' : ['".trim($_GET['rue'])."'],"; } else if($tab_id_fields[$j] == 'Cp' && !empty($_REQUEST['Cp'])) { if(preg_match('/^[0-9][0-9][0-9][0-9][0-9]$/',$_GET['Cp'])) { $_SESSION['Cp'] = $s_Cp; $where_request .= "r.CUSTOM_T13 = '".$s_Cp."' and "; $json_txt .= " 'Cp' : ['".$_GET['Cp']."'],"; } else { $_SESSION['error'] .= _WRONG_CP.".
"; } } else if($tab_id_fields[$j] == 'ville' && !empty($_REQUEST['ville'])) { //$s_ville = $func->wash($_GET['ville'], "no", _THE_CITY,"no"); $_SESSION['ville'] = stripslashes(trim($s_ville)); $where_request .= "r.CUSTOM_T12 like '".$s_ville."%' and "; $json_txt .= " 'ville' : ['".addslashes(trim($_GET['ville']))."'],"; } else if($tab_id_fields[$j] == 'commune' && !empty($_REQUEST['commune'])) { $s_commune = $_GET['commune'] ; $_SESSION['commune'] = stripslashes(trim($s_commune)); $where_request .= "r.CUSTOM_T12 like '".$s_commune."%' and "; $json_txt .= " 'commune' : ['".trim($_GET['commune'])."'],"; } else if($tab_id_fields[$j] == 'arrondissement' && !empty($_REQUEST['arrondissement'])) { $_SESSION['arrondissement'] = stripslashes(trim($s_arrondissement)); $where_request .= "r.CUSTOM_T18 like '".$s_arrondissement."%' and "; $json_txt .= " 'arrondissement' : ['".trim($_GET['arrondissement'])."'],"; } else if($tab_id_fields[$j] == 'canton' && !empty($_REQUEST['canton'])) { $_SESSION['canton'] = stripslashes(trim($s_canton)); $where_request .= "r.CUSTOM_T19 like '".$s_canton."%' and "; $json_txt .= " 'canton' : ['".trim($_GET['canton'])."'],"; } else if($tab_id_fields[$j] == 'epci' && !empty($_REQUEST['epci'])) { $_SESSION['epci'] = stripslashes(trim($s_epci)); $where_request .= "r.CUSTOM_T20 like '".$s_epci."%' and "; $json_txt .= " 'epci' : ['".trim($_GET['epci'])."'],"; } else if($tab_id_fields[$j] == 'epci_type' && !empty($_REQUEST['epci_type'])) { $_SESSION['epci_type'] = stripslashes(trim($s_epci_type)); $where_request .= "r.CUSTOM_T21 like '".$s_epci_type."%' and "; $json_txt .= " 'epci_type' : ['".trim($_GET['epci_type'])."'],"; } else if($tab_id_fields[$j] == 'to' && !empty($_REQUEST['to'])) { $_SESSION['to'] = stripslashes(trim($_REQUEST['to'])); $where_request .= "(r.CUSTOM_T1 like '%".trim($_REQUEST['to'])."%' OR r.CUSTOM_T2 like '%".trim($_REQUEST['to'])."%' OR r.CUSTOM_T3 like '%".trim($_REQUEST['to'])."%') and "; $json_txt .= " 'to' : ['".trim($_REQUEST['to'])."'],"; } else if($tab_id_fields[$j] == 'object' && !empty($_REQUEST['object'])) { $_SESSION['object'] = stripslashes(trim($_REQUEST['object'])); $where_request .= "r.TITLE like '%".trim($_REQUEST['object'])."%' and "; $json_txt .= " 'object' : ['".trim($_REQUEST['object'])."'],"; } else if($tab_id_fields[$j] == 'message' && !empty($_REQUEST['message'])) { $_SESSION['message'] = stripslashes(trim($_REQUEST['message'])); $where_request .= "r.DESCRIPTION like '%".trim($_REQUEST['message'])."%' and "; $json_txt .= " 'message' : ['".trim($_REQUEST['message'])."'],"; } else if($tab_id_fields[$j] == 'status_chosen' && isset($_REQUEST['status_chosen'])) { $json_txt .= " 'status_chosen' : ["; $_SESSION['s_status_chosen'] = $_REQUEST['status_chosen']; $where_request .="( "; for ($get_i = 0; $get_i "OUT") { $where_request .= " (r.STATUS = '".$_GET['status_chosen'][$get_i]."' and r.STATUS <> 'OUT') or "; } } } } $where_request = preg_replace("/or $/", "", $where_request); $json_txt = substr($json_txt, 0, -1); $where_request .=") and "; $json_txt .= '],'; } else if($tab_id_fields[$j] == 'courrier' && !empty($_REQUEST['courrier'])) { $s_courrier = ($_GET['courrier']); $_SESSION['courrier_search'] = stripslashes($s_courrier); $where_request .= "r.CUSTOM_T5 <> 'false' AND r.CUSTOM_T5 <> '' AND "; $json_txt .= "'courrier' : ['".trim($_GET['courrier'])."'],"; } else if($tab_id_fields[$j] == 'AR' && !empty($_REQUEST['AR'])) { $s_ar = ($_GET['AR']); $_SESSION['AR'] = stripslashes($s_ar); $where_request .= "r.CUSTOM_T15 <> 'false' AND r.CUSTOM_T15 <> '' AND "; $json_txt .= " 'AR' : ['".trim($_GET['AR'])."'],"; } else if($tab_id_fields[$j] == 'fax' && !empty($_REQUEST['fax'])) { $s_fax = ($_GET['fax']); $_SESSION['fax'] = stripslashes($s_fax); $where_request .= "r.CUSTOM_T16 <> 'false' AND r.CUSTOM_T16 <> '' AND "; $json_txt .= " 'fax' : ['".trim($_GET['fax'])."'],"; } else if($tab_id_fields[$j] == 'courriel' && !empty($_REQUEST['courriel'])) { $s_courriel = ($_GET['courriel']); $_SESSION['courriel'] = stripslashes($s_courriel); $where_request .= "r.CUSTOM_T7 <> 'false' AND r.CUSTOM_T7 <> '' AND "; $json_txt .= " 'courriel' : ['".trim($_GET['courriel'])."'],"; } else if($tab_id_fields[$j] == 'autre' && !empty($_REQUEST['autre'])) { $s_autre = ($_GET['autre']); $_SESSION['autre'] = stripslashes($s_autre); $where_request .= "r.CUSTOM_T8 <> 'false' AND r.CUSTOM_T8 <> '' AND "; $json_txt .= " 'autre' : ['".trim($_GET['autre'])."'],"; } else if($tab_id_fields[$j] == 'direct' && !empty($_REQUEST['direct'])) { $s_direct = ($_GET['direct']); $_SESSION['direct'] = stripslashes($s_direct); $where_request .= "r.CUSTOM_T6 <> 'false' AND r.CUSTOM_T6 <> '' AND "; $json_txt .= " 'direct' : ['".trim($_GET['direct'])."'],"; } else if($tab_id_fields[$j] == 'simple_mail' && !empty($_REQUEST['simple_mail'])) { $s_simple_mail = ($_GET['simple_mail']); $_SESSION['simple_mail'] = stripslashes($s_simple_mail); $where_request .= "r.CUSTOM_T5 <> 'false' AND r.CUSTOM_T5 <> '' AND "; $json_txt .= " 'simple_mail' : ['".trim($_GET['simple_mail'])."'],"; } else if($tab_id_fields[$j] == 'norep' && !empty($_REQUEST['norep'])) { $s_norep = ($_GET['norep']); $_SESSION['norep'] = stripslashes($s_norep); $where_request .= "r.CUSTOM_T17 <> 'false' AND r.CUSTOM_T17 <> '' AND "; $json_txt .= " 'norep' : ['".trim($_GET['norep'])."'],"; } else if($tab_id_fields[$j] == 'is_ingoing' && !empty($_REQUEST['is_ingoing']) && ($_REQUEST['is_ingoing'] == "in" || $_REQUEST['is_ingoing'] == "out" )) { $s_is_ingoing = ($_GET['is_ingoing']); $_SESSION['is_ingoing'] = stripslashes($s_is_ingoing); if($_REQUEST['is_ingoing'] == "in" ) { $where_request .= "r.IS_INGOING = 'Y' AND "; $json_txt .= "'is_ingoing' : ['in'],"; } elseif($_REQUEST['is_ingoing'] == "out") { $where_request .= "r.IS_INGOING = 'N' AND "; $json_txt .= "'is_ingoing' : ['out'],"; } } else if($tab_id_fields[$j] == 'copies_true' && $_REQUEST['copies'] == "true" ) { $copies = ($_GET['copies']); $_SESSION['copies'] = $copies; $json_txt .= " 'copies_true' : ['true'],"; unset($_SESSION['courriel_search']); //echo 'dans les mails en COPIE'; die; } else if( $tab_id_fields[$j] == 'copies_false' && $_REQUEST['copies'] == "false" ) { $copies = "false"; $_SESSION['copies'] = "false"; $json_txt .= "'copies_false' : ['false'],"; unset($_SESSION['courriel_search']); //echo 'PAS dans les mails en COPIE'; die; } else if( $tab_id_fields[$j] == 'response_true' && $_REQUEST['copies'] == "response") { $response = "true"; $_SESSION['response'] = $response; $json_txt .= " 'response_true' : ['true'],"; } else if( $tab_id_fields[$j] == 'mail_true' && ($_REQUEST['copies'] == "mail" || $_REQUEST['courriel_search'] == "true" )) { $courriel = "true"; $_SESSION['courriel_search'] = "true"; $json_txt .= "'mail_true' : ['true'],"; //echo 'DANS les courriels'; die; } else if($tab_id_fields[$j] == 'select_shipper' && !empty($_REQUEST['select_shipper'])) { $s_shipper = $func->wash($func->show($_GET['select_shipper']), "no", _SHIPPER,"no"); $_SESSION['search_shipper'] = stripslashes($s_shipper); if ($_GET['select_shipper'] <> 'SHOW_DATA') { $where_request .= " r.AUTHOR LIKE CONCAT('%',(SELECT LASTNAME FROM ".$_SESSION['tablename']['senders']." WHERE ID =".trim($s_shipper)."),'%') "; $where_request .=" and IS_INGOING = 'Y' and "; } $json_txt .= " 'select_shipper' : ['".trim($_GET['select_shipper'])."'],"; } else if($tab_id_fields[$j] == 'shipper_lastname' && !empty($_REQUEST['shipper_lastname'])) { $shipper_lastname = $func->wash($func->show($_GET['shipper_lastname']), "no", _SHIPPER,"no"); $_SESSION['shipper_lastname'] = stripslashes($shipper_lastname); $where_request .= "r.AUTHOR LIKE '%".$shipper_lastname."%' "; $where_request .=" and "; $json_txt .= " 'shipper_lastname' : ['".trim($_GET['shipper_lastname'])."'],"; } else if($tab_id_fields[$j] == 'shipper_firstname' && !empty($_REQUEST['shipper_firstname'])) { $shipper_firstname = $func->wash($func->show($_GET['shipper_firstname']), "no", _SHIPPER,"no"); $_SESSION['shipper_firstname'] = stripslashes($shipper_firstname); $where_request .= "r.CUSTOM_T4 LIKE '%".trim($_GET['shipper_firstname'])."%' "; $where_request .=" and "; $json_txt .= " 'shipper_firstname' : ['".trim($_GET['shipper_firstname'])."'],"; } else if($tab_id_fields[$j] == 'shipper_society' && !empty($_REQUEST['shipper_society'])) { $shipper_society = $func->wash($func->show($_GET['shipper_society']), "no", _SHIPPER,"no"); $_SESSION['shipper_society'] = stripslashes($shipper_society); $where_request .= "r.SOCIETE LIKE '%".trim($_GET['shipper_society'])."%' "; $where_request .=" and "; $json_txt .= " 'shipper_society' : ['".trim($_GET['shipper_society'])."'],"; } else if($tab_id_fields[$j] == 'shipper_civility' && !empty($_REQUEST['shipper_civility'])) { $shipper_civility = $func->wash($func->show($_GET['shipper_civility']), "no", _SHIPPER,"no"); $_SESSION['shipper_civility'] = stripslashes($shipper_civility); $where_request .= "r.CUSTOM_T3 LIKE '%".$shipper_civility."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'shipper_civility' : ['".trim($_GET['shipper_civility'])."'],"; } else if($tab_id_fields[$j] == 'shipper_function' && !empty($_REQUEST['shipper_function'])) { $shipper_function = $func->wash($func->show($_GET['shipper_function']), "no", _SHIPPER,"no"); $_SESSION['shipper_function'] = stripslashes($shipper_function); $where_request .= "r.CUSTOM_T9 LIKE '%".trim($_GET['shipper_function'])."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'shipper_function' : ['".trim($_GET['shipper_function'])."'],"; } else if($tab_id_fields[$j] == 'shipper_road_num' && !empty($_REQUEST['shipper_road_num'])) { $shipper_road_num = $func->wash($func->show($_GET['shipper_road_num']), "no", _SHIPPER,"no"); $_SESSION['shipper_road_num'] = stripslashes($shipper_road_num); $where_request .= "r.CUSTOM_T10 LIKE '%".trim($shipper_road_num)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'shipper_road_num' : ['".trim($_GET['shipper_road_num'])."'],"; } else if($tab_id_fields[$j] == 'adr_num' && !empty($_REQUEST['adr_num'])) { $adr_num = $func->wash($func->show($_GET['adr_num']), "no", _ADRESS,"no"); $_SESSION['adr_num'] = stripslashes($adr_num); $where_request .= "r.CUSTOM_T10 LIKE '%".trim($adr_num)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'adr_num' : ['".trim($_GET['adr_num'])."'],"; } else if($tab_id_fields[$j] == 'adr_rue' && !empty($_REQUEST['adr_rue'])) { $adr_rue = $func->wash($func->show($_GET['adr_rue']), "no", _STREET,"no"); $_SESSION['adr_rue'] = stripslashes($adr_rue); $where_request .= "r.CUSTOM_T11 LIKE '%".trim($adr_rue)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'adr_rue' : ['".trim($_GET['adr_rue'])."'],"; } else if($tab_id_fields[$j] == 'adr_cp' && !empty($_REQUEST['adr_cp'])) { $adr_cp = $func->wash($func->show($_GET['adr_cp']), "no", _POSTAL_CODE,"no"); $_SESSION['adr_cp'] = stripslashes($adr_cp); $where_request .= "r.CUSTOM_T13 LIKE '%".trim($adr_cp)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'adr_cp' : ['".trim($_GET['adr_cp'])."'],"; } else if($tab_id_fields[$j] == 'adr_commune' && !empty($_REQUEST['adr_commune'])) { $adr_commune = $func->wash($func->show($_GET['adr_commune']), "no", _TOWN,"no"); $_SESSION['adr_commune'] = stripslashes($adr_commune); $where_request .= "r.CUSTOM_T12 LIKE '%".trim($adr_commune)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'adr_commune' : ['".trim($_GET['adr_commune'])."'],"; } else if($tab_id_fields[$j] == 'adr_arrondissement' && !empty($_REQUEST['adr_arrondissement'])) { $adr_arrondissement = $func->wash($func->show($_GET['adr_arrondissement']), "no", _BOROUGH,"no"); $_SESSION['adr_arrondissement'] = stripslashes($adr_arrondissement); $where_request .= "r.CUSTOM_T18 LIKE '%".trim($adr_arrondissement)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'adr_arrondissement' : ['".trim($_GET['adr_arrondissement'])."'],"; } else if(trim($tab_id_fields[$j]) == 'adr_canton' && !empty($_REQUEST['adr_canton'])) { $adr_canton = $func->wash($func->show($_GET['adr_canton']), "no", _CANTON,"no"); $_SESSION['adr_canton'] = stripslashes($adr_canton); $where_request .= "r.CUSTOM_T19 LIKE '%".trim($adr_canton)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'adr_canton' : ['".trim($_GET['adr_canton'])."'],"; } else if(trim($tab_id_fields[$j]) == 'adr_epci' && !empty($_REQUEST['adr_epci'])) { $adr_epci = $func->wash($func->show($_GET['adr_epci']), "no", _EPCI,"no"); $_SESSION['adr_epci'] = stripslashes($adr_epci); $where_request .= "r.CUSTOM_T20 LIKE '%".trim($adr_epci)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'adr_epci' : ['".trim($_GET['adr_epci'])."'],"; } else if($tab_id_fields[$j] == 'shipper_cp' && !empty($_REQUEST['shipper_cp'])) { $shipper_cp = $func->wash($func->show($_GET['shipper_cp']), "no", _SHIPPER,"no"); $_SESSION['shipper_cp'] = stripslashes($shipper_cp); $where_request .= "r.CUSTOM_T13 LIKE '%".trim($shipper_cp)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'shipper_road_num' : ['".trim($_GET['shipper_cp'])."'],"; } else if($tab_id_fields[$j] == 'shipper_street' && !empty($_REQUEST['shipper_street'])) { $shipper_street = $func->wash($func->show($_GET['shipper_street']), "no", _SHIPPER,"no"); $_SESSION['shipper_street'] = stripslashes($shipper_street); $where_request .= "r.CUSTOM_T11 LIKE '%".trim($shipper_street)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'shipper_street' : ['".trim($_GET['shipper_street'])."'],"; } else if($tab_id_fields[$j] == 'shipper_town' && !empty($_REQUEST['shipper_town'])) { $shipper_town = $func->wash($func->show($_GET['shipper_town']), "no", _SHIPPER,"no"); $_SESSION['shipper_town'] = stripslashes($shipper_street); $where_request .= "r.CUSTOM_T12 LIKE '%".trim($shipper_town)."%' "; $where_request .=" and IS_INGOING = 'Y' and "; $json_txt .= " 'shipper_town' : ['".trim($_GET['shipper_town'])."'],"; } else if($tab_id_fields[$j] == 'select_sender' && !empty($_REQUEST['select_sender'])) { $s_sender = $func->wash($func->show($_GET['select_sender']), "no", _SENDER,"no"); $_SESSION['search_sender'] = stripslashes($s_sender); if( $_GET['select_sender'] <> 'SHOW_DATA') { if( is_numeric($_SESSION['search_sender']) ) { $where_request .= " r.AUTHOR LIKE CONCAT('%',(SELECT LASTNAME FROM ".$_SESSION['tablename']['senders']." WHERE ID =".trim($s_sender)."),'%') "; } else { $where_request .= "( r.SENDER_ID = 0 OR r.SENDER_ID IS NULL ) AND r.AUTHOR = '".trim($s_sender)."'"; } $where_request .=" and IS_INGOING = 'N' and "; } $json_txt .= " 'select_sender' : ['".trim($_GET['select_sender'])."'],"; } else if($tab_id_fields[$j] == 'sender_lastname' && !empty($_REQUEST['sender_lastname'])) { $sender_lastname = $func->wash($func->show($_GET['sender_lastname']), "no", _sender,"no"); $_SESSION['sender_lastname'] = stripslashes($sender_lastname); $where_request .= "r.AUTHOR LIKE '%".trim($sender_lastname)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_lastname' : ['".trim($_GET['sender_lastname'])."'],"; } else if($tab_id_fields[$j] == 'sender_firstname' && !empty($_REQUEST['sender_firstname'])) { $sender_firstname = $func->wash($func->show($_GET['sender_firstname']), "no", _sender,"no"); $_SESSION['sender_firstname'] = stripslashes($sender_firstname); $where_request .= "r.CUSTOM_T4 LIKE '%".trim($sender_firstname)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_firstname' : ['".trim($_GET['sender_firstname'])."'],"; } else if($tab_id_fields[$j] == 'sender_society' && !empty($_REQUEST['sender_society'])) { $sender_society = $func->wash($func->show($_GET['sender_society']), "no", _sender,"no"); $_SESSION['sender_society'] = stripslashes($sender_society); $where_request .= "r.SOCIETE LIKE '%".trim($sender_society)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_society' : ['".trim($_GET['sender_society'])."'],"; } else if($tab_id_fields[$j] == 'sender_civility' && !empty($_REQUEST['sender_civility'])) { $sender_civility = $func->wash($func->show($_GET['sender_civility']), "no", _sender,"no"); $_SESSION['sender_civility'] = stripslashes($sender_civility); $where_request .= "r.CUSTOM_T3 LIKE '%".trim($sender_civility)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_civility' : ['".trim($_GET['sender_civility'])."'],"; } else if($tab_id_fields[$j] == 'sender_function' && !empty($_REQUEST['sender_function'])) { $sender_function = $func->wash($func->show($_GET['sender_function']), "no", _sender,"no"); $_SESSION['sender_function'] = stripslashes($sender_function); $where_request .= "r.CUSTOM_T9 LIKE '%".trim(sender_function)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_function' : ['".trim($_GET['sender_function'])."'],"; } else if($tab_id_fields[$j] == 'sender_road_num' && !empty($_REQUEST['sender_road_num'])) { $sender_road_num = $func->wash($func->show($_GET['sender_road_num']), "no", _sender,"no"); $_SESSION['sender_road_num'] = stripslashes($sender_road_num); $where_request .= "r.CUSTOM_T10 LIKE '%".trim($sender_road_num)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_road_num' : ['".trim($_GET['sender_road_num'])."'],"; } else if($tab_id_fields[$j] == 'sender_cp' && !empty($_REQUEST['sender_cp'])) { $sender_cp = $func->wash($func->show($_GET['sender_cp']), "no", _sender,"no"); $_SESSION['sender_cp'] = stripslashes($sender_cp); $where_request .= "r.CUSTOM_T13 LIKE '%".trim($sender_cp)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_road_num' : ['".trim($_GET['sender_cp'])."'],"; } else if($tab_id_fields[$j] == 'sender_street' && !empty($_REQUEST['sender_street'])) { $sender_street = $func->wash($func->show($_GET['sender_street']), "no", _sender,"no"); $_SESSION['sender_street'] = stripslashes($sender_street); $where_request .= "r.CUSTOM_T11 LIKE '%".trim($sender_street)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_street' : ['".trim($_GET['sender_street'])."'],"; } else if($tab_id_fields[$j] == 'sender_town' && !empty($_REQUEST['sender_town'])) { $sender_town = $func->wash($func->show($_GET['sender_town']), "no", _sender,"no"); $_SESSION['sender_town'] = stripslashes($sender_street); $where_request .= "r.CUSTOM_T12 LIKE '%".trim($sender_town)."%' "; $where_request .=" and IS_INGOING = 'N' and "; $json_txt .= " 'sender_town' : ['".trim($_GET['sender_town'])."'],"; } else if($tab_id_fields[$j] == 'civilities_chosen' && !empty($_REQUEST['civilities_chosen'])) { $json_txt .= " 'civilities_chosen' : ["; $_SESSION['civilities_chosen'] = $_GET['civilities_chosen']; $civilities_chosen_tmp = " ("; for ($get_i = 0; $get_i inverse_date($_GET['date_start_from']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp)==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_GET['date_start_from']; } else { $date_start_from = ""; $date_start_from = str_replace('-','',$tmp); $_SESSION['date_start_from'] = $_GET['date_start_from'] ; $where_request .= " (r.CUSTOM_D1 >= ".$date_start_from."000000) and "; $json_txt .= " 'date_start_from' : ['".trim($_GET['date_start_from'])."'],"; } } else if($tab_id_fields[$j] == 'date_start_to' && !empty($_REQUEST['date_start_to'])) { $tmp = $func->inverse_date($_GET['date_start_to']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp )==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_GET['date_start_to']; } else { $date_start_to = ""; //$tmp = $func->add_days_in_date($tmp,1); $date_start_to = str_replace('-','',$tmp); $_SESSION['date_start_to'] = $_GET['date_start_to']; $where_request .= " (r.CUSTOM_D1 <= ".$date_start_to."235999) and "; $json_txt .= " 'date_start_to' : ['".trim($_GET['date_start_to'])."'],"; } } else if($tab_id_fields[$j] == 'doc_date_from' && !empty($_REQUEST['doc_date_from'])) { $tmp = $func->inverse_date($_GET['doc_date_from']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp)==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_GET['doc_date_from']; } else { $doc_date_from = ""; $doc_date_from = str_replace('-','',$tmp); $_SESSION['doc_date_from'] = $_GET['doc_date_from'] ; $where_request .= " (r.DOC_DATE >= ".$doc_date_from.") and "; $json_txt .= " 'doc_date_from' : ['".trim($_GET['doc_date_from'])."'],"; } } else if($tab_id_fields[$j] == 'doc_date_to' && !empty($_REQUEST['doc_date_to'])) { $tmp = $func->inverse_date($_GET['doc_date_to']); if( preg_match("/^[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$/",$tmp )==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$_GET['doc_date_to']; } else { $doc_date_to = ""; //$tmp = $func->add_days_in_date($tmp,1); $doc_date_to = str_replace('-','',$tmp); $_SESSION['doc_date_to'] = $_GET['doc_date_to']; $where_request .= " (r.DOC_DATE <= ".$doc_date_to.") and "; $json_txt .= " 'doc_date_to' : ['".trim($_GET['doc_date_to'])."'],"; } } else if($tab_id_fields[$j] == 'coll_chosen' && !empty($_REQUEST['coll_chosen'])) { if ($_SESSION['config']['collectivities'] == "true") { include_once($_SESSION['config']['includedir']."/addon_collectivities.php"); $tmp = build_search_criteria_entities($json_txt, $where_request); $where_request = $tmp[1]; $json_txt = $tmp[0]; } } } $json_txt = preg_replace('/,$/', '', $json_txt); $json_txt .= "}},"; } $json_txt = preg_replace('/,$/', '', $json_txt); } $json_txt = preg_replace("/,$/", "", $json_txt); $json_txt .= '}'; //echo "
".$json_txt."
"; require("load_extensions.php"); if ($_SESSION['tablechoice'] == "") { $_SESSION['tablechoice'] = $_SESSION['ressources'][0]['tablename']; } $_SESSION['current_search_query'] = $json_txt; if(!empty($_SESSION['error'])) { $func->echo_error(_ADV_SEARCH_TITLE, "
"._MUST_CORRECT_ERRORS." :

".$_SESSION['error']."
"._CLICK_HERE_TO_CORRECT."
"); } else {?> connect(); $orderby = $the_search->define_order(); $nb_total = 0; if($courriel == "true") { //SQL REQUEST $sql_query = " SELECT r.RES_ID, r.TITLE, r.DESCRIPTION, date(r.CUSTOM_D1), r.FORMAT, r.AUTHOR, r.RIGHTS, r.DEST_USER, r.STATUS, r.TYPE_ID, r.DESTINATION, r.PRIORITY, r.SOCIETE, date(r.CREATION_DATE) AS CREATION_DATE, r.IS_INGOING, r.CUSTOM_T1, r.CUSTOM_T2, r.CUSTOM_T3, r.CUSTOM_T4, r.RELATION FROM ".$_SESSION['tablechoice']." r WHERE ".$where_request." r.status = 'MEL' AND r.AUTHOR = '".$_SESSION['user']['UserId']."' ".$orderby; $limit_query = " LIMIT ".$start.",".$_SESSION['config']['nblinetoshow']; //COUNT TOTAL $connexion->query("SELECT COUNT(*) AS CPT FROM (".$sql_query.") temp"); if( $db_query = $connexion->fetch_object() ) $nb_total = $db_query->CPT; $connexion->query( $sql_query.$limit_query ); $_SESSION['print_list']['current_request'] = "select r.RES_ID, DESCRIPTION, AUTHOR, TITLE, TYPE_ID, date(r.CREATION_DATE) AS CREATION_DATE, CUSTOM_T1, CUSTOM_T2, CUSTOM_T3, CUSTOM_T4 from ".$_SESSION['tablechoice']." r where ".$where_request." r.status = 'MEL' and r.AUTHOR = '".$_SESSION['user']['UserId']."' ".$orderby; $_SESSION['export_where_request'] = $where_request." r.status = 'MEL' and r.AUTHOR = '".$_SESSION['user']['UserId']."' "; } //Recherche sur les rĂ©ponses added by sna elseif($response == "true") { //SQL REQUEST $sql_query = " SELECT r.RES_ID, r.TITLE, r.DESCRIPTION, date(r.CUSTOM_D1), r.FORMAT, r.AUTHOR, r.RIGHTS, r.DEST_USER, r.STATUS, r.TYPE_ID, r.DESTINATION, r.PRIORITY, r.SOCIETE, date(r.CREATION_DATE) AS CREATION_DATE, r.IS_INGOING, r.CUSTOM_T1, r.CUSTOM_T2, r.CUSTOM_T3, r.CUSTOM_T4, r.RELATION FROM ".$_SESSION['tablechoice']." r WHERE ".$where_request." r.STATUS = 'REP' ".$orderby; $limit_query = " LIMIT ".$start.",".$_SESSION['config']['nblinetoshow']; //COUNT TOTAL $connexion->query("SELECT COUNT(*) AS CPT FROM (".$sql_query.") temp"); if( $db_query = $connexion->fetch_object() ) $nb_total = $db_query->CPT; $connexion->query( $sql_query.$limit_query ); $_SESSION['print_list']['current_request'] = "select r.RES_ID, DESCRIPTION, AUTHOR, TITLE, TYPE_ID, date(r.CREATION_DATE) AS CREATION_DATE, CUSTOM_T1, CUSTOM_T2, CUSTOM_T3, CUSTOM_T4, RELATION from ".$_SESSION['tablechoice']." r where ".$where_request." r.status = 'REP' and r.AUTHOR = '".$_SESSION['user']['UserId']."' ".$orderby; $_SESSION['export_where_request'] = $where_request." r.status = 'REP'"; } // Fin recherche sur les rĂ©ponses elseif($copies == "true") { if($where_request <> "") { $where_request = " and ".$where_request; } $where_request = trim($where_request); $where_request = preg_replace('/(and|AND)$/', '', $where_request); $sql_query = " SELECT ".$fields." FROM ".$_SESSION['tablechoice']." r, ".$_SESSION['tablename']['listinstance']." l WHERE l.res_table = '".$_SESSION['tablechoice']."' AND l.user_id = '".$_SESSION['user']['UserId']."' AND l.res_id = r.res_id AND l.sequence > 1 AND r.status <> 'DEL' AND r.status <> 'REP' AND status <> 'RSV' AND status <> 'ATT' AND status <> 'VAL' AND r.status <> 'MEL' AND IS_FOLDER = 'Y' ". $where_request." GROUP BY r.RES_ID ". $orderby; $limit_query = " LIMIT ".$start.",".$_SESSION['config']['nblinetoshow']; //COUNT TOTAL $connexion->query("SELECT COUNT(*) AS CPT FROM (".$sql_query.") temp"); if( $db_query = $connexion->fetch_object() ) $nb_total = $db_query->CPT; $connexion->query( $sql_query.$limit_query ); $_SESSION['print_list']['current_request'] = "select r.RES_ID, DESCRIPTION, AUTHOR, DEST_USER, TYPE_ID, date(CREATION_DATE), SOCIETE from ".$_SESSION['tablechoice']." r, ".$_SESSION['tablename']['listinstance']." l where l.res_table = '".$_SESSION['tablechoice']."' and l.user_id = '".$_SESSION['user']['UserId']."' and l.res_id = r.res_id and l.sequence > 1 and r.status <> 'DEL' and r.status <> 'REP' and status <> 'VAL' and status <> 'RSV' and status <> 'ATT' and r.status <> 'MEL' and IS_FOLDER = 'Y' ".$where_request." GROUP BY r.RES_ID ".$orderby; $_SESSION['export_where_request'] = " l.res_table = '".$_SESSION['tablechoice']."' and l.user_id = '".$_SESSION['user']['UserId']."' and l.res_id = r.res_id and l.sequence > 1 and r.status <> 'DEL' and r.status <> 'REP' and r.status <> 'VAL' and r.status <> 'RSV' and r.status <> 'ATT' and IS_FOLDER = 'Y' ".$where_request; } else { $sql_query =" SELECT ".$fields." FROM ".$_SESSION['tablechoice']." r WHERE ".$where_request." ".$where2." AND r.status <> 'DEL' AND r.status <> 'REP' AND status <> 'VAL' AND status <> 'RSV' AND status <> 'ATT' AND r.IS_FOLDER = 'Y' ". $orderby; $limit_query = " LIMIT ".$start.",".$_SESSION['config']['nblinetoshow']; //COUNT TOTAL $connexion->query("SELECT COUNT(*) AS CPT FROM (".$sql_query.") temp"); if( $db_query = $connexion->fetch_object() ) $nb_total = $db_query->CPT; $connexion->query( $sql_query.$limit_query ); $connexion->query("select ".$fields." from ".$_SESSION['tablechoice']." r where ".$where_request." ".$where2." and r.status <> 'DEL' and r.status <> 'REP' and status <> 'VAL' and status <> 'RSV' and status <> 'ATT' and r.IS_FOLDER = 'Y' ".$orderby." limit ".$start.",".$_SESSION['config']['nblinetoshow']); $_SESSION['print_list']['current_request'] = "select RES_ID, DESCRIPTION, AUTHOR, DEST_USER, TYPE_ID, date(CREATION_DATE), SOCIETE from ".$_SESSION['tablechoice']." r where ".$where_request." ".$where2." and r.status <> 'DEL' and r.status <> 'REP' and r.status <> 'VAL' and r.status <> 'RSV' and r.status <> 'ATT' and r.status <> 'MEL' and r.IS_FOLDER = 'Y' ".$orderby; $_SESSION['export_where_request'] = $where_request." ".$where2." and r.status <> 'DEL' and r.status <> 'REP' and r.status <> 'VAL' and r.status <> 'RSV' and r.status <> 'ATT' and r.status <> 'MEL' and r.IS_FOLDER = 'Y' "; } $label_nb_total = $nb_total; if($nb_total > $_SESSION['config']['search_max_size'] ) { $nb_total = $_SESSION['config']['search_max_size'] ; $label_nb_total = '> à '.$_SESSION['config']['search_max_size'] ; } if($nb_total > 0) { $tab=array(); $val=array(); $i=0; if($courriel == "true"){ while ($value = $connexion->fetch_object()) { $val[$i]=array( "RES_ID" => $value->RES_ID, "RELATION" => $value->RELATION, "TITLE" => $value->TITLE, "DESCRIPTION" => $value->DESCRIPTION, "CUSTOM_D1" => $value->CUSTOM_D1, "FORMAT" => '', "AUTHOR" => $value->AUTHOR, "DEST_USER" => $value->CUSTOM_T1, "STATUS" => $value->STATUS, "LIB_TYPE" => '', "DESTINATION" => '', "PRIORITY" => '', "SOCIETE" => '', "CREATION_DATE" => $value->CREATION_DATE, "IS_INGOING" => $value->TITLE); if($_SESSION['config']['gdi_index'] == "true") { $val[$i]['GID_ID'] = $value[15]; } array_push($tab,$val[$i]); $i++; } } elseif($response == "true") { while ($value = $connexion->fetch_array()) { $val[$i]=array("RES_ID" => $value[0],"TITLE" => $value[1],"DESCRIPTION" => $value[2],"CUSTOM_D1" => $value[3],"FORMAT" => $value[4],"AUTHOR" => $value[5],"DEST_USER" => $value[7],"STATUS" => $value[8], "LIB_TYPE" => $value[9], "DESTINATION" => $value[10], "PRIORITY" => $value[11] , "SOCIETE" => $value[12], "CREATION_DATE" => $value[13], "IS_INGOING" => $value[14], "RELATION" => $value[19]); if($_SESSION['config']['gdi_index'] == "true") { $val[$i]['GID_ID'] = $value[15]; } array_push($tab,$val[$i]); $i++; } } else{ while ($value = $connexion->fetch_array()) { $val[$i]=array("RES_ID" => $value[0],"TITLE" => $value[1],"DESCRIPTION" => $value[2],"CUSTOM_D1" => $value[3],"FORMAT" => $value[4],"AUTHOR" => $value[5],"DEST_USER" => $value[7],"STATUS" => $value[8], "LIB_TYPE" => $value[9], "DESTINATION" => $value[10], "PRIORITY" => $value[11] , "SOCIETE" => $value[12], "CREATION_DATE" => $value[13], "IS_INGOING" => $value[14]); if($_SESSION['config']['gdi_index'] == "true") { $val[$i]['GID_ID'] = $value[15]; } array_push($tab,$val[$i]); $i++; } } $table =""; for($i=0; $i < count($_SESSION['ressources']); $i++) { if($_SESSION['tablechoice'] == $_SESSION['ressources'][$i]['tablename']) { $table = $_SESSION['ressources'][$i]['comment']; break; } } $title = _SEARCH_RESULTS ; if($nb_total > 1) { $title .= " (".$label_nb_total." "._DOCUMENTS.")"; } if($courriel == "true"){ $the_search->list_doc3($tab,$nb_total,$title,$s_search,"search_adv_result"); } else{ $the_search->list_doc($tab,$nb_total,$title,$s_search,"search_adv_result"); } } else { $func->echo_error(_ADV_SEARCH_TITLE,'


'._NO_RESULTS.'

'); } } ?>