Fix sort and switch page

This commit is contained in:
atm-ph 2018-10-12 23:29:35 +02:00
parent 23e4cd57f3
commit 7b17b453bf
2 changed files with 43 additions and 35 deletions

View File

@ -92,11 +92,15 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$sref="";
$snom="";
$sall="";
$tosell="";
$tobuy="";
$search_sale="";
$search_categ="";
$type="";
$catid='';
$toolowstock='';
$fourn_id='';
$sbarcode='';
}
@ -183,6 +187,20 @@ if ($resql)
}
$texte.=' ('.$langs->trans("Stocks").')';
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&sall=".$sall;
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_sale) $param.="&search_sale=".$search_sale;
if ($search_categ) $param.="&search_categ=".$search_categ;
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
if ($sbarcode) $param.="&sbarcode=".$sbarcode;
if ($catid) $param.="&catid=".$catid;
llxHeader("", $texte, $helpurl);
@ -193,14 +211,7 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($sref || $snom || $sall || GETPOST('search'))
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
else
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"").(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
if (! empty($catid))
{
@ -236,14 +247,6 @@ if ($resql)
print '</div>';
}
$param='';
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
$formProduct = new FormProduct($db);
$formProduct->loadWarehouses();
$warehouses_list = $formProduct->cache_warehouses;

View File

@ -89,6 +89,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$sref="";
$snom="";
$sall="";
$tosell="";
$tobuy="";
$search_sale="";
$search_categ="";
$type="";
@ -96,6 +98,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$toolowstock='';
$search_batch='';
$search_warehouse='';
$fourn_id='';
$sbarcode='';
}
@ -194,6 +198,24 @@ if ($resql)
}
$texte.=' ('.$langs->trans("StocksByLotSerial").')';
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&sall=".$sall;
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
if ($sbarcode) $param.="&sbarcode=".$sbarcode;
if ($search_warehouse) $param.="&search_warehouse=".$search_warehouse;
if ($catid) $param.="&catid=".$catid;
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
if ($search_sale) $param.="&search_sale=".$search_sale;
if ($search_categ) $param.="&search_categ=".$search_categ;
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
llxHeader("",$title,$helpurl,$texte);
@ -204,14 +226,8 @@ if ($resql)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($sref || $snom || $sall || GETPOST('search'))
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
else
{
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
}
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit);
if (! empty($catid))
{
@ -245,17 +261,6 @@ if ($resql)
}
$param='';
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';