check types on getpost + date research

This commit is contained in:
Cédric Salvador 2013-06-27 15:54:04 +02:00
parent 4b90157aa2
commit 5062eb8006
2 changed files with 31 additions and 20 deletions

View File

@ -69,11 +69,11 @@ function ordered($product_id)
} }
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$sref = GETPOST('sref'); $sref = GETPOST('sref', 'alpha');
$snom = GETPOST('snom'); $snom = GETPOST('snom', 'alpha');
$sall = GETPOST('sall'); $sall = GETPOST('sall', 'alpha');
$type = GETPOST('type','int'); $type = GETPOST('type','int');
$tobuy = GETPOST('tobuy'); $tobuy = GETPOST('tobuy', 'int');
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
@ -238,7 +238,7 @@ if ($resql) {
$head[1][1] = $langs->trans("ReplenishmentOrders"); $head[1][1] = $langs->trans("ReplenishmentOrders");
$head[1][2] = 'replenishorders'; $head[1][2] = 'replenishorders';
dol_fiche_head($head, 'replenish', $title, 0, 'stock'); dol_fiche_head($head, 'replenish', $title, 0, 'stock');
if ($sref || $snom || $sall || GETPOST('search')) { if ($sref || $snom || $sall || GETPOST('search', 'alpha')) {
$filters = '&sref=' . $sref . '&snom=' . $snom; $filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&sall=' . $sall; $filters .= '&sall=' . $sall;
print_barre_liste($texte, print_barre_liste($texte,
@ -496,7 +496,7 @@ if ($resql) {
'</form>'; '</form>';
if ($num > $conf->liste_limit) { if ($num > $conf->liste_limit) {
if ($sref || $snom || $sall || GETPOST('search')) { if ($sref || $snom || $sall || GETPOST('search', 'alpha')) {
$filters = '&sref=' . $sref . '&snom=' . $snom; $filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&amp;sall=' . $sall; $filters .= '&amp;sall=' . $sall;
print_barre_liste('', print_barre_liste('',

View File

@ -53,16 +53,16 @@ dol_fiche_head($head,
0, 0,
'stock'); 'stock');
$commandestatic = new CommandeFournisseur($db); $commandestatic = new CommandeFournisseur($db);
$sref = GETPOST('search_ref'); $sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom'); $snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user'); $suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc'); $sttc = GETPOST('search_ttc', 'int');
$sall = GETPOST('search_all'); $sall = GETPOST('search_all', 'alpha');
$sdate = GETPOST('search_date'); $sdate = GETPOST('search_date', 'alpha');
$page = GETPOST('page', 'int'); $page = GETPOST('page', 'int');
$sortorder = GETPOST('sortorder'); $sortorder = GETPOST('sortorder', 'alpha');
$sortfield = GETPOST('sortfield'); $sortfield = GETPOST('sortfield', 'alpha');
if (!$sortorder) { if (!$sortorder) {
$sortorder = 'DESC'; $sortorder = 'DESC';
@ -109,10 +109,21 @@ if ($sttc) {
} }
if ($sdate) { if ($sdate) {
$elts = explode('/', $sdate); $elts = explode('/', $sdate);
$date = date('Y-m-d', $datearray = array();
mktime(0, 0, 0, $elts[1], $elts[0], $elts[2]) if($elts[2])
); {
$sql .= ' AND cf.date_creation LIKE "' . $date . '%"'; $datearray[0] = $elts[2];
}
if($elts[1])
{
$datearray[1] = $elts[1];
}
if($elts[0])
{
$datearray[2] = $elts[0];
}
$date = implode('-', $datearray);
$sql .= ' AND cf.date_creation LIKE "%' . $date . '%"';
} }
if ($sall) { if ($sall) {
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
@ -122,8 +133,8 @@ if ($socid) {
$sql .= ' AND s.rowid = ' . $socid; $sql .= ' AND s.rowid = ' . $socid;
} }
if (GETPOST('statut')) { if (GETPOST('statut', 'int')) {
$sql .= ' AND fk_statut = ' . GETPOST('statut'); $sql .= ' AND fk_statut = ' . GETPOST('statut', 'int');
} }
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' '; $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ';