diff --git a/includes/infogreffe/gestion.php b/includes/infogreffe/gestion.php index 8bba54634..1aff08988 100644 --- a/includes/infogreffe/gestion.php +++ b/includes/infogreffe/gestion.php @@ -208,7 +208,7 @@ function commandesListe($type, $etat, $date, $mode){ setDbConn('sdv1'); $table = tableTypeCommande($type); - $dateTDebut = mktime(0, 0, 0, date('m', $date), 0, date('Y', $date)); + $dateTDebut = mktime(0, 0, 0, date('m', $date), 1, date('Y', $date)); $dateTFin = mktime(0, 0, 0, date('m', $date)+1, 0, date('Y', $date)); $dateDebut = date('Y-m-d H:i:s',$dateTDebut); @@ -219,18 +219,22 @@ function commandesListe($type, $etat, $date, $mode){ ->Where('dateCommande > ? ', $dateDebut) ->andWhere('dateCommande < ? ', $dateFin); - switch($etat){ - case 'commande': - $q->andWhere('statutCommande = ?', 0); - $q->andWhere('dateReception = ?', '0000-00-00 00:00:00'); - break; - case 'reception': - $q->andWhere('dateReception != ?', '0000-00-00 00:00:00'); - break; - case 'erreur': - $q->andWhere('statutCommande = ?', 9); - $q->andWhere('dateReception = ?', '0000-00-00 00:00:00'); - break; + if (preg_match('/([A-Z])-([0-9]{1,})/', $etat, $matches)){ + $q->andWhere('statutCommande = ?', $matches[2]); + } else { + switch($etat){ + case 'commande': + $q->andWhere('statutCommande = ?', 0); + $q->andWhere('dateReception = ?', '0000-00-00 00:00:00'); + break; + case 'reception': + $q->andWhere('dateReception != ?', '0000-00-00 00:00:00'); + break; + case 'erreur': + $q->andWhere('statutCommande = ?', 9); + $q->andWhere('dateReception = ?', '0000-00-00 00:00:00'); + break; + } } if ($mode!=''){ diff --git a/www/pages/greffescmd.php b/www/pages/greffescmd.php index 03405a2b7..168cf10cd 100644 --- a/www/pages/greffescmd.php +++ b/www/pages/greffescmd.php @@ -194,8 +194,7 @@ if (count($cStatuts)>0 && hasModeEdition()){ $select = ' selected'; } ?> - +