diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 0895805e1ff..cca2a0c6c09 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -962,7 +962,7 @@ class Commande { $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET model_pdf = '$modelpdf'"; - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; + $sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;"; if ($this->db->query($sql) ) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index cf8f17aed1f..b04af32e253 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -321,6 +321,8 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post */ $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); + $commande = new Commande($db, 0, $_GET['id']); + $commande->set_pdf_model($user, $_POST['model']); $result=commande_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs); if ($result <= 0) {