From a126d1246b34ad3e15e39cec4f3a00e0f975ef54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jul 2009 16:28:10 +0000 Subject: [PATCH] Look: Some enhancements in look and themes --- htdocs/comm/prospect/prospects.php | 108 ++++++++++++++++------------- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index f216debe421..932bbcbda11 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -56,11 +56,11 @@ $search_level_to = isset($_GET["search_level_to"])?$_GET["search_level_to"]:(isS // If both parameters are set, search for everything BETWEEN them if ($search_level_from != '' && $search_level_to != '') -{ +{ // Ensure that these parameters are numbers $search_level_from = (int) $search_level_from; $search_level_to = (int) $search_level_to; - + // If from is greater than to, reverse orders if ($search_level_from > $search_level_to) { @@ -77,7 +77,7 @@ else if ($search_level_from != '') { // Ensure that this parameter is a number $search_level_from = (int) $search_level_from; - + // Generate the SQL request $sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range'; } @@ -86,7 +86,7 @@ else if ($search_level_to != '') { // Ensure that this parameter is a number $search_level_to = (int) $search_level_to; - + // Generate the SQL request $sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range'; } @@ -107,25 +107,25 @@ if ($resql) { $tab_level = array(); $search_levels = array(); - + while ($obj = $db->fetch_object($resql)) { // Compute level text $level=$langs->trans($obj->code); if ($level == $obj->code) $level=$langs->trans($obj->label); - + // Put it in the array sorted by sortorder $tab_level[$obj->sortorder] = $level; - + // If this potentiel fit in parameters, add its code to the $search_levels array if ($obj->is_in_range == 1) { $search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"'; } - + $i++; } - + // Implode the $search_levels array so that it can be use in a "IN (...)" where clause. // If no paramters was set, $search_levels will be empty $search_levels = implode(',', $search_levels); @@ -267,39 +267,41 @@ if ($resql) } // $param and $urladd should have the same value $urladd = $param; - + print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"], $param, $sortfield,$sortorder,'',$num,$nbtotalofrecords); - + // Print the search-by-sale and search-by-categ filters print '
'; - + + $moreforfilter=''; + // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { // Select each sales and print them in a select input - print $langs->trans('SalesRepresentatives'). ': '; - print ''; + $moreforfilter.=''; + $sql_usr = "SELECT u.rowid, u.name, u.firstname, u.login"; $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")"; $sql_usr.= " ORDER BY u.name ASC "; - + $resql_usr = $db->query($sql_usr); if ($resql_usr) { while ($obj_usr = $db->fetch_object($resql_usr)) - { - print ''; + $moreforfilter.=' selected="true"'; + + $moreforfilter.='>'; + $moreforfilter.=stripslashes($obj_usr->firstname)." ".stripslashes($obj_usr->name)." (".$obj_usr->login.')'; + $moreforfilter.=''; $i++; } $db->free($resql_usr); @@ -308,36 +310,36 @@ if ($resql) { dol_print_error($db); } - print '       '; + $moreforfilter.='       '; } - + // Include Categorie class if ($conf->categorie->enabled) { require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php"); - + // Load list of "categories" $static_categs = new Categorie($db); $tab_categs = $static_categs->get_full_arbo(2); - + // Print a select with each of them - print $langs->trans('Categories'). ': '; - print ''; + $moreforfilter.=''; + if (is_array($tab_categs)) { foreach ($tab_categs as $categ) { - print ''; + $moreforfilter.=' selected="true"'; + $moreforfilter.='>'.$categ['fulllabel'].''; } } - print '
'; + $moreforfilter.='
'; } - + print ''; print ''; print_liste_field_titre($langs->trans("Company"),"prospects.php","s.nom","",$param,"valign=\"center\"",$sortfield,$sortorder); @@ -361,40 +363,40 @@ if ($resql) print ''; - - // Added by Matelli (see http://matelli.fr/showcases/patchs-dolibarr/enhance-prospect-searching.html) - print ''; print ''; - + // Print the search button print '\n"; + print ''; + print ''; + + $i = 0; $var=true; @@ -453,9 +461,9 @@ if ($resql) if ($num > $conf->liste_limit || $page > 0) print_barre_liste('', $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print "
'; print ' '; print ''; + + // Added by Matelli (see http://matelli.fr/showcases/patchs-dolibarr/enhance-prospect-searching.html) + print ''; // Generate in $options_from the list of each option sorted $options_from = ''; foreach ($tab_level as $tab_level_sortorder => $tab_level_label) { $options_from .= ''; + $options_from .= ''; } - + // Reverse the list array_reverse($tab_level, true); - + // Generate in $options_to the list of each option sorted in the reversed order $options_to = ''; foreach ($tab_level as $tab_level_sortorder => $tab_level_label) { $options_to .= ''; + $options_to .= ''; } - + // Print these two select print $langs->trans("From").' '; - print ' '; + print ' '; print $langs->trans("To").' '; print ''; print ' '; print ''; print ''; @@ -402,6 +404,12 @@ if ($resql) print "
'; + print $moreforfilter; + print '
"; - + print "
"; - + $db->free($resql); } else