2
0
forked from Wavyzz/dolibarr

NEW Can select number of lines on page list for projects and tasks

This commit is contained in:
Laurent Destailleur
2016-02-11 16:49:13 +01:00
parent 0d7f67ade5
commit e67be201ed
3 changed files with 25 additions and 24 deletions

View File

@@ -2970,7 +2970,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param string $morehtml More html to show * @param string $morehtml More html to show
* @param string $morecss More css to the table * @param string $morecss More css to the table
* @param int|string $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit). * @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
* @param int $hideselectlimit Force to hide select limit * @param int $hideselectlimit Force to hide select limit
* @return void * @return void
*/ */
@@ -2983,7 +2983,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
if ($picto == 'setup') $picto='title_setup.png'; if ($picto == 'setup') $picto='title_setup.png';
if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif'; if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif';
if ($limit < 0) $limit = $conf->liste_limit; if ($limit < 0) $limit = $conf->liste_limit;
if ($savlimit >= 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0)))
{ {
$nextpage = 1; $nextpage = 1;
} }
@@ -2991,6 +2991,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
{ {
$nextpage = 0; $nextpage = 0;
} }
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
print "\n"; print "\n";
print "<!-- Begin title '".$titre."' -->\n"; print "<!-- Begin title '".$titre."' -->\n";

View File

@@ -50,12 +50,12 @@ if ($socid > 0)
if (!$user->rights->projet->lire) accessforbidden(); if (!$user->rights->projet->lire) accessforbidden();
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield","alpha"); $sortfield = GETPOST("sortfield","alpha");
$sortorder = GETPOST("sortorder"); $sortorder = GETPOST("sortorder");
$page = GETPOST("page"); $page = GETPOST("page");
$page = is_numeric($page) ? $page : 0; $page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page; $page = $page == -1 ? 0 : $page;
if (! $sortfield) $sortfield="p.ref"; if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
$offset = $conf->liste_limit * $page ; $offset = $conf->liste_limit * $page ;
@@ -71,6 +71,7 @@ $search_all=GETPOST("search_all");
$search_status=GETPOST("search_status",'int'); $search_status=GETPOST("search_status",'int');
$search_opp_status=GETPOST("search_opp_status",'alpha'); $search_opp_status=GETPOST("search_opp_status",'alpha');
$search_opp_percent=GETPOST("search_opp_percent",'alpha'); $search_opp_percent=GETPOST("search_opp_percent",'alpha');
$search_opp_amount=GETPOST("search_opp_amount",'alpha');
$search_public=GETPOST("search_public",'int'); $search_public=GETPOST("search_public",'int');
$search_user=GETPOST('search_user','int'); $search_user=GETPOST('search_user','int');
$search_sale=GETPOST('search_sale','int'); $search_sale=GETPOST('search_sale','int');
@@ -88,16 +89,6 @@ $year = GETPOST('year','int');
if ($search_status == '') $search_status=-1; // -1 or 1 if ($search_status == '') $search_status=-1; // -1 or 1
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='p.ref';
if (! $sortorder) $sortorder='DESC';
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='projectlist'; $contextpage='projectlist';
@@ -160,6 +151,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_year=""; $search_year="";
$search_status=-1; $search_status=-1;
$search_opp_status=-1; $search_opp_status=-1;
$search_opp_amount='';
$search_opp_percent='';
$search_public=""; $search_public="";
$search_sale=""; $search_sale="";
$search_user=''; $search_user='';
@@ -237,6 +230,8 @@ if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$soc
if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_label) $sql .= natural_search('p.title', $search_label); if ($search_label) $sql .= natural_search('p.title', $search_label);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_opp_amount) $sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
if ($search_opp_percent) $sql .= natural_search('p.opp_percent', $search_opp_percent, 1);
if ($smonth > 0) if ($smonth > 0)
{ {
if ($syear > 0 && empty($sday)) if ($syear > 0 && empty($sday))
@@ -301,6 +296,7 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$param=''; $param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sday) $param.='&sday='.$day; if ($sday) $param.='&sday='.$day;
if ($smonth) $param.='&smonth='.$smonth; if ($smonth) $param.='&smonth='.$smonth;
if ($syear) $param.='&syear=' .$syear; if ($syear) $param.='&syear=' .$syear;
@@ -329,7 +325,6 @@ if ($resql)
$text=$langs->trans("Projects"); $text=$langs->trans("Projects");
if ($search_user == $user->id) $text=$langs->trans('MyProjects'); if ($search_user == $user->id) $text=$langs->trans('MyProjects');
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num,'','title_project');
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@@ -340,7 +335,9 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
// Show description of content print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
// Show description of content
if ($search_user == $user->id) print $langs->trans("MyProjectsDesc").'<br><br>'; if ($search_user == $user->id) print $langs->trans("MyProjectsDesc").'<br><br>';
else else
{ {
@@ -471,8 +468,9 @@ if ($resql)
} }
if (! empty($arrayfields['p.opp_amount']['checked'])) if (! empty($arrayfields['p.opp_amount']['checked']))
{ {
print '<td class="liste_titre nowrap">'; print '<td class="liste_titre nowrap right">';
print '</td>'; print '<input type="text" class="flat" name="search_opp_amount" size="3" value="'.$search_opp_amount.'">';
print '</td>';
} }
if (! empty($arrayfields['p.fk_opp_status']['checked'])) if (! empty($arrayfields['p.fk_opp_status']['checked']))
{ {
@@ -482,8 +480,9 @@ if ($resql)
} }
if (! empty($arrayfields['p.opp_percent']['checked'])) if (! empty($arrayfields['p.opp_percent']['checked']))
{ {
print '<td class="liste_titre nowrap">'; print '<td class="liste_titre nowrap right">';
print '</td>'; print '<input type="text" class="flat" name="search_opp_percent" size="2" value="'.$search_opp_percent.'">';
print '</td>';
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))

View File

@@ -74,10 +74,10 @@ $socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id; if ($user->societe_id > 0) $socid = $user->societe_id;
if (!$user->rights->projet->lire) accessforbidden(); if (!$user->rights->projet->lire) accessforbidden();
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
@@ -300,7 +300,8 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$param=''; $param='';
if ($sday) $param.='&sday='.$day; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sday) $param.='&sday='.$day;
if ($smonth) $param.='&smonth='.$smonth; if ($smonth) $param.='&smonth='.$smonth;
if ($syear) $param.='&syear=' .$syear; if ($syear) $param.='&syear=' .$syear;
if ($day) $param.='&day='.$day; if ($day) $param.='&day='.$day;
@@ -327,8 +328,6 @@ if ($resql)
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -338,6 +337,8 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
// Show description of content // Show description of content
if ($search_task_user == $user->id) print $langs->trans("MyTasksDesc").'<br><br>'; if ($search_task_user == $user->id) print $langs->trans("MyTasksDesc").'<br><br>';
else else