From 4e759b15fe33d16a52ca6f85808bcf7360bec7fe Mon Sep 17 00:00:00 2001
From: FHenry <florian.henry.mail@gmail.com>
Date: Wed, 11 Apr 2012 10:03:57 +0200
Subject: [PATCH] Correction Bug #358

---
 htdocs/commande/fiche.php | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index ef587e036a2..a741e19a2e8 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -464,7 +464,28 @@ else if ($action == 'setconditions' && $user->rights->commande->creer)
 {
     $object->fetch($id);
     $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
-    if ($result < 0) dol_print_error($db,$object->error);
+    if ($result < 0)
+    { 
+    	dol_print_error($db,$object->error);
+    }
+    else
+	{  
+		if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+        {
+        	// Define output language
+        	$outputlangs = $langs;
+        	$newlang=GETPOST('lang_id','alpha');
+        	if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+        	if (! empty($newlang))
+        	{
+        		$outputlangs = new Translate("",$conf);
+        		$outputlangs->setDefaultLang($newlang);
+        	}
+
+            $ret=$object->fetch($id);    // Reload to get new records
+            commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
+        }
+    } 
 }
 
 else if ($action == 'setremisepercent' && $user->rights->commande->creer)
-- 
GitLab