diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index c5e63fc7457..1d306975533 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1573,6 +1573,22 @@ else
*/
if ($_GET['action'] == 'presend')
{
+ $orderref = sanitize_string($commande->ref);
+ $file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
+
+ // Construit PDF si non existant
+ if (! is_readable($file))
+ {
+ $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
+ $outputlangs->setDefaultLang($_REQUEST['lang_id']);
+ $result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['model'], $outputlangs);
+ if ($result <= 0)
+ {
+ dolibarr_print_error($db,$result);
+ exit;
+ }
+ }
+
print '
';
print_titre($langs->trans('SendOrderByMail'));
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 122c64eecf2..05336643551 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -56,15 +56,6 @@ if ($_POST["action"] == 'classin')
$commande->fetch($_GET["id"]);
$commande->classin($_POST["projetid"]);
}
-/*
- *
- */
-if ($_GET["action"] == 'pdf')
-{
- $commande = new CommandeFournisseur($db);
- $commande->fetch($_GET["id"]);
- $commande->generate_pdf();
-}
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
{
@@ -558,9 +549,9 @@ if ($_GET["id"] > 0)
if ($commande->statut == 2)
{
- if ($user->rights->fournisseur->commande->approuver)
+ if ($user->rights->fournisseur->commande->annuler)
{
- print ''.$langs->trans("RefuseOrder").'';
+ print ''.$langs->trans("CancelOrder").'';
}
}
@@ -631,7 +622,7 @@ if ($_GET["id"] > 0)
print '