diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 0197a37c8c9..6f0be0181b3 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -513,7 +513,7 @@ else print ""; print ''.$langs->trans("Date").''; - print "".strftime("%A %e %B %Y",$commande->date)."\n"; + print "".dolibarr_print_date($commande->date,"%A %d %B %Y")."\n"; print ''; print $langs->trans("Author").' : '.$author->fullname.''; @@ -560,12 +560,14 @@ else echo '
'; $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; - $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as l WHERE l.fk_commande = ".$commande->id." ORDER BY l.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as l"; + $sql .= " WHERE l.fk_commande = ".$commande->id; + $sql .= " ORDER BY l.rowid"; $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; $total = 0; if ($num) @@ -582,7 +584,7 @@ else $var=True; while ($i < $num) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($result); print ""; if ($objp->fk_product > 0) { @@ -651,7 +653,8 @@ else { $sql = "SELECT p.rowid,p.label,p.ref,p.price FROM ".MAIN_DB_PREFIX."product as p "; $sql .= " WHERE envente = 1"; - $sql .= " ORDER BY p.nbvente DESC LIMIT 20"; + $sql .= " ORDER BY p.nbvente DESC"; + $sql .= " LIMIT 20"; if ( $db->query($sql) ) { $opt = ""; @@ -759,7 +762,7 @@ else $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); if ($num) { print_titre($langs->trans("Sendings")); @@ -770,11 +773,11 @@ else $var=True; while ($i < $num) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($result); $var=!$var; print ""; - print ''; - print "\n"; + print ''; + print "\n"; $i++; } print "
'.stripslashes($objp->ref).'".strftime("%d %B %Y",$objp->de)."
'.img_object($langs->trans("ShowSending"),"sending").' '.$objp->ref.'".dolibarr_print_date($objp->de)."
"; @@ -796,7 +799,7 @@ else $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); if ($num) { print_titre($langs->trans("Bills")); @@ -807,11 +810,11 @@ else $var=True; while ($i < $num) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($result); $var=!$var; print ""; - print ''.stripslashes($objp->facnumber).''; - print "".strftime("%d %B %Y",$objp->df)."\n"; + print ''.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.''; + print "".dolibarr_print_date($objp->df)."\n"; $i++; } print ""; diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 4b4062237cc..15dea4b94e4 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -133,7 +133,7 @@ if ($_GET["id"] > 0) print ""; print ''.$langs->trans("Date").''; - print "".strftime("%A %d %B %Y",$commande->date)."\n"; + print "".dolibarr_print_date($commande->date,"%A %d %B %Y")."\n"; print ''; @@ -167,7 +167,7 @@ if ($_GET["id"] > 0) $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; $total = 0; if ($num) @@ -184,7 +184,7 @@ if ($_GET["id"] > 0) $var=True; while ($i < $num) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($result); print ""; if ($objp->fk_product > 0) { @@ -212,7 +212,7 @@ if ($_GET["id"] > 0) $i++; $var=!$var; } - $db->free(); + $db->free($result); } else { @@ -220,6 +220,35 @@ if ($_GET["id"] > 0) } print ''; + /* + * + * + */ + print '
'; + + /* + * Barre d'actions + */ + + if (! $user->societe_id && ! $commande->facturee) + { + print "
\n"; + + if ($commande->statut > 0 && $user->rights->facture->creer) + { + print ''.$langs->trans("GenerateBill").''; + } + + if ($num_fac_asso) + { + if ($user->rights->commande->creer) + print ''.$langs->trans("ClassifyBilled").''; + } + print '
'; + } + + + /* * Documents générés * @@ -232,7 +261,7 @@ if ($_GET["id"] > 0) if (file_exists($file)) { print "
"; - print_titre("Documents"); + print_titre($langs->trans("Documents")); print ''; print ""; @@ -261,19 +290,15 @@ if ($_GET["id"] > 0) $num_fac_asso = $db->num_rows(); $i = 0; $total = 0; - if ($num_fac_asso > 0) + if ($num_fac_asso) { + $var=false; print "
"; - if ($num_fac_asso > 1) - { - print_titre("Factures associées"); - } - else - { - print_titre("Facture associée"); - } + + print_titre($langs->trans("Bills")); + print '
".$langs->trans("Order")." PDF
'; - print ''; + print "'; print ''; print "\n"; @@ -282,14 +307,14 @@ if ($_GET["id"] > 0) { $objp = $db->fetch_object(); $var=!$var; - print ""; - print '"; + print '\n"; - print "\n"; + print "\n"; if ($objp->fk_user_author <> $user->id) { $fuser = new User($db, $objp->fk_user_author); @@ -305,7 +330,7 @@ if ($_GET["id"] > 0) $total = $total + $objp->total; $i++; } - print "\n"; + print "\n"; print "
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Author").'
".$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Author").''.$langs->trans("Price").'
'.$objp->facnumber.''; + print "
'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.''; if ($objp->paye) { print " (payée)"; } print "".strftime("%d %B %Y",$objp->df)."".dolibarr_print_date($objp->df)."
".$langs->trans("TotalHT").": $total ".$conf->monnaie."
".$langs->trans("TotalHT").": $total ".$conf->monnaie."
"; } $db->free(); @@ -314,38 +339,12 @@ if ($_GET["id"] > 0) { dolibarr_print_error($db); } - /* - * - * - */ - print '
'; - - /* - * Barre d'actions - */ - - if (! $user->societe_id && ! $commande->facturee) - { - print "
\n"; - - if ($commande->statut > 0 && $user->rights->facture->creer) - { - print ''.$langs->trans("GenerateBill").''; - } - - if ($num_fac_asso) - { - if ($user->rights->commande->creer) - print ''.$langs->trans("ClassifyBilled").''; - } - print '
'; - } } else { - /* Commande non trouvée */ + // Commande non trouvée print "Commande inexistante ou accés refusé"; } }