Subversion Repositories Applications.bazar

Rev

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

Rev 422 Rev 438
Line 942... Line 942...
942
		$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
942
		$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
943
	}
943
	}
Line 944... Line 944...
944
 
944
 
945
	if ($utilisateur->isSuperAdmin()) {
945
	if ($utilisateur->isSuperAdmin()) {
946
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
946
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
947
		$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
947
				$valide_select[0] = BAZ_FICHES_VALIDEES;
948
		$valide_select[1] = BAZ_FICHES_VALIDEES;
948
		$valide_select[1] = BAZ_FICHES_PAS_VALIDEES;
949
		$valide_select[2] = BAZ_LES_DEUX;
949
		$valide_select[2] = BAZ_LES_DEUX;
950
		$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ; 
950
		$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ; 
951
		$defauts=array('valides'=>1);
951
		$defauts=array('valides'=>0);
Line 952... Line 952...
952
		$formtemplate->setDefaults($defauts);
952
		$formtemplate->setDefaults($defauts);
Line 953... Line 953...
953
 
953
 
Line 988... Line 988...
988
			for ($i=0; $i<count($tableau); $i++) {
988
			for ($i=0; $i<count($tableau); $i++) {
989
				if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'labelhtml') && $tableau[$i]['recherche'] == 1) {
989
				if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'labelhtml') && $tableau[$i]['recherche'] == 1) {
990
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
990
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
991
			                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1, 'bazar') ;
991
			                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1, 'bazar') ;
992
				}
992
				}
993
			}
993
			}			
994
			
-
 
995
		}
994
		}
996
		else {
995
		else {
997
			$url_rech_avance = $GLOBALS['_BAZAR_']['url'];
996
			$url_rech_avance = $GLOBALS['_BAZAR_']['url'];
998
			foreach(array_merge($_POST, $_GET) as $cle => $valeur) $url_rech_avance->addQueryString($cle, $valeur); 
997
			foreach(array_merge($_POST, $_GET) as $cle => $valeur) $url_rech_avance->addQueryString($cle, $valeur); 
999
			$url_rech_avance->addQueryString('recherche_avancee', '1');
998
			$url_rech_avance->addQueryString('recherche_avancee', '1');
Line 1006... Line 1005...
1006
	if (isset($lien_recherche_avancee)) {
1005
	if (isset($lien_recherche_avancee)) {
1007
		labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
1006
		labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
1008
	}
1007
	}
Line 1009... Line 1008...
1009
	
1008
	
1010
	//Bouton de validation du formulaire
1009
	//Bouton de validation du formulaire
1011
	$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');	
1010
	$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;','class'=>'baz_rech');	
Line 1012... Line 1011...
1012
	$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
1011
	$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
1013
	
1012
	
Line 1152... Line 1151...
1152
			else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ; 
1151
			else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ; 
1153
		} else {
1152
		} else {
1154
			$typedefiches = $_REQUEST['nature'] ;
1153
			$typedefiches = $_REQUEST['nature'] ;
1155
			if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
1154
			if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
1156
		}
1155
		}
-
 
1156
		
1157
		if ($typeannonce!='toutes') $typedefiches=$typeannonce;
1157
		if ($typeannonce!='toutes') $typedefiches=$typeannonce;
1158
		if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
1158
		if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
1159
		else {$valides=1;}
1159
		else {$valides=1;}
1160
		//generation de la liste de flux a afficher
1160
		//generation de la liste de flux a afficher
1161
		if (!isset($_REQUEST['personnes'])) {
1161
		if (!isset($_REQUEST['personnes'])) {
Line 1168... Line 1168...
1168
        } else {		
1168
        } else {		
Line 1169... Line 1169...
1169
				
1169
				
1170
			$requeteWhere .= ' (bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00") AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND ' ;
1170
			$requeteWhere .= ' (bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00") AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND ' ;
Line 1171... Line 1171...
1171
		}		
1171
		}		
-
 
1172
 
1172
 
1173
		$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personnes'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
Line 1173... Line 1174...
1173
		$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personnes'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);		
1174
 
1174
	}
1175
	}
1175
	
1176
	
Line 1192... Line 1193...
1192
	$req_where=0;
1193
	$req_where=0;
1193
	$requete = 'SELECT * '.
1194
	$requete = 'SELECT * '.
1194
				'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
1195
				'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
1195
	if ($valide!=2) {
1196
	if ($valide!=2) {
1196
		if ($req_where==1) {$requete .= ' AND ';}
1197
		if ($req_where==1) {$requete .= ' AND ';}
-
 
1198
		if($valide == 0) {
1197
		$req_where=1;
1199
			$req_where=1;
-
 
1200
			$requete .= 'bf_statut_fiche=1';		
-
 
1201
		}
-
 
1202
		else {
-
 
1203
			$req_where=1;
1198
		$requete .= 'bf_statut_fiche='.$valide;		
1204
			$requete .= 'bf_statut_fiche=0';	
-
 
1205
		}
-
 
1206
			
1199
	} else {
1207
	} else {
1200
		$requete .= '1 ' ;
1208
		$requete .= '1 ' ;
1201
	}
1209
	}
Line 1202... Line 1210...
1202
	
1210
	
Line 1219... Line 1227...
1219
	if ($requeteSQL!='') {
1227
	if ($requeteSQL!='') {
1220
		if ($req_where==1) {$requete .= ' AND ';}
1228
		if ($req_where==1) {$requete .= ' AND ';}
1221
		$requete .= '('.$requeteSQL.')';
1229
		$requete .= '('.$requeteSQL.')';
1222
		$req_where=1;
1230
		$req_where=1;
1223
	}
1231
	}
1224
	$requete .= ' ORDER BY  bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
1232
	$requete .= 'GROUP BY bf_id_fiche ORDER BY  bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
1225
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
1233
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
1226
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1234
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1227
	if (DB::isError($resultat)) {
1235
	if (DB::isError($resultat)) {
1228
		return  $resultat->getMessage().'<br /><br />'.$resultat->getDebugInfo() ;
1236
		return  $resultat->getMessage().'<br /><br />'.$resultat->getDebugInfo() ;
1229
	}
1237
	}