Fix: Wrong W3C, error in filter.

This commit is contained in:
Laurent Destailleur 2010-07-22 18:49:58 +00:00
parent 5875630d2c
commit dbc4f53f7f
3 changed files with 47 additions and 44 deletions

View File

@ -1398,12 +1398,17 @@ class Propal extends CommonObject
/**
* \brief Renvoi la liste des propal (eventuellement filtree sur un user) dans un tableau
* \param draft 0=not draft, 1=draft
* \param notcurrentuser 0=current user, 1=not current user
* \return int -1 si erreur, tableau resultat si ok
* \brief Return list of proposal (eventually filtered on user) into an array
* \param shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref)
* \param draft 0=not draft, 1=draft
* \param notcurrentuser 0=current user, 1=not current user
* \param socid Id third pary
* \param limit For pagination
* \param offset For pagination
* \param sortfield Sort criteria
* \param sortorder Sort order
* \return int -1 if KO, array with result if OK
*/
function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC')
{
global $conf,$user;
@ -1419,14 +1424,13 @@ class Propal extends CommonObject
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($draft) $sql.= " AND p.fk_statut = 0";
if ($notcurrentuser) $sql.= " AND p.fk_user_author <> ".$user->id;
$sql.= " ORDER BY $sortfield $sortorder";
$sql.= $this->db->order($sortfield,$sortorder);
$sql.= $this->db->plimit($limit,$offset);
$result=$this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
if ($num)
{
$i = 0;
@ -1451,6 +1455,7 @@ class Propal extends CommonObject
}
else
{
dol_print_error($this->db);
return -1;
}
}

View File

@ -1663,38 +1663,29 @@ class Commande extends CommonObject
}
/**
* \brief Renvoi la liste des commandes (eventuellement filtree sur un user) dans un tableau
* \brief Return list of orders (eventuelly filtered on a user) into an array
* \param brouillon 0=non brouillon, 1=brouillon
* \param user Objet user de filtre
* \return int -1 si erreur, tableau resultat si ok
* \return int -1 if KO, array with result if OK
*/
function liste_array ($brouillon=0, $user='')
function liste_array($brouillon=0, $user='')
{
global $conf;
$ga = array();
$sql = "SELECT rowid, ref";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE entity = ".$conf->entity;
if ($brouillon)
{
$sql.= " AND fk_statut = 0";
if ($user) $sql.= " AND fk_user_author".$user;
}
else
{
if ($user) $sql.= " AND fk_user_author".$user;
}
$sql .= " ORDER BY date_commande DESC";
$sql = "SELECT s.nom, s.rowid, c.rowid, c.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
$sql.= " WHERE c.entity = ".$conf->entity;
$sql.= " AND c.fk_soc = s.rowid";
if ($brouillon) $sql.= " AND c.fk_statut = 0";
if ($user) $sql.= " AND c.fk_user_author <> ".$user->id;
$sql .= " ORDER BY c.date_commande DESC";
$result=$this->db->query($sql);
if ($result)
{
$numc = $this->db->num_rows($result);
if ($numc)
{
$i = 0;
@ -1710,6 +1701,7 @@ class Commande extends CommonObject
}
else
{
dol_print_error($this->db);
return -1;
}
}

View File

@ -829,10 +829,9 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
}
/**
*
* Fiche produit
*
* Product card
*/
if ($_GET["id"] || $_GET["ref"])
{
$product=new Product($db);
@ -1283,7 +1282,7 @@ if ($product->id && $_GET["action"] == '' && $product->status)
print '</tr>';
// Liste de "Mes propals"
print '<tr><td width="50%" valign="top">';
print '<tr><td'.($user->rights->societe->client->voir?' width="50%"':'').' valign="top">';
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.ref, p.datep as dp";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
@ -1309,8 +1308,8 @@ if ($product->id && $_GET["action"] == '' && $product->status)
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addinpropal">';
print "<tr $bc[$var]>";
print "<td nowrap>";
print "<tr ".$bc[$var].">";
print '<td nowrap="nowrap">';
print "<a href=\"../comm/propal.php?id=".$objp->propalid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a></td>\n";
print "<td><a href=\"../comm/fiche.php?socid=".$objp->socid."\">".dol_trunc($objp->nom,18)."</a></td>\n";
print "<td nowrap=\"nowrap\">".dol_print_date($objp->dp,"%d %b")."</td>\n";
@ -1400,7 +1399,7 @@ if ($product->id && $_GET["action"] == '' && $product->status)
print '</tr>';
// Liste de "Mes commandes"
print '<tr><td width="50%" valign="top">';
print '<tr><td'.($user->rights->societe->client->voir?' width="50%"':'').' valign="top">';
$sql = "SELECT s.nom, s.rowid as socid, c.rowid as commandeid, c.ref, c.date_commande as dc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
@ -1426,8 +1425,8 @@ if ($product->id && $_GET["action"] == '' && $product->status)
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addincommande">';
print "<tr $bc[$var]>";
print "<td nowrap>";
print "<tr ".$bc[$var].">";
print '<td nowrap="nowrap">';
print "<a href=\"../commande/fiche.php?id=".$objc->commandeid."\">".img_object($langs->trans("ShowOrder"),"order")." ".$objc->ref."</a></td>\n";
print "<td><a href=\"../comm/fiche.php?socid=".$objc->socid."\">".dol_trunc($objc->nom,18)."</a></td>\n";
print "<td nowrap=\"nowrap\">".dol_print_date($db->jdate($objc->dc),"%d %b")."</td>\n";
@ -1461,7 +1460,7 @@ if ($product->id && $_GET["action"] == '' && $product->status)
print '<td width="50%" valign="top">';
$var=true;
$othercom = $commande->liste_array(1, ' <> '.$user->id);
$othercom = $commande->liste_array(1, $user);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" width="100%">';
@ -1488,14 +1487,15 @@ if ($product->id && $_GET["action"] == '' && $product->status)
}
print '</table>';
print '</form>';
print '</td>';
}
print '</td>';
print '</tr>';
}
// Factures
if($conf->facture->enabled && $user->rights->facture->creer)
if ($conf->facture->enabled && $user->rights->facture->creer)
{
print '<tr class="liste_titre"><td width="50%" class="liste_titre">';
print $langs->trans("AddToMyBills").'</td>';
@ -1513,7 +1513,7 @@ if ($product->id && $_GET["action"] == '' && $product->status)
print '</tr>';
// Liste de Mes factures
print '<tr><td width="50%" valign="top">';
print '<tr><td'.($user->rights->societe->client->voir?' width="50%"':'').' valign="top">';
$sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
@ -1572,9 +1572,11 @@ if ($product->id && $_GET["action"] == '' && $product->status)
if ($user->rights->societe->client->voir)
{
$facture = new Facture($db);
print '<td width="50%" valign="top">';
// Liste de Autres factures
// Liste de Autres factures
$var=true;
$sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df";
@ -1591,7 +1593,8 @@ if ($product->id && $_GET["action"] == '' && $product->status)
$num = $db->num_rows($result);
$var=true;
print '<table class="nobordernopadding" width="100%">';
if ($num) {
if ($num)
{
$i = 0;
while ($i < $num)
{
@ -1601,7 +1604,7 @@ if ($product->id && $_GET["action"] == '' && $product->status)
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addinfacture">';
print "<tr $bc[$var]>";
print "<tr ".$bc[$var].">";
print "<td><a href=\"../compta/facture.php?facid=".$objp->factureid."\">$objp->facnumber</a></td>\n";
print "<td><a href=\"../comm/fiche.php?socid=".$objp->socid."\">".dol_trunc($objp->nom,24)."</a></td>\n";
print "<td colspan=\"2\">".$langs->trans("Qty");
@ -1617,7 +1620,8 @@ if ($product->id && $_GET["action"] == '' && $product->status)
$i++;
}
}
else {
else
{
print "<tr ".$bc[!$var]."><td>";
print $langs->trans("NoOtherDraftBills");
print '</td></tr>';
@ -1629,9 +1633,11 @@ if ($product->id && $_GET["action"] == '' && $product->status)
{
dol_print_error($db);
}
print '</td>';
}
print '</td></tr>';
print '</tr>';
}
print '</table>';