mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX Navigation in result
This commit is contained in:
parent
881eca9fe5
commit
9f3f477877
|
|
@ -42,16 +42,16 @@ $object = new Societe($db);
|
|||
if ($socid > 0) $object->fetch($socid);
|
||||
|
||||
// Sort & Order fields
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $conf->liste_limit * $page;
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='dateprint';
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
|
||||
// Search fields
|
||||
$sref=GETPOST("sref");
|
||||
|
|
@ -308,6 +308,10 @@ if ($month > 0) {
|
|||
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'";
|
||||
if ($sprod_fulldescr) $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%' OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%' OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%')";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$totalnboflines = $db->num_rows($resql);
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
|
|
@ -316,49 +320,57 @@ $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPO
|
|||
$button = '<input type="submit" class="button" name="button_third" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
$param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid."&type_element=".$type_element;
|
||||
|
||||
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
|
||||
|
||||
|
||||
if ($sql_select)
|
||||
{
|
||||
$resql=$db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
// Titles with sort buttons
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
// Filters
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre nowrap">'; // date
|
||||
print $formother->select_month($month?$month:-1,'month',1);
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("resetFilters")).'" title="'.dol_escape_htmltag($langs->trans("resetFilters")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($sql_select)
|
||||
{
|
||||
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param="&socid=".$socid."&type_element=".$type_element;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr);
|
||||
if ($sref) $param.= "&sref=".urlencode($sref);
|
||||
if ($month) $param.= "&month=".$month;
|
||||
if ($year) $param.= "&year=".$year;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit);
|
||||
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
// Titles with sort buttons
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
// Filters
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre nowrap">'; // date
|
||||
print $formother->select_month($month?$month:-1,'month',1);
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("resetFilters")).'" title="'.dol_escape_htmltag($langs->trans("resetFilters")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i = 0;
|
||||
while (($objp = $db->fetch_object($resql)) && $i < $conf->liste_limit )
|
||||
while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit))
|
||||
{
|
||||
$documentstatic->id=$objp->doc_id;
|
||||
$documentstatic->ref=$objp->doc_number;
|
||||
|
|
@ -532,20 +544,42 @@ if ($sql_select)
|
|||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
if ($num > $conf->liste_limit) {
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($num > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else if (empty($type_element) || $type_element == -1)
|
||||
{
|
||||
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
|
||||
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
// Titles with sort buttons
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[0].'><td colspan="5">'.$langs->trans("SelectElementAndClickRefresh").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else {
|
||||
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
|
||||
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
|
||||
print '<tr '.$bc[0].'><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</form>";
|
||||
|
||||
llxFooter();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user