Subversion Repositories eFlore/Applications.coel

Rev

Rev 1765 | Rev 1788 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1765 Rev 1785
Line 345... Line 345...
345
				"cc_historique LIKE {$p['mots']}",
345
				"cc_historique LIKE {$p['mots']}",
346
				"cs_nom LIKE {$p['mots']}",
346
				"cs_nom LIKE {$p['mots']}",
347
				"cs_truk_nom_alternatif LIKE {$p['mots']}",
347
				"cs_truk_nom_alternatif LIKE {$p['mots']}",
348
				"cs_description LIKE {$p['mots']}",
348
				"cs_description LIKE {$p['mots']}",
349
				"cs_adresse_01 LIKE {$p['mots']}",
349
				"cs_adresse_01 LIKE {$p['mots']}",
350
				"cs_adresse_02 LIKE {$p['mots']}",
-
 
351
				"cs_ville LIKE {$p['mots']}",
350
				"cs_ville LIKE {$p['mots']}",
352
				"cs_truk_identifiant_alternatif LIKE {$p['mots']}",
351
				"cs_truk_identifiant_alternatif LIKE {$p['mots']}",
353
				"cs_condition_acces LIKE {$p['mots']}",
352
				"cs_condition_acces LIKE {$p['mots']}",
354
				"cs_condition_usage LIKE {$p['mots']}",
353
				"cs_condition_usage LIKE {$p['mots']}",
355
				"cs_truk_telephone LIKE {$p['mots']}",
354
				"cs_truk_telephone LIKE {$p['mots']}",
Line 367... Line 366...
367
		if (isset($p['bot'])) {
366
		if (isset($p['bot'])) {
368
			$where[] = "ccb_ce_truk_type IN ({$p['bot']})";
367
			$where[] = "ccb_ce_truk_type IN ({$p['bot']})";
369
		}
368
		}
370
		if (isset($p['lieu-stockage'])) {
369
		if (isset($p['lieu-stockage'])) {
371
      $join[] = 'LEFT JOIN coel_meta_liste_valeur cmlv ON cmlv.cmlv_id_valeur = cs_ce_truk_pays';
370
      $join[] = 'LEFT JOIN coel_meta_liste_valeur cmlv ON cmlv.cmlv_id_valeur = cs_ce_truk_pays';
372
      $join[] = 'LEFT JOIN coel_meta_liste_valeur cmlv2 ON cmlv2.cmlv_id_valeur = cs_ce_truk_region';
-
 
373
			$where[] = '(' . implode(' OR ', array(
371
			$where[] = '(' . implode(' OR ', array(
374
				"cs_adresse_01 LIKE {$p['lieu-stockage']}",
372
				"cs_adresse_01 LIKE {$p['lieu-stockage']}",
375
				"cs_adresse_02 LIKE {$p['lieu-stockage']}",
-
 
376
				"cs_code_postal LIKE {$p['lieu-stockage']}",
373
				"cs_code_postal LIKE {$p['lieu-stockage']}",
377
				"cs_ville LIKE {$p['lieu-stockage']}",
374
				"cs_ville LIKE {$p['lieu-stockage']}",
378
				"cs_ce_truk_region LIKE {$p['lieu-stockage']}",
-
 
379
				"cs_ce_truk_pays LIKE {$p['lieu-stockage']}",
375
				"cs_ce_truk_pays LIKE {$p['lieu-stockage']}",
380
				"cmlv.cmlv_nom LIKE {$p['lieu-stockage']}",
376
				"cmlv.cmlv_nom LIKE {$p['lieu-stockage']}",
381
				"cmlv2.cmlv_nom LIKE {$p['lieu-stockage']}"
-
 
382
			)) . ')';
377
			)) . ')';
383
		}
378
		}
384
		if (isset($p['zg'])) {
379
		if (isset($p['zg'])) {
385
			$where[] = "cc_truk_couverture_lieu LIKE {$p['zg']}";
380
			$where[] = "cc_truk_couverture_lieu LIKE {$p['zg']}";
386
		}
381
		}
Line 397... Line 392...
397
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';
392
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';
398
			$where[] = "cv.cmlv_abreviation IN ('FR', 'RE', 'YT', 'GP', 'MQ', 'GF', 'NC')";
393
			$where[] = "cv.cmlv_abreviation IN ('FR', 'RE', 'YT', 'GP', 'MQ', 'GF', 'NC')";
399
			$where[] = sprintf("cs_code_postal REGEXP '^(%s).*'", implode('|', $p['str-d']));
394
			$where[] = sprintf("cs_code_postal REGEXP '^(%s).*'", implode('|', $p['str-d']));
400
		}
395
		}
Line 401... Line -...
401
 
-
 
402
        // http://download.geonames.org/export/dump/admin1CodesASCII.txt
-
 
403
		if (isset($p['regions'])) {
-
 
404
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_region';
-
 
405
			$where[] = sprintf('cv.cmlv_abreviation IN ("%s")', implode('","', $p['regions']));
-
 
406
		}
-
 
407
 
396
 
408
		if (isset($p['pays'])) {
397
		if (isset($p['pays'])) {
409
            if(array_search('FR', $p['pays']) !== FALSE) $p['pays'] = array_merge($p['pays'], array('RE','YT','GP','MQ','GF','NC'));
398
            if(array_search('FR', $p['pays']) !== FALSE) $p['pays'] = array_merge($p['pays'], array('RE','YT','GP','MQ','GF','NC'));
410
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';
399
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';
411
			$where[] = sprintf('cv.cmlv_abreviation IN ("%s")', implode('","', $p['pays']));
400
			$where[] = sprintf('cv.cmlv_abreviation IN ("%s")', implode('","', $p['pays']));
Line 457... Line 446...
457
		if (isset($p['nom-famille'])) {
446
		if (isset($p['nom-famille'])) {
458
			$where[] = "cp_nom LIKE {$p['nom-famille']}";
447
			$where[] = "cp_nom LIKE {$p['nom-famille']}";
459
		}
448
		}
460
		if (isset($p['adresse'])) {
449
		if (isset($p['adresse'])) {
461
      $join[] = 'LEFT JOIN coel_meta_liste_valeur cmlv ON cmlv.cmlv_id_valeur = cp_ce_truk_pays';
450
      $join[] = 'LEFT JOIN coel_meta_liste_valeur cmlv ON cmlv.cmlv_id_valeur = cp_ce_truk_pays';
462
      $join[] = 'LEFT JOIN coel_meta_liste_valeur cmlv2 ON cmlv2.cmlv_id_valeur = cp_ce_truk_region';
-
 
463
			$where[] = '(' . implode(' OR ', array(
451
			$where[] = '(' . implode(' OR ', array(
464
				"cp_adresse_01 LIKE {$p['adresse']}",
452
				"cp_adresse_01 LIKE {$p['adresse']}",
465
				"cp_adresse_02 LIKE {$p['adresse']}",
-
 
466
				"cp_code_postal LIKE {$p['adresse']}",
453
				"cp_code_postal LIKE {$p['adresse']}",
467
				"cp_ville LIKE {$p['adresse']}",
454
				"cp_ville LIKE {$p['adresse']}",
468
				"cp_ce_truk_pays LIKE {$p['adresse']}",
455
				"cp_ce_truk_pays LIKE {$p['adresse']}",
469
				"cp_ce_truk_region LIKE {$p['adresse']}",
456
				"cp_ce_truk_region LIKE {$p['adresse']}",
470
				"cp_naissance_lieu LIKE {$p['adresse']}",
457
				"cp_naissance_lieu LIKE {$p['adresse']}",
471
				"cp_deces_lieu LIKE {$p['adresse']}",
458
				"cp_deces_lieu LIKE {$p['adresse']}",
472
				"cmlv.cmlv_nom LIKE {$p['adresse']}",
459
				"cmlv.cmlv_nom LIKE {$p['adresse']}",
473
				"cmlv2.cmlv_nom LIKE {$p['adresse']}"
-
 
474
			)) . ')';
460
			)) . ')';
475
		}
461
		}
476
		if (isset($p['date-vivant'])) {
462
		if (isset($p['date-vivant'])) {
477
			$where[] = "cp_naissance_date <= {$p['date-vivant']}";
463
			$where[] = "cp_naissance_date <= {$p['date-vivant']}";
478
			$where[] = "cp_deces_date >= {$p['date-vivant']}";
464
			$where[] = "cp_deces_date >= {$p['date-vivant']}";