Subversion Repositories eFlore/Applications.del

Rev

Rev 1968 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1968 Rev 1980
Line 111... Line 111...
111
	public function getWhere() {
111
	public function getWhere() {
112
		// Sous-requete spéciale pour éviter de rechercher dans la table obs jointe à img depuis Pictoflora...
112
		// Sous-requete spéciale pour éviter de rechercher dans la table obs jointe à img depuis Pictoflora...
113
		if (isset($this->requete['where']['OR_SOUS_REQUETE']) && count($this->requete['where']['OR_SOUS_REQUETE']) > 0) {
113
		if (isset($this->requete['where']['OR_SOUS_REQUETE']) && count($this->requete['where']['OR_SOUS_REQUETE']) > 0) {
114
			$clauseWhereSousRequete = implode(' OR ', $this->requete['where']['OR_SOUS_REQUETE']);
114
			$clauseWhereSousRequete = implode(' OR ', $this->requete['where']['OR_SOUS_REQUETE']);
115
			$sousRequete = 'di.ce_observation IN '.
115
			$sousRequete = 'di.ce_observation IN '.
116
				"(SELECT DISTINCT id_observation FROM del_observation AS do WHERE $clauseWhereSousRequete ) ";
116
				"(SELECT id_observation FROM del_observation AS do WHERE $clauseWhereSousRequete ) ";
117
			$this->requete['where']['OR'][] = "( $sousRequete )";
117
			$this->requete['where']['OR'][] = "( $sousRequete )";
118
			unset($this->requete['join']['LEFT JOIN del_observation AS do ON (di.ce_observation = do.id_observation) ']);
118
			unset($this->requete['join']['LEFT JOIN del_observation AS do ON (di.ce_observation = do.id_observation) ']);
119
		}
119
		}
Line 120... Line 120...
120
 
120
 
Line 522... Line 522...
522
				$tags = $this->parametres['masque.tag_cel']['AND'];
522
				$tags = $this->parametres['masque.tag_cel']['AND'];
523
				$clausesWhere = array();
523
				$clausesWhere = array();
524
				foreach ($tags as $tag) {
524
				foreach ($tags as $tag) {
525
					$tagMotif = $this->bdd->proteger("%$tag%");
525
					$tagMotif = $this->bdd->proteger("%$tag%");
526
					if ($this->etreAppliImg()) {
526
					if ($this->etreAppliImg()) {
527
						$sousRequete = 'SELECT DISTINCT id_observation '.
527
						$sousRequete = 'SELECT id_observation '.
528
							'FROM del_observation '.
528
							'FROM del_observation '.
529
							"WHERE mots_cles_texte LIKE $tagMotif ";
529
							"WHERE mots_cles_texte LIKE $tagMotif ";
530
						$sql = " (di.mots_cles_texte LIKE $tagMotif OR di.id_image IN ($sousRequete) ) ";
530
						$sql = " (di.mots_cles_texte LIKE $tagMotif OR di.id_image IN ($sousRequete) ) ";
531
					} else {
531
					} else {
532
						// WARNING : la sous-requête est la meilleure solution trouvée pour contrer le fonctionnement
532
						// WARNING : la sous-requête est la meilleure solution trouvée pour contrer le fonctionnement