Correction requete sql

This commit is contained in:
Michael RICOIS 2010-04-21 11:55:52 +00:00
parent 3f9fc4476e
commit a413b9ffe5
2 changed files with 11 additions and 5 deletions

View File

@ -204,7 +204,7 @@ function documentStatut($commande){
* @param unknown_type $etat * @param unknown_type $etat
* @param unknown_type $date * @param unknown_type $date
*/ */
function commandesListe($type, $etat, $date, $mode){ function commandesListe($type, $etat, $date, $mode = ''){
setDbConn('sdv1'); setDbConn('sdv1');
$table = tableTypeCommande($type); $table = tableTypeCommande($type);
@ -224,7 +224,7 @@ function commandesListe($type, $etat, $date, $mode){
} else { } else {
switch($etat){ switch($etat){
case 'commande': case 'commande':
$q->andWhere('statutCommande = ?', 0); $q->andWhere('statutCommande != ?', 9);
$q->andWhere('dateReception = ?', '0000-00-00 00:00:00'); $q->andWhere('dateReception = ?', '0000-00-00 00:00:00');
break; break;
case 'reception': case 'reception':
@ -237,14 +237,20 @@ function commandesListe($type, $etat, $date, $mode){
} }
} }
if ($mode!=''){ if ($mode!='-'){
if ($mode == 'G') {
$q->orWhereIn('typeCommande', array('', $mode));
} else {
$q->andWhere('typeCommande = ?', $mode); $q->andWhere('typeCommande = ?', $mode);
} }
}
if (!hasModeEdition()){ if (!hasModeEdition()){
$q->andWhere('login = ?', $_SESSION['tabInfo']['login']); $q->andWhere('login = ?', $_SESSION['tabInfo']['login']);
} }
FB::log($q->getSqlQuery(),'SQL');
FB::log($q->getFlattenedParams(),'SQL');
//Résultat //Résultat
$commandes = $q->execute(); $commandes = $q->execute();
FB::log($commandes->toArray(), 'commandes'); FB::log($commandes->toArray(), 'commandes');

View File

@ -226,7 +226,7 @@ for($i=$dateToday-$dateIntervalle; $i<=$dateToday; $i++)
$dateTime = mktime(0, 0, 0, $i+1, 0, date('Y')); $dateTime = mktime(0, 0, 0, $i+1, 0, date('Y'));
$selected = ''; $selected = '';
if ($date=='' && $i==$dateToday ){ $selected = 'selected'; } if ($date=='' && $i==$dateToday ){ $selected = 'selected'; }
if ($date!='' && $dateTime=$date){ $selected = 'selected'; } if ($date!='' && $dateTime==$date){ $selected = 'selected'; }
?> ?>
<option value="<?=$dateTime?>" <?=$selected?>> <option value="<?=$dateTime?>" <?=$selected?>>
<?=date('m/Y', $dateTime)?> <?=date('m/Y', $dateTime)?>