diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index f3de1a7cbe1bab65a175d5709e942e25fbb34ad3..ec1ea20248b4df96b7cf407f25b5fbfed5089c06 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -982,6 +982,8 @@ class FactureFournisseur extends Facture
 	{
 		global $user,$langs,$conf;
 
+		$now = dol_now();
+
 		// Charge tableau des produits prodids
 		$prodids = array();
 
@@ -1007,7 +1009,7 @@ class FactureFournisseur extends Facture
 		$this->ref = 'SPECIMEN';
 		$this->specimen=1;
 		$this->socid = 1;
-		$this->date = time();
+		$this->date = $now;
 		$this->date_lim_reglement=$this->date+3600*24*30;
 		$this->cond_reglement_code = 'RECEP';
 		$this->mode_reglement_code = 'CHQ';
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index c7b049134da3ffaa5028642476d6e22845a8fb61..b9fb99830cc6dce506844c93bf418a2ea08cf8b1 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -155,17 +155,32 @@ if($_GET['action'] == 'deletepaiement')
 
 if ($_POST['action'] == 'update' && ! $_POST['cancel'])
 {
-	$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
+    $error=0;
+
+	$date = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
 	$date_echeance = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
 
-	$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set ';
-	$sql .= " facnumber='".addslashes(trim($_POST['facnumber']))."'";
-	$sql .= ", libelle='".addslashes(trim($_POST['libelle']))."'";
-	$sql .= ", note='".$_POST['note']."'";
-	$sql .= ", datef = '".$db->idate($datefacture)."'";
-	$sql .= ", date_lim_reglement = '".$db->idate($date_echeance)."'";
-	$sql .= ' WHERE rowid = '.$_GET['facid'].' ;';
-	$result = $db->query($sql);
+	if (! $date)
+	{
+        $msg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEch"));
+        $error++;
+	}
+	if ($date_echeance && $date_echeance < $date)
+    {
+        $date_echeance = $date;
+    }
+
+    if (! $error)
+    {
+    	$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set ';
+    	$sql .= " facnumber='".$db->escape(trim($_POST['facnumber']))."'";
+    	$sql .= ", libelle='".$db->escape(trim($_POST['libelle']))."'";
+    	$sql .= ", note='".$db->escape($_POST['note'])."'";
+    	$sql .= ", datef = '".$db->idate($date)."'";
+    	$sql .= ", date_lim_reglement = '".$db->idate($date_echeance)."'";
+    	$sql .= ' WHERE rowid = '.$_GET['facid'].' ;';
+    	$result = $db->query($sql);
+    }
 }
 /*
  * Action creation
@@ -399,7 +414,7 @@ if ($_POST['action'] == 'classin')
 {
 	$facture = new FactureFournisseur($db,'',$_GET['facid']);
 	$facture->fetch($_GET['facid']);
-	$facture->setProject($_POST['projectid']);
+	$result=$facture->setProject($_POST['projectid']);
 }
 
 
@@ -1288,35 +1303,37 @@ else
 		}
 		print '</div>';
 
-
-		print '<table width="100%"><tr><td width="50%" valign="top">';
-		print '<a name="builddoc"></a>'; // ancre
-
-		/*
-		* Documents generes
-		*/
-
-		$facfournref=dol_sanitizeFileName($fac->ref);
-		$file=$conf->fournisseur->dir_output.'/facture/'. $facfournref .	'/'	. $facfournref . '.pdf';
-		$relativepath =	$facfournref.'/'.$facfournref.'.pdf';
-		$filedir = $conf->fournisseur->dir_output	. '/facture/' .	$facfournref;
-		$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
-		$genallowed=$user->rights->fournisseur->facture->creer;
-		$delallowed=$user->rights->fournisseur->facture->supprimer;
-
-		$somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$facture->modelpdf);
-
-		print '</td><td valign="top" width="50%">';
-		print '<br>';
-
-		// List of actions on element
-		/*
-		include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
-		$formactions=new FormActions($db);
-		$somethingshown=$formactions->showactions($fac,'invoice_supplier',$socid);
-		*/
-
-		print '</td></tr></table>';
+		if ($_GET['action'] != 'edit')
+		{
+    		print '<table width="100%"><tr><td width="50%" valign="top">';
+    		print '<a name="builddoc"></a>'; // ancre
+
+    		/*
+    		* Documents generes
+    		*/
+
+    		$facfournref=dol_sanitizeFileName($fac->ref);
+    		$file=$conf->fournisseur->dir_output.'/facture/'. $facfournref .	'/'	. $facfournref . '.pdf';
+    		$relativepath =	$facfournref.'/'.$facfournref.'.pdf';
+    		$filedir = $conf->fournisseur->dir_output	. '/facture/' .	$facfournref;
+    		$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
+    		$genallowed=$user->rights->fournisseur->facture->creer;
+    		$delallowed=$user->rights->fournisseur->facture->supprimer;
+
+    		$somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$facture->modelpdf);
+
+    		print '</td><td valign="top" width="50%">';
+    		print '<br>';
+
+    		// List of actions on element
+    		/*
+    		include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
+    		$formactions=new FormActions($db);
+    		$somethingshown=$formactions->showactions($fac,'invoice_supplier',$socid);
+    		*/
+
+    		print '</td></tr></table>';
+		}
 	}
 }
 
diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php
index bb2676279cd3018df83353d948cd8625be94814d..c64abdaad4389136bb5655b7d862fc2ab0f3bed0 100644
--- a/htdocs/includes/modules/facture/modules_facture.php
+++ b/htdocs/includes/modules/facture/modules_facture.php
@@ -152,7 +152,7 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs)
 	// Positionne modele sur le nom du modele a utiliser
 	if (! dol_strlen($modele))
 	{
-		if ($conf->global->FACTURE_ADDON_PDF)
+		if (! empty($conf->global->FACTURE_ADDON_PDF))
 		{
 			$modele = $conf->global->FACTURE_ADDON_PDF;
 		}
diff --git a/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php
index 41ebb1211f6efe913b28120d947c8961fb50192a..2fcdb811f8c4b03dbb0d6f4d49b877c6cdd78a1a 100755
--- a/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php
+++ b/htdocs/includes/modules/supplier_invoice/modules_facturefournisseur.php
@@ -80,8 +80,9 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs)
 		}
 		else
 		{
-			print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined");
-			return 0;
+		    $model = 'canelle';
+			//print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined");
+			//return 0;
 		}
 	}
 	// Charge le modele
diff --git a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php
index c84b53a6cd7038680ab03f61ffa2757b0315a2dc..2b615a59d177f7058ed17775cc4a261f1d9d1a3e 100755
--- a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -108,7 +108,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
 		$outputlangs->load("companies");
 		$outputlangs->load("bills");
 		$outputlangs->load("products");
-		
+
 		if ($conf->fournisseur->dir_output.'/facture')
 		{
 			$deja_regle = "";
@@ -614,10 +614,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
 
 		$posy+=6;
 		$pdf->SetXY(100,$posy);
-		if ($object->date_facture)
+		if ($object->date)
 		{
 			$pdf->SetTextColor(0,0,60);
-			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_facture,"day",false,$outputlangs,true), '', 'R');
+			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R');
 		}
 		else
 		{