Add patch of Sbastien Wacquiez
This commit is contained in:
parent
cc72297f3f
commit
0587d06d88
@ -31,6 +31,8 @@ $langs->load("orders");
|
||||
|
||||
$sref=isset($_GET['search_ref'])?$_GET['search_ref']:$_POST['search_ref'];
|
||||
$snom=isset($_GET['search_nom'])?$_GET['search_nom']:$_POST['search_nom'];
|
||||
$suser=isset($_GET['search_user'])?$_GET['search_user']:$_POST['search_user'];
|
||||
$sttc=isset($_GET['search_ttc'])?$_GET['search_ttc']:$_POST['search_ttc'];
|
||||
$sall=isset($_GET['search_all'])?$_GET['search_all']:$_POST['search_all'];
|
||||
|
||||
$page = ( is_numeric($_GET["page"]) ? $_GET["page"] : 0 );
|
||||
@ -70,21 +72,31 @@ $offset = $conf->liste_limit * $page ;
|
||||
* Mode Liste
|
||||
*/
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom, ".$db->pdate("cf.date_commande")." as dc,";
|
||||
$sql.= " cf.rowid,cf.ref, cf.fk_statut";
|
||||
$sql = "SELECT s.rowid as socid, s.nom, ".$db->pdate("cf.date_commande")." as dc";
|
||||
$sql.= ", cf.rowid,cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author";
|
||||
$sql.= ", u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid";
|
||||
$sql.= " WHERE cf.fk_soc = s.rowid ";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($sref)
|
||||
{
|
||||
$sql.= " AND cf.ref like '%".addslashes($sref)."%'";
|
||||
$sql.= " AND cf.ref LIKE '%".addslashes($sref)."%'";
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql.= " AND s.nom like '%".addslashes($snom)."%'";
|
||||
$sql.= " AND s.nom LIKE '%".addslashes($snom)."%'";
|
||||
}
|
||||
if ($suser)
|
||||
{
|
||||
$sql.= " AND u.login LIKE '%".addslashes($suser)."%'";
|
||||
}
|
||||
if ($sttc)
|
||||
{
|
||||
$sql .= " AND ROUND(total_ttc) = ROUND(".price2num($sttc).")";
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
@ -113,6 +125,8 @@ if ($resql)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","","",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.login","","",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"total_ttc","","",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","","",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
@ -121,12 +135,16 @@ if ($resql)
|
||||
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_ref" value="'.$sref.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_nom" value="'.$snom.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_user" value="'.$suser.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_ttc" value="'.$sttc.'"></td>';
|
||||
print '<td colspan="2" class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
|
||||
$userstatic = new User($db);
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
@ -138,9 +156,20 @@ if ($resql)
|
||||
// Ref
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.'</a></td>'."\n";
|
||||
|
||||
// Soci<EFBFBD>t<EFBFBD>
|
||||
// Company
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' ';
|
||||
print $obj->nom.'</a></td>'."\n";
|
||||
|
||||
// Author
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
print "<td>";
|
||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||
else print " ";
|
||||
print "</td>";
|
||||
|
||||
// Amount
|
||||
print '<td align="right" width="100">'.price($obj->total_ttc)."</td>";
|
||||
|
||||
// Date
|
||||
print "<td align=\"center\" width=\"100\">";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user