| Line 93... |
Line 93... |
| 93 |
$formulaire->addElement($select) ;
|
93 |
$formulaire->addElement($select) ;
|
| 94 |
$formulaire->addElement('text', 'nom', AM_L_NOM);
|
94 |
$formulaire->addElement('text', 'nom', AM_L_NOM);
|
| 95 |
$formulaire->addElement('text', 'prenom', AM_L_PRENOM);
|
95 |
$formulaire->addElement('text', 'prenom', AM_L_PRENOM);
|
| 96 |
$formulaire->addElement('text', 'ville', AM_L_VILLE);
|
96 |
$formulaire->addElement('text', 'ville', AM_L_VILLE);
|
| Line -... |
Line 97... |
| - |
|
97 |
|
| 97 |
|
98 |
$departement['tous'] = 'Tous';
|
| 98 |
$departement = & $GLOBALS['ann_db']->getAssoc('select GFD_ID, CONCAT(GFD_ID,\' - \',GFD_NAME) as GFD_NAME from gen_FRENCH_DPT');
|
99 |
$resultat = & $GLOBALS['ann_db']->query('select GFD_ID, CONCAT(GFD_ID,\' - \',GFD_NAME) as GFD_NAME from gen_FRENCH_DPT');
|
| Line 99... |
Line 100... |
| 99 |
$departement = array_merge (array ('tous' => 'Tous'), $departement);
|
100 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) $departement[$ligne->GFD_ID] = $ligne->GFD_NAME;
|
| 100 |
|
101 |
|
| Line 101... |
Line 102... |
| 101 |
$select_dpt = new HTML_QuickForm_select ('departement', AM_L_DEPARTEMENT, $departement, array ('class' => 'projet_asso')) ;
|
102 |
$select_dpt = new HTML_QuickForm_select ('departement', AM_L_DEPARTEMENT, $departement, array ('class' => 'projet_asso')) ;
|
| Line 145... |
Line 146... |
| 145 |
|
146 |
|
| 146 |
// Requete sur l'annuaire pour extraire le nom, prénom, ville, nom du département (jointure),
|
147 |
// Requete sur l'annuaire pour extraire le nom, prénom, ville, nom du département (jointure),
|
| Line 147... |
Line 148... |
| 147 |
// l'état de la cotisation (jointure)
|
148 |
// l'état de la cotisation (jointure)
|
| 148 |
|
- |
|
| 149 |
// le tableau suivant contient tous les champs de la table annuaire_tela sur lesquels on peut effectuer une recherche
|
149 |
|
| Line 150... |
Line 150... |
| 150 |
$fields_annu = array("nom" => ANN_CHAMPS_NOM, "prenom" => ANN_CHAMPS_PRENOM , "mail" => ANN_CHAMPS_MAIL , "ville" => ANN_CHAMPS_VILLE,
|
150 |
// le tableau suivant contient tous les champs de la table annuaire_tela sur lesquels on peut effectuer une recherche
|
| 151 |
"dept" => "U_FRENCH_DPT", "pays" => ANN_CHAMPS_PAYS ) ;
|
151 |
$fields_annu = array('departement' => 'U_FRENCH_DPT', "pays" => ANN_CHAMPS_PAYS ) ;
|
| 152 |
|
152 |
|
| Line 153... |
Line 153... |
| 153 |
$mes_vars = array ("recherche", "nom", "ville", "mail" ,"dept",
|
153 |
$mes_vars = array ("recherche", "nom", "ville", "mail" ,"departement",
|
| 154 |
"prenom", "cotisant", "pays", "sort", "T_REPONSE",
|
154 |
"prenom", "cotisant", "pays", "sort", "T_REPONSE",
|
| Line 169... |
Line 169... |
| 169 |
$queries = 'select '.ANN_CHAMPS_ID.','.ANN_CHAMPS_NOM.', '.ANN_CHAMPS_PRENOM.', '.
|
169 |
$queries = 'select '.ANN_CHAMPS_ID.','.ANN_CHAMPS_NOM.', '.ANN_CHAMPS_PRENOM.', '.
|
| 170 |
ANN_CHAMPS_PAYS.','.ANN_CHAMPS_MAIL.', '.ANN_CHAMPS_VILLE ;
|
170 |
ANN_CHAMPS_PAYS.','.ANN_CHAMPS_MAIL.', '.ANN_CHAMPS_VILLE ;
|
| 171 |
$queries .= ", ".ANN_TABLE_PAYS.".GC_NAME ";
|
171 |
$queries .= ", ".ANN_TABLE_PAYS.".GC_NAME ";
|
| 172 |
$queries .= "from ";
|
172 |
$queries .= "from ";
|
| 173 |
$queries .= ANN_TABLE_PAYS.','.ANN_ANNUAIRE ;
|
173 |
$queries .= ANN_TABLE_PAYS.','.ANN_ANNUAIRE ;
|
| 174 |
// On effectue une jointure gauche si l on veut tous les inscrits
|
- |
|
| 175 |
// y compris ce qui ne cotisent pas sinon pas de jointure gauche
|
- |
|
| 176 |
/*
|
- |
|
| 177 |
if (isset($cotisant) && $cotisant != 1) {
|
- |
|
| 178 |
|
174 |
|
| 179 |
} else {
|
- |
|
| 180 |
$queries .= ' left ' ;
|
- |
|
| 181 |
}
|
- |
|
| 182 |
$queries .= ' join annuaire_COTISATION on '.
|
- |
|
| 183 |
ANN_ANNUAIRE.'.U_ID=annuaire_COTISATION.IC_ANNU_ID ';
|
- |
|
| 184 |
|
175 |
|
| 185 |
if (isset($annee_cotisation) && $annee_cotisation != 0) {
|
- |
|
| 186 |
$queries .= ' and year(IC_DATE)='.$annee_cotisation ;
|
- |
|
| 187 |
} else {
|
- |
|
| 188 |
$queries .= 'and year(IC_DATE)='.date('Y') ;
|
- |
|
| 189 |
}
|
- |
|
| 190 |
*/
|
- |
|
| 191 |
// Construction en fonction des champs saisies
|
176 |
// Construction en fonction des champs saisies
|
| Line 192... |
Line 177... |
| 192 |
|
177 |
|
| 193 |
// juste le champs "rechercher", on regarde partout
|
178 |
// juste le champs "rechercher", on regarde partout
|
| Line 194... |
Line 179... |
| 194 |
$queries .= " where " ;
|
179 |
$queries .= " where 1 " ;
|
| 195 |
|
180 |
|
| 196 |
if ($lettre == "") {
|
181 |
if ($lettre == "") {
|
| 197 |
if ($_REQUEST['recherche'] != '') {
|
182 |
if ($_REQUEST['recherche'] != '') {
|
| 198 |
$queries .= '('.ANN_CHAMPS_NOM.' like "%'.$_REQUEST['recherche'].'%"' ; // le premier
|
183 |
$queries .= ' and ('.ANN_CHAMPS_NOM.' like "%'.$_REQUEST['recherche'].'%"' ; // le premier
|
| 199 |
foreach($fields_annu as $key=>$value) {
|
184 |
foreach($fields_annu as $key=>$value) {
|
| 200 |
if ($key == "nom") continue ;
|
185 |
if ($key == "nom") continue ;
|
| 201 |
$queries .= ($key == "pays" ?
|
186 |
$queries .= ($key == "pays" ?
|
| 202 |
$pays == "tous" ? ")" :
|
187 |
$pays == "tous" ? ")" :
|
| 203 |
") and $value = '$pays'" : " or $value like '%$recherche%'") ; // les autres
|
188 |
") and $value = '$pays'" : " or $value like '%$recherche%'") ; // les autres
|
| 204 |
}
|
189 |
}
|
| Line 205... |
Line 190... |
| 205 |
$queries .= ' and ' ;
|
190 |
//$queries .= ' and ' ;
|
| Line 206... |
Line 191... |
| 206 |
} else {
|
191 |
} else {
|
| 207 |
|
192 |
|
| 208 |
// si un ou plusieurs autres champs ont été indiqué, on les rajoute ici
|
193 |
// si un ou plusieurs autres champs ont été indiqué, on les rajoute ici
|
| 209 |
|
194 |
|
| 210 |
$or_flag = false ;
|
195 |
$or_flag = false ;
|
| 211 |
foreach($fields_annu as $key=>$valeur) {
|
196 |
foreach($fields_annu as $key=>$valeur) {
|
| 212 |
if ($key != "") {
|
197 |
if ($key != "") {
|
| 213 |
if ($key == "pays" && ($$key != 'tous' && $$key != '')) {
|
198 |
if ($key == "pays" && ($$key != 'tous' && $$key != '')) {
|
| 214 |
if ($$key != "tous") $queries .= ") and $valeur like \"%".$$key."%\"" ;
|
199 |
if ($$key != "tous") $queries .= " and $valeur like \"%".$$key."%\"" ;
|
| 215 |
} else {
|
200 |
} else {
|
| 216 |
if ($key == "dept") {
|
201 |
if ($key == "departement") {
|
| Line 217... |
Line 202... |
| 217 |
if ($$key != "tous" && isset($HTTP_POST_VARS[$key])) {
|
202 |
if (isset ($_REQUEST[$key]) && $_REQUEST[$key] != "tous") {
|
| 218 |
$queries .= " and U_FRENCH_DPT=".$$key ;
|
203 |
$queries .= ' and U_FRENCH_DPT="'.$_REQUEST[$key].'"' ;
|
| 219 |
if ($fields_annu["pays"] != "fr") $queries .= ' and '.ANN_CHAMPS_PAYS.'="fr"' ;
|
- |
|
| - |
|
204 |
if ($fields_annu["pays"] != "fr") $queries .= ' and '.ANN_CHAMPS_PAYS.'="fr"' ;
|
| 220 |
}
|
205 |
}
|
| 221 |
|
- |
|
| 222 |
} else {
|
206 |
|
| Line 223... |
Line 207... |
| 223 |
if ($$key != '' && $key != 'pays') {
|
207 |
} else {
|
| 224 |
if (!$or_flag) $queries .= '(' ;
|
208 |
if ($$key != '' && $key != 'pays') {
|
| 225 |
$queries .= $valeur.' like "%'.$$key.'%"' ;
|
209 |
|
| Line 236... |
Line 220... |
| 236 |
$queries .= ANN_CHAMPS_NOM.' like "%")' ;
|
220 |
$queries .= ANN_CHAMPS_NOM.' like "%")' ;
|
| 237 |
}
|
221 |
}
|
| 238 |
}
|
222 |
}
|
| 239 |
} else {
|
223 |
} else {
|
| 240 |
if ($lettre == "tous") $lettre = "" ;
|
224 |
if ($lettre == "tous") $lettre = "" ;
|
| 241 |
$queries .= ANN_CHAMPS_NOM.' like "'.$lettre.'%" and ' ;
|
225 |
$queries .= 'and '.ANN_CHAMPS_NOM.' like "'.$lettre.'%" ' ;
|
| 242 |
}
|
226 |
}
|
| 243 |
$queries .= "" ;
|
227 |
$queries .= "" ;
|
| 244 |
// jointure entre annuaire et table des pays annuaire_tela et gen_COUNTRY
|
228 |
// jointure entre annuaire et table des pays annuaire_tela et gen_COUNTRY
|
| 245 |
$queries .= " ".ANN_ANNUAIRE.".".ANN_CHAMPS_PAYS."=".ANN_TABLE_PAYS.".GC_ID" ;
|
229 |
$queries .= " and ".ANN_ANNUAIRE.".".ANN_CHAMPS_PAYS."=".ANN_TABLE_PAYS.".GC_ID" ;
|
| Line 246... |
Line 230... |
| 246 |
|
230 |
|
| 247 |
if (isset($nom) && $nom != "") $queries .= " and ".ANN_CHAMPS_NOM." like \"%$nom%\"" ;
|
231 |
if (isset($nom) && $nom != "") $queries .= " and ".ANN_CHAMPS_NOM." like \"%$nom%\"" ;
|
| 248 |
if (isset($prenom) && $prenom != "") $queries .= " and ".ANN_CHAMPS_PRENOM." like \"%$prenom%\"" ;
|
232 |
if (isset($prenom) && $prenom != "") $queries .= " and ".ANN_CHAMPS_PRENOM." like \"%$prenom%\"" ;
|
| 249 |
if (isset($ville) && $ville != "") $queries .= " and ".ANN_CHAMPS_VILLE." like \"%$ville%\"" ;
|
233 |
if (isset($ville) && $ville != "") $queries .= " and ".ANN_CHAMPS_VILLE." like \"%$ville%\"" ;
|
| 250 |
if (isset($mail) && $mail != "") $queries .= " and ".ANN_CHAMPS_MAIL." like \"%$mail%\"" ;
|
234 |
if (isset($mail) && $mail != "") $queries .= " and ".ANN_CHAMPS_MAIL." like \"%$mail%\"" ;
|
| - |
|
235 |
if (isset($_REQUEST['sort']) && $_REQUEST['sort'] != '') $queries .= ' order by '.$_REQUEST['sort'] ;
|
| - |
|
236 |
|
| - |
|
237 |
|
| - |
|
238 |
// traitement de l etat de cotisation
|
| - |
|
239 |
|
| - |
|
240 |
if (isset($cotisant) && $cotisant != 1) {
|
| - |
|
241 |
$queries .= ' and U_ID IN (select IC_ANNU_ID from annuaire_COTISATION where ';
|
| - |
|
242 |
|
| - |
|
243 |
if (isset($annee_cotisation) && $annee_cotisation != 0) {
|
| - |
|
244 |
$queries .= ' year(IC_DATE)='.$annee_cotisation ;
|
| - |
|
245 |
} else {
|
| - |
|
246 |
$queries .= 'year(IC_DATE)='.date('Y') ;
|
| - |
|
247 |
}
|
| - |
|
248 |
$queries .= ')';
|
| 251 |
if (isset($_REQUEST['sort']) && $_REQUEST['sort'] != '') $queries .= ' order by '.$_REQUEST['sort'] ;
|
249 |
}
|
| 252 |
return $queries;
|
250 |
return $queries;
|
| Line 253... |
Line 251... |
| 253 |
}
|
251 |
}
|
| Line 358... |
Line 356... |
| 358 |
$GLOBALS['ann_url']->removeQueryString('u_id');
|
356 |
$GLOBALS['ann_url']->removeQueryString('u_id');
|
| Line 359... |
Line 357... |
| 359 |
|
357 |
|
| 360 |
$ret .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
358 |
$ret .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
| 361 |
$GLOBALS['ann_url']->addQueryString(ANN_VARIABLE_ACTION, ANN_ACTION_MAIL_TOUS);
|
359 |
$GLOBALS['ann_url']->addQueryString(ANN_VARIABLE_ACTION, ANN_ACTION_MAIL_TOUS);
|
| 362 |
$ret .= "<div id=\"envoyer_selection\"><a href=\"".$GLOBALS['ann_url']->getURL()."\">".AM_L_MAIL_SELECTION."</a></div>\n" ;
|
360 |
$ret .= "<div id=\"envoyer_selection\"><a href=\"".$GLOBALS['ann_url']->getURL()."\">".AM_L_MAIL_SELECTION."</a></div>\n" ;
|
| 363 |
//$ret .= '<pre id="debogage">'.$requete.'</pre>';
|
361 |
$ret .= '<pre id="debogage">'.$requete.'</pre>';
|
| 364 |
return $ret;
|
362 |
return $ret;
|
| Line 365... |
Line 363... |
| 365 |
}
|
363 |
}
|
| Line 427... |
Line 425... |
| 427 |
*
|
425 |
*
|
| 428 |
* $Log:$
|
426 |
* $Log:$
|
| 429 |
* * +-- Fin du code ----------------------------------------------------------------------------------------+
|
427 |
* * +-- Fin du code ----------------------------------------------------------------------------------------+
|
| 430 |
*/
|
428 |
*/
|
| Line 431... |
Line -... |
| 431 |
|
- |
|
| 432 |
?>
|
429 |
|
| - |
|
430 |
?>
|