diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 78401267feb..a382568a81d 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -19,14 +19,13 @@
*
* $Id$
* $Source$
- *
*/
/**
- \file htdocs/fourn/commande/fiche.php
- \ingroup commande
- \brief Fiche commande
- \version $Revision$
+ \file htdocs/fourn/commande/fiche.php
+ \ingroup commande
+ \brief Fiche commande
+ \version $Revision$
*/
require("./pre.inc.php");
@@ -36,14 +35,13 @@ if (!$user->rights->fournisseur->commande->lire) accessforbidden();
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
-/*
- * Sécurité accés client
- */
+// Sécurité accés client
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
+
/*
*
*/
@@ -63,10 +61,6 @@ if ($_GET["action"] == 'pdf')
$commande->generate_pdf();
}
-/*
- *
- */
-
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
{
$commande = new CommandeFournisseur($db);
@@ -74,6 +68,7 @@ if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
$commande->set_remise($user, $_POST["remise"]);
}
+
/*
*
*/
@@ -100,7 +95,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->fournisseur->commande->cree
0,
$_POST["remise_percent"]);
}
- Header("Location: fiche.php?id=".$_GET["id"]);
+ Header("Location: fiche.php?id=".$_GET["id"]);
}
if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer)
@@ -206,6 +201,8 @@ if ($_GET["action"] == 'create')
}
}
+
+
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
$html = new Form($db);
@@ -319,7 +316,7 @@ if ($_GET["id"] > 0)
if ($commande->date_commande)
{
- print strftime("%A %d %B %Y",$commande->date_commande)."\n";
+ print dolibarr_print_date($commande->date_commande,"%A %d %B %Y")."\n";
}
print '
';
@@ -337,16 +334,16 @@ if ($_GET["id"] > 0)
// Ligne de 3 colonnes
print ' | | '.$langs->trans("AmountHT").' | ';
print ''.price($commande->total_ht).' | ';
- print ''.$langs->trans("Currency".$conf->monnaie).' | ';
- print ''.$langs->trans("VAT").' | '.price($commande->total_tva).' | ';
- print ''.$langs->trans("Currency".$conf->monnaie).' |
';
+ print ''.$langs->trans("Currency".$conf->monnaie).' | | ';
+ print '| '.$langs->trans("VAT").' | '.price($commande->total_tva).' | ';
+ print ''.$langs->trans("Currency".$conf->monnaie).' | |
';
print '| '.$langs->trans("TotalTTC").' | '.price($commande->total_ttc).' | ';
print ''.$langs->trans("Currency".$conf->monnaie).' | |
';
if ($commande->note)
{
- print '| Note | '.nl2br($commande->note)." |
";
+ print '| '.$langs->trans("Note").' | '.nl2br($commande->note)." |
";
}
print "";
@@ -355,7 +352,7 @@ if ($_GET["id"] > 0)
* Lignes de commandes
*
*/
- echo '
';
+ print '
';
$sql = "SELECT l.ref, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l ";
@@ -364,7 +361,7 @@ if ($_GET["id"] > 0)
$resql = $db->query($sql);
if ($resql)
{
- $num_lignes = $db->num_rows();
+ $num_lignes = $db->num_rows($resql);
$i = 0; $total = 0;
if ($num_lignes)
@@ -382,7 +379,7 @@ if ($_GET["id"] > 0)
$var=True;
while ($i < $num_lignes)
{
- $objp = $db->fetch_object();
+ $objp = $db->fetch_object($resql);
print "";
print "| ".$objp->ref." | \n";
if ($objp->fk_product > 0)
@@ -392,10 +389,10 @@ if ($_GET["id"] > 0)
}
else
{
- print "".stripslashes(nl2br($objp->description))." | \n";
+ print "".stripslashes(nl2br($objp->description))." | \n";
}
- print ''.$objp->tva_tx.' % | ';
- print ''.$objp->qty.' | ';
+ print ''.$objp->tva_tx.'% | ';
+ print ''.$objp->qty.' | ';
if ($objp->remise_percent > 0)
{
print ''.$objp->remise_percent." % | \n";
@@ -445,35 +442,35 @@ if ($_GET["id"] > 0)
* Ajouter une ligne
*
*/
- if ($_GET["action"] <> 'valid' && $commande->statut == 0 && $user->rights->fournisseur->commande->creer)
- {
- $sql = "SELECT p.rowid,p.label,p.ref ";
- $sql .=" , (pf.price / pf.quantity) as priceunit";
- $sql .= " FROM ".MAIN_DB_PREFIX."product as p ";
- $sql .= " , ".MAIN_DB_PREFIX."product_fournisseur_price as pf ";
- $sql .= " WHERE p.rowid = pf.fk_product AND pf.fk_soc = ".$commande->fourn_id;
- $sql .= " ORDER BY p.ref ";
- $resql = $db->query($sql);
- if ($resql)
- {
- $opt = '';
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num)
- {
- $objp = $db->fetch_object($resql);
- $opt .= "\n";
- $i++;
- }
- }
- $db->free($resql);
- }
- else
- {
- print $db->error();
- }
+ if ($_GET["action"] <> 'valid' && $commande->statut == 0 && $user->rights->fournisseur->commande->creer)
+ {
+ $sql = "SELECT p.rowid,p.label,p.ref ";
+ $sql .=" , (pf.price / pf.quantity) as priceunit";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product as p ";
+ $sql .= " , ".MAIN_DB_PREFIX."product_fournisseur_price as pf ";
+ $sql .= " WHERE p.rowid = pf.fk_product AND pf.fk_soc = ".$commande->fourn_id;
+ $sql .= " ORDER BY p.ref ";
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $opt = '';
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
+ $opt .= "\n";
+ $i++;
+ }
+ }
+ $db->free($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
print '";
}
+
print "
";
/*
* Fin Ajout ligne
@@ -549,38 +547,39 @@ if ($_GET["id"] > 0)
print "";
}
- print "\n";
- /*
- * Documents générés
- *
- */
- $file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
- $relativepath=$commande->ref . "/" . $commande->ref . ".pdf";
-
- $var=true;
-
- if (file_exists($file))
- {
- print_titre($langs->trans("Documents"));
- print '
';
-
- print "| ".$langs->trans("Order")." PDF | ";
- print ''.$commande->ref.'.pdf | ';
- print ''.filesize($file). ' bytes | ';
- print ''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).' | ';
- print '
';
-
- print "
\n";
- print '';
- }
+ /*
+ * Documents générés
+ *
+ */
+ $file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
+ $relativepath=$commande->ref . "/" . $commande->ref . ".pdf";
+
+ $var=true;
+
+ if (file_exists($file))
+ {
+ print_titre($langs->trans("Documents"));
+ print '';
+
+ print "| ".$langs->trans("Order")." PDF | ";
+ print ''.$commande->ref.'.pdf | ';
+ print ''.filesize($file). ' bytes | ';
+ print ''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).' | ';
+ print ' ';
+
+ print " \n";
+
+ print ' | ';
+ }
+
/*
*
*
*/
if ($_GET["action"] == 'classer')
{
- print ' |