0 ) { unset($_SESSION['new_exp']); unset($_SESSION['exp_id']); $emet_id = 0; $_SESSION['courrier']['emetteur'] = "dest"; $_REQUEST['nom'] = $_SESSION['new_emet']['LASTNAME']; $_REQUEST['prenom'] = $_SESSION['new_emet']['FIRSTNAME']; $_REQUEST['civilite'] = $_SESSION['new_emet']['CIVILITY']; //fonction en mode corporate $_SESSION['courrier']['emetteur_societe'] = $_SESSION['new_emet']['SOCIETY']; $_REQUEST['societe'] = $_SESSION['new_emet']['SOCIETY']; $_REQUEST['FUNCTION'] = $_SESSION['new_emet']['FUNCTION']; //CUSTOM_T9 $_REQUEST['STREET_NUM'] = $_SESSION['new_emet']['STREET_NUM']; //CUSTOM_T10 $_REQUEST['STREET'] = $_SESSION['new_emet']['STREET']; //CUSTOM_T11 $_REQUEST['TOWN'] = $_SESSION['new_emet']['TOWN']; //CUSTOM_T12 $_REQUEST['CP'] = $_SESSION['new_emet']['CP']; //CUSTOM_T13 } //2)L'emetteur existe et a été selectionné else if( isset($_SESSION['emet_id']) ) { unset($_SESSION['new_exp']); unset($_SESSION['exp_id']); $emet = new dbquery(); $emet->connect(); $emet->query("SELECT CIVILITY, LASTNAME, FIRSTNAME, SOCIETY, FUNCTION, STREET_NUM, STREET, TOWN, CP FROM ".$_SESSION['tablename']['senders']." WHERE TOCONTACT IS NULL AND ID = ".$_SESSION['emet_id']); $emet_id = $_SESSION['emet_id']; if( $res = $emet->fetch_object() ) { if( $_SESSION['config']['corporate'] == "true" && !($_SESSION['config']['borough'] == "true") ) { $_SESSION['courrier']['emetteur'] = stripslashes($res->LASTNAME); $_REQUEST['nom'] = stripslashes($res->LASTNAME); $_REQUEST['civilite'] = stripslashes($res->FUNCTION); //Civilite = function in corporate mode $_SESSION['courrier']['emetteur_societe'] = stripslashes($res->SOCIETY); $_REQUEST['societe'] = stripslashes($res->SOCIETY); $_REQUEST['prenom'] = stripslashes($res->FIRSTNAME); } else { $_SESSION['courrier']['emetteur'] = stripslashes($res->LASTNAME); $_REQUEST['nom'] = stripslashes($res->LASTNAME); $_REQUEST['civilite'] = stripslashes($res->CIVILITY); $_SESSION['courrier']['emetteur_societe'] = stripslashes($res->SOCIETY); $_REQUEST['societe'] = stripslashes($res->SOCIETY); $_REQUEST['prenom'] = stripslashes($res->FIRSTNAME); $_REQUEST['FUNCTION'] = stripslashes($res->FUNCTION); //CUSTOM_T9 $_REQUEST['STREET_NUM'] = stripslashes($res->STREET_NUM); //CUSTOM_T10 $_REQUEST['STREET'] = stripslashes($res->STREET); //CUSTOM_T11 $_REQUEST['TOWN'] = stripslashes($res->TOWN); //CUSTOM_T12 $_REQUEST['CP'] = stripslashes($res->CP); //CUSTOM_T13 } } $emet->deco(); } else if( isset($_SESSION['last_emet_search']) ) { unset($_SESSION['new_exp']); unset($_SESSION['exp_id']); $emet_id = 0; //Insertion rapide if( preg_match("/(.*),(.*)/",$_SESSION['last_emet_search'],$matches1) > 0 && count($matches1 == 3) ) { $lastname = $matches1[1]; if( preg_match("/(.*)\[(.*)\]/",$matches1[2],$matches2) > 0 && count($matches2 == 3) ) { $firstname = $matches2[1]; $society = $matches2[2]; } else { $firstname = $matches1[2]; } } else { if( preg_match("/(.*?)\[(.*)\]/",$_SESSION['last_emet_search'],$matches2) > 0 && count($matches2 == 3) ) { $lastname = $matches2[1]; $society = $matches2[2]; } else { $lastname = $_SESSION['last_emet_search']; } } $_SESSION['courrier']['emetteur'] = "dest"; $_REQUEST['nom'] = $lastname; $_REQUEST['prenom'] = $firstname; $_REQUEST['societe'] = $society; } //FIN : Nouvelle liste emetteur //Nouvelle liste expediteur //1)Nouvel Expediteur if( isset($_SESSION['new_exp']) && count($_SESSION['new_exp']) > 0 ) { unset($_SESSION['new_emet']); unset($_SESSION['emet_id']); $emet_id = 0; $_SESSION['courrier']['sender_nom'] = $_SESSION['new_exp']['LASTNAME']; $_SESSION['courrier']['sender_prenom'] = $_SESSION['new_exp']['FIRSTNAME']; $_SESSION['courrier']['sender_society'] = $_SESSION['new_exp']['SOCIETY']; $_REQUEST['civilite'] = $_SESSION['new_exp']['CIVILITY']; //fonction en mode corporate $_REQUEST['societe'] = $_SESSION['new_exp']['SOCIETY']; $_REQUEST['FUNCTION'] = $_SESSION['new_exp']['FUNCTION']; //CUSTOM_T9 $_REQUEST['STREET_NUM'] = $_SESSION['new_exp']['STREET_NUM']; //CUSTOM_T10 $_REQUEST['STREET'] = $_SESSION['new_exp']['STREET']; //CUSTOM_T11 $_REQUEST['TOWN'] = $_SESSION['new_exp']['TOWN']; //CUSTOM_T12 $_REQUEST['CP'] = $_SESSION['new_exp']['CP']; //CUSTOM_T13 } //2)L'expediteur existe et a été selectionné else if( isset($_SESSION['exp_id']) ) { unset($_SESSION['new_emet']); unset($_SESSION['emet_id']); $exp = new dbquery(); $exp->connect(); $emet_id = $_SESSION['exp_id']; //L'expediteur vient de la table sender if( is_numeric($emet_id) ) { $exp->query("SELECT CIVILITY, LASTNAME, FIRSTNAME, SOCIETY, FUNCTION, STREET_NUM, STREET, TOWN, CP FROM ".$_SESSION['tablename']['senders']." WHERE TOCONTACT = 'EXT' AND ID = ".$emet_id); if( $res = $exp->fetch_object() ) { if( $_SESSION['config']['corporate'] == "true" && !($_SESSION['config']['borough'] == "true") ) { $_SESSION['courrier']['sender_nom'] = stripslashes($res->LASTNAME); $_SESSION['courrier']['sender_civilite'] = stripslashes($res->CIVILITY); $_SESSION['courrier']['sender_society'] = stripslashes($res->SOCIETY); $_SESSION['courrier']['sender_prenom'] = stripslashes($res->FIRSTNAME); $_REQUEST['civilite'] = stripslashes($res->FUNCTION); $_REQUEST['societe'] = stripslashes($res->SOCIETY); } else { $_SESSION['courrier']['sender_nom'] = stripslashes($res->LASTNAME); $_SESSION['courrier']['sender_civilite'] = stripslashes($res->CIVILITY); $_SESSION['courrier']['sender_society'] = stripslashes($res->SOCIETY); $_SESSION['courrier']['sender_prenom'] = stripslashes($res->FIRSTNAME); $_REQUEST['civilite'] = stripslashes($res->CIVILITY); $_REQUEST['societe'] = stripslashes($res->SOCIETY); $_REQUEST['FUNCTION'] = stripslashes($res->FUNCTION); //CUSTOM_T9 $_REQUEST['STREET_NUM'] = stripslashes($res->STREET_NUM); //CUSTOM_T10 $_REQUEST['STREET'] = stripslashes($res->STREET); //CUSTOM_T11 $_REQUEST['TOWN'] = stripslashes($res->TOWN); //CUSTOM_T12 $_REQUEST['CP'] = stripslashes($res->CP); //CUSTOM_T13 } } } //C'est un utilisateur Maarch else { $exp->query("SELECT USER_ID, LASTNAME, FIRSTNAME FROM ".$_SESSION['tablename']['users']." WHERE USER_ID = '".$emet_id."'"); if( $res = $exp->fetch_object() ) { //$_SESSION['courrier']['index_sender_liste'] = $emet_id; $_SESSION['courrier']['sender_nom'] = stripslashes($res->LASTNAME); $_REQUEST['civilite'] = stripslashes($res->USER_ID); $_SESSION['courrier']['sender_prenom'] = stripslashes($res->FIRSTNAME); } $emet_id = 0; } $exp->deco(); } else if( isset($_SESSION['last_exp_search']) ) { unset($_SESSION['new_emet']); unset($_SESSION['emet_id']); $emet_id = 0; //Insertion rapide if( preg_match("/(.*),(.*)/",$_SESSION['last_exp_search'],$matches1) > 0 && count($matches1 == 3) ) { $lastname = $matches1[1]; if( preg_match("/(.*)\[(.*)\]/",$matches1[2],$matches2) > 0 && count($matches2 == 3) ) { $firstname = $matches2[1]; $society = $matches2[2]; } else { $firstname = $matches1[2]; } } else { if( preg_match("/(.*?)\[(.*)\]/",$_SESSION['last_exp_search'],$matches2) > 0 && count($matches2 == 3) ) { $lastname = $matches2[1]; $society = $matches2[2]; } else { $lastname = $_SESSION['last_exp_search']; } } $_SESSION['courrier']['sender_nom'] = $lastname; $_SESSION['courrier']['sender_prenom'] = $firstname; $_REQUEST['societe'] = $society; } //FIN : Nouvelle liste emetteur ?>