From dbc4f53f7fb8b95f81f55c5d9f319ef7b20f391e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jul 2010 18:49:58 +0000 Subject: [PATCH] Fix: Wrong W3C, error in filter. --- htdocs/comm/propal/class/propal.class.php | 19 ++++++---- htdocs/commande/class/commande.class.php | 30 ++++++---------- htdocs/product/fiche.php | 42 +++++++++++++---------- 3 files changed, 47 insertions(+), 44 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 627dbb96aa0..24f7299ea16 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7f7c2994287..5bb94d3f604 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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; } } diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index bfb2d5ced3b..47f60fb8a80 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -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 ''; // Liste de "Mes propals" - print ''; + print '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 '
'; print ''; print ''; - print ""; - print ""; + print ""; + print ''; print "propalid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; print "socid."\">".dol_trunc($objp->nom,18)."\n"; print "".dol_print_date($objp->dp,"%d %b")."\n"; @@ -1400,7 +1399,7 @@ if ($product->id && $_GET["action"] == '' && $product->status) print ''; // Liste de "Mes commandes" - print ''; + print '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 ''; print ''; print ''; - print ""; - print ""; + print ""; + print ''; print "commandeid."\">".img_object($langs->trans("ShowOrder"),"order")." ".$objc->ref."\n"; print "socid."\">".dol_trunc($objc->nom,18)."\n"; print "".dol_print_date($db->jdate($objc->dc),"%d %b")."\n"; @@ -1461,7 +1460,7 @@ if ($product->id && $_GET["action"] == '' && $product->status) print ''; $var=true; - $othercom = $commande->liste_array(1, ' <> '.$user->id); + $othercom = $commande->liste_array(1, $user); print ''; print ''; print ''; @@ -1488,14 +1487,15 @@ if ($product->id && $_GET["action"] == '' && $product->status) } print '
'; print ''; + + print ''; } - print ''; print ''; } // Factures - if($conf->facture->enabled && $user->rights->facture->creer) + if ($conf->facture->enabled && $user->rights->facture->creer) { print ''; print $langs->trans("AddToMyBills").''; @@ -1513,7 +1513,7 @@ if ($product->id && $_GET["action"] == '' && $product->status) print ''; // Liste de Mes factures - print ''; + print '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 ''; - // 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 ''; - if ($num) { + if ($num) + { $i = 0; while ($i < $num) { @@ -1601,7 +1604,7 @@ if ($product->id && $_GET["action"] == '' && $product->status) print ''; print ''; print ''; - print ""; + print ""; print "\n"; print "\n"; print "'; @@ -1629,9 +1633,11 @@ if ($product->id && $_GET["action"] == '' && $product->status) { dol_print_error($db); } + + print ''; } - print ''; + print ''; } print '
factureid."\">$objp->facnumbersocid."\">".dol_trunc($objp->nom,24)."".$langs->trans("Qty"); @@ -1617,7 +1620,8 @@ if ($product->id && $_GET["action"] == '' && $product->status) $i++; } } - else { + else + { print "
"; print $langs->trans("NoOtherDraftBills"); print '
';