| Line 448... |
Line 448... |
| 448 |
if (isset($this->parametres['masque.tag_cel']['AND'])) {
|
448 |
if (isset($this->parametres['masque.tag_cel']['AND'])) {
|
| 449 |
$tags = $this->parametres['masque.tag_cel']['AND'];
|
449 |
$tags = $this->parametres['masque.tag_cel']['AND'];
|
| 450 |
$clausesWhere = array();
|
450 |
$clausesWhere = array();
|
| 451 |
foreach ($tags as $tag) {
|
451 |
foreach ($tags as $tag) {
|
| 452 |
$tagMotif = $this->bdd->proteger("%$tag%");
|
452 |
$tagMotif = $this->bdd->proteger("%$tag%");
|
| - |
|
453 |
if ($this->etreAppliImg()) {
|
| - |
|
454 |
$sql = " (do.mots_cles_texte LIKE $tagMotif OR di.mots_cles_texte LIKE $tagMotif) ";
|
| - |
|
455 |
} else {
|
| 453 |
// WARNING : la sous-requête est la meilleure solution trouvée pour contrer le fonctionnement
|
456 |
// WARNING : la sous-requête est la meilleure solution trouvée pour contrer le fonctionnement
|
| 454 |
// étrange de l'optimiseur de MYSQL 5.6 (à retester avec Mysql 5.7 et suivant).
|
457 |
// étrange de l'optimiseur de MYSQL 5.6 (à retester avec Mysql 5.7 et suivant).
|
| 455 |
$sousRequete = 'SELECT DISTINCT ce_observation '.
|
458 |
$sousRequete = 'SELECT DISTINCT ce_observation '.
|
| 456 |
'FROM del_image '.
|
459 |
'FROM del_image '.
|
| 457 |
"WHERE mots_cles_texte LIKE $tagMotif ".
|
460 |
"WHERE mots_cles_texte LIKE $tagMotif ".
|
| 458 |
'AND ce_observation IS NOT NULL';
|
461 |
'AND ce_observation IS NOT NULL';
|
| 459 |
$sql = " (do.mots_cles_texte LIKE $tagMotif OR do.id_observation IN ($sousRequete)) ";
|
462 |
$sql = " (do.mots_cles_texte LIKE $tagMotif OR do.id_observation IN ($sousRequete)) ";
|
| - |
|
463 |
}
|
| 460 |
$clausesWhere[] = $sql;
|
464 |
$clausesWhere[] = $sql;
|
| 461 |
}
|
465 |
}
|
| 462 |
$whereTags = implode(' AND ', $clausesWhere);
|
466 |
$whereTags = implode(' AND ', $clausesWhere);
|
| 463 |
$this->addWhere('masque.tag_cel', "($whereTags)");
|
467 |
$this->addWhere('masque.tag_cel', "($whereTags)");
|
| 464 |
} else if (isset($this->parametres['masque.tag_cel']['OR'])) {
|
468 |
} else if (isset($this->parametres['masque.tag_cel']['OR'])) {
|
| Line 469... |
Line 473... |
| 469 |
$this->addWhere('masque.tag_cel', $tagSql);
|
473 |
$this->addWhere('masque.tag_cel', $tagSql);
|
| 470 |
}
|
474 |
}
|
| 471 |
if ($this->etreAppliImg()) {
|
475 |
if ($this->etreAppliImg()) {
|
| 472 |
$this->addJoin('LEFT JOIN del_observation AS do ON (di.ce_observation = do.id_observation) ');
|
476 |
$this->addJoin('LEFT JOIN del_observation AS do ON (di.ce_observation = do.id_observation) ');
|
| 473 |
}
|
477 |
}
|
| 474 |
if ($this->etreAppliObs()) {
|
- |
|
| 475 |
$this->addJoin('LEFT JOIN del_image AS di ON (do.id_observation = di.ce_observation) ');
|
- |
|
| 476 |
}
|
- |
|
| 477 |
}
|
478 |
}
|
| 478 |
}
|
479 |
}
|
| Line 479... |
Line 480... |
| 479 |
|
480 |
|
| 480 |
/**
|
481 |
/**
|