diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index 54f714b68ef0ecb4dbfed0b92bf0cfd9a8b81e0b..8bf470024b9399ad99935f0f291d8e73a70efcdd 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -1891,7 +1891,7 @@ class Commande extends CommonObject
 	/**
 		\brief      Renvoie nom clicable (avec eventuellement le picto)
 		\param		withpicto		0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
-		\param		option			Sur quoi pointe le lien: 0,1,2,4,-1 fiche commande, 3 fiche compta commande
+		\param		option			Sur quoi pointe le lien: 0=fiche commande,3=fiche compta commande,4=fiche expedition commande
 		\return		string			Chaine avec URL
 	*/
 	function getNomUrl($withpicto=0,$option=0)
@@ -1902,6 +1902,7 @@ class Commande extends CommonObject
 		$urlOption='';
 		
 		if ($option == 3) $urlOption = '/compta';
+		if ($option == 4) $urlOption = '/expedition';
 		
 		$lien = '<a href="'.DOL_URL_ROOT.$urlOption.'/commande/fiche.php?id='.$this->id.'">';
 		$lienfin='</a>';
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index 90c987a569fc807e97c9557e6488798737e64f80..4aae735c9255b20799b4914fee30311199b454be 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -533,15 +533,22 @@ else
             print '<tr><td>';
             if ($conf->commande->enabled)
             {
+				$order=new Commande($db);
+				$order->fetch($expedition->$object->id);
             	print $langs->trans("RefOrder").'</td>';
-            	print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$expedition->$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$expedition->$object->ref;
+				print '<td colspan="3">';
+				print $order->getNomUrl(1,4);
+            	print "</td>\n";
             }
             else
             {
+				$propal=new Propal($db);
+				$propal->fetch($livraison->origin_id);
             	print $langs->trans("RefProposal").'</td>';
-            	print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/propal.php?propalid='.$expedition->$object->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$expedition->$object->ref;
+				print '<td colspan="3">';
+				print $propal->getNomUrl(1,'expedition');
+				print "</td>\n";
             }
-            print "</a></td>\n";
             print '</tr>';
 
             // Ref client
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index 5f2a9342064cbc4840b8769cc8c2b9662af108ce..21ee602b83ba2799d1af900f6aa6b053ed87327a 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -21,11 +21,11 @@
  */
 
 /**
-        \file       htdocs/livraison/fiche.php
-        \ingroup    livraison
-        \brief      Fiche descriptive d'un bon de livraison
-        \version    $Id$
-*/
+ \file       htdocs/livraison/fiche.php
+ \ingroup    livraison
+ \brief      Fiche descriptive d'un bon de livraison
+ \version    $Id$
+ */
 
 require("./pre.inc.php");
 require_once(DOL_DOCUMENT_ROOT."/livraison/mods/modules_livraison.php");
@@ -39,14 +39,14 @@ $langs->load("bills");
 $langs->load('deliveries');
 
 if (!$user->rights->expedition->livraison->lire)
-  accessforbidden();
+accessforbidden();
 
 
 // S�curit� acc�s client
-if ($user->societe_id > 0) 
+if ($user->societe_id > 0)
 {
-  $action = '';
-  $socid = $user->societe_id;
+	$action = '';
+	$socid = $user->societe_id;
 }
 
 
@@ -54,92 +54,92 @@ if ($user->societe_id > 0)
  * Actions
  */
 
-if ($_POST["action"] == 'add') 
+if ($_POST["action"] == 'add')
 {
-    $db->begin();
-    
-    // Creation de l'objet livraison
-    $livraison = new Livraison($db);
-    
-    $livraison->date_livraison   = time();
-    $livraison->note             = $_POST["note"];
-    $livraison->commande_id      = $_POST["commande_id"];
-    
-    if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
-    {
-    	$expedition->entrepot_id     = $_POST["entrepot_id"];
-    }
-    
-    // On boucle sur chaque ligne de commande pour compl�ter objet livraison
-    // avec qt� � livrer
-    $commande = new Commande($db);
-    $commande->fetch($livraison->commande_id);
-    $commande->fetch_lines();
-    for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++)
-    {
-        $qty = "qtyl".$i;
-        $idl = "idl".$i;
-        if ($_POST[$qty] > 0)
-        {
-            $livraison->addline($_POST[$idl],$_POST[$qty]);
-        }
-    }
-    
-    $ret=$livraison->create($user);
-    if ($ret > 0)
-    {
-        $db->commit();
-        Header("Location: fiche.php?id=".$livraison->id);
-        exit;
-    }
-    else
-    {
-        $db->rollback();
-        $mesg='<div class="error">'.$livraison->error.'</div>';
-        $_GET["commande_id"]=$_POST["commande_id"];
-        $_GET["action"]='create';
-    }
+	$db->begin();
+
+	// Creation de l'objet livraison
+	$livraison = new Livraison($db);
+
+	$livraison->date_livraison   = time();
+	$livraison->note             = $_POST["note"];
+	$livraison->commande_id      = $_POST["commande_id"];
+
+	if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
+	{
+		$expedition->entrepot_id     = $_POST["entrepot_id"];
+	}
+
+	// On boucle sur chaque ligne de commande pour compl�ter objet livraison
+	// avec qt� � livrer
+	$commande = new Commande($db);
+	$commande->fetch($livraison->commande_id);
+	$commande->fetch_lines();
+	for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++)
+	{
+		$qty = "qtyl".$i;
+		$idl = "idl".$i;
+		if ($_POST[$qty] > 0)
+		{
+			$livraison->addline($_POST[$idl],$_POST[$qty]);
+		}
+	}
+
+	$ret=$livraison->create($user);
+	if ($ret > 0)
+	{
+		$db->commit();
+		Header("Location: fiche.php?id=".$livraison->id);
+		exit;
+	}
+	else
+	{
+		$db->rollback();
+		$mesg='<div class="error">'.$livraison->error.'</div>';
+		$_GET["commande_id"]=$_POST["commande_id"];
+		$_GET["action"]='create';
+	}
 }
 
 if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes' && $user->rights->expedition->livraison->valider)
 {
-  $livraison = new Livraison($db);
-  $livraison->fetch($_GET["id"]);
-  $result = $livraison->valid($user);
-  //$livraison->PdfWrite();
+	$livraison = new Livraison($db);
+	$livraison->fetch($_GET["id"]);
+	$result = $livraison->valid($user);
+	//$livraison->PdfWrite();
 }
 
 if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
 {
-  if ($user->rights->expedition->livraison->supprimer ) 
-    {
-      $livraison = new Livraison($db);
-      $livraison->fetch($_GET["id"]);
-      $expedition_id = $_GET["expid"];
-      $livraison->delete();
-      if ($conf->expedition_bon->enabled)
-      {
-      	Header("Location: ".DOL_URL_ROOT.'/expedition/fiche.php?id='.$expedition_id);
-      }
-      else
-      {
-      	Header("Location: liste.php");
-      }
-    }
+	if ($user->rights->expedition->livraison->supprimer )
+	{
+		$livraison = new Livraison($db);
+		$livraison->fetch($_GET["id"]);
+		$expedition_id = $_GET["expid"];
+		$livraison->delete();
+		if ($conf->expedition_bon->enabled)
+		{
+			Header("Location: ".DOL_URL_ROOT.'/expedition/fiche.php?id='.$expedition_id);
+		}
+		else
+		{
+			Header("Location: liste.php");
+		}
+	}
 }
 
 /*
- * G�n�rer ou reg�n�rer le PDF
+ * Build document
  */
 if ($_REQUEST['action'] == 'builddoc')	// En get ou en post
 {
-        $delivery = new Livraison($db, 0, $_REQUEST['id']);
-        $delivery->fetch($_REQUEST['id']);
+	$delivery = new Livraison($db, 0, $_REQUEST['id']);
+	$delivery->fetch($_REQUEST['id']);
 
-        if ($_REQUEST['model'])
-        {
-                $delivery->setDocModel($user, $_REQUEST['model']);
-        }
+	if ($_REQUEST['model'])
+	{
+		$delivery->setDocModel($user, $_REQUEST['model']);
+	}
 
 	if ($_REQUEST['lang_id'])
 	{
@@ -147,16 +147,16 @@ if ($_REQUEST['action'] == 'builddoc')	// En get ou en post
 		$outputlangs->setDefaultLang($_REQUEST['lang_id']);
 	}
 	$result=delivery_order_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
-    if ($result <= 0)
-    {
-    	dolibarr_print_error($db,$result);
-        exit;
-    }    
+	if ($result <= 0)
+	{
+		dolibarr_print_error($db,$result);
+		exit;
+	}
 }
 
 
 /*
- *
+ *	View
  */
 
 llxHeader('',$langs->trans('Delivery'),'Livraison');
@@ -169,123 +169,123 @@ $formfile = new FormFile($db);
  * Mode creation
  *
  *********************************************************************/
-if ($_GET["action"] == 'create') 
+if ($_GET["action"] == 'create')
 {
-	
-  print_titre($langs->trans("CreateADeliveryOrder"));
-
-  if ($mesg)
-  {
-        print $mesg.'<br>';
-  }
-  
-  $commande = new Commande($db);
-  $commande->livraison_array();
-  
-  if ( $commande->fetch($_GET["commande_id"]))
-    {
-      $soc = new Societe($db);
-      $soc->fetch($commande->socid);
-      $author = new User($db);
-      $author->id = $commande->user_author_id;
-      $author->fetch();
-      
-      if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
-      {
-      	$entrepot = new Entrepot($db);
-      }
-      
-      /*
-       *   Commande
-       */
-      print '<form action="fiche.php" method="post">';
-      print '<input type="hidden" name="action" value="add">';
-      print '<input type="hidden" name="commande_id" value="'.$commande->id.'">';
-      if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
-      {
-      	print '<input type="hidden" name="entrepot_id" value="'.$_GET["entrepot_id"].'">';
-      }
-      print '<table class="border" width="100%">';
-      print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
-      print '<td width="30%"><b><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
-      
-      print '<td width="50%" colspan="2">';
-
-      print "</td></tr>";
-      
-      print "<tr><td>".$langs->trans("Date")."</td>";
-      print "<td>".dolibarr_print_date($commande->date,'dayhourtext')."</td>\n";
-      
-      print '<td>'.$langs->trans("Order").'</td><td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref.'</a>';
-      print "</td></tr>\n";
-      
-      print '<tr>';
-      
-      if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
-      {
-      	print '<td>'.$langs->trans("Warehouse").'</td>';
-      	print '<td>';
-      	$ents = $entrepot->list_array();
-      	print '<a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$_GET["entrepot_id"].'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].'</a>';
-      	print '</td>';
-      }
-
-      print "<td>".$langs->trans("Author")."</td><td>$author->fullname</td>\n";
-      
-      if ($commande->note)
+
+	print_titre($langs->trans("CreateADeliveryOrder"));
+
+	if ($mesg)
 	{
-	  print '<tr><td colspan="3">Note : '.nl2br($commande->note)."</td></tr>";
+		print $mesg.'<br>';
 	}
-      print "</table>";
-      
-      /*
-       * Lignes de commandes
-       *
-       */
-      echo '<br><table class="noborder" width="100%">';
-      
-      $lignes = $commande->fetch_lines(1);
-      
-      /* Lecture des livraisons d�j� effectu�es */
-      $commande->livraison_array();
-      
-      $num = sizeof($commande->lignes);
-      $i = 0;
-      
-      if ($num)
+
+	$commande = new Commande($db);
+	$commande->livraison_array();
+
+	if ( $commande->fetch($_GET["commande_id"]))
 	{
+		$soc = new Societe($db);
+		$soc->fetch($commande->socid);
+		$author = new User($db);
+		$author->id = $commande->user_author_id;
+		$author->fetch();
+
+		if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
+		{
+			$entrepot = new Entrepot($db);
+		}
+
+		/*
+		 *   Commande
+		 */
+		print '<form action="fiche.php" method="post">';
+		print '<input type="hidden" name="action" value="add">';
+		print '<input type="hidden" name="commande_id" value="'.$commande->id.'">';
+		if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
+		{
+			print '<input type="hidden" name="entrepot_id" value="'.$_GET["entrepot_id"].'">';
+		}
+		print '<table class="border" width="100%">';
+		print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
+		print '<td width="30%"><b><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
+
+		print '<td width="50%" colspan="2">';
+
+		print "</td></tr>";
+
+		print "<tr><td>".$langs->trans("Date")."</td>";
+		print "<td>".dolibarr_print_date($commande->date,'dayhourtext')."</td>\n";
+
+		print '<td>'.$langs->trans("Order").'</td><td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref.'</a>';
+		print "</td></tr>\n";
+
+		print '<tr>';
+
+		if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
+		{
+			print '<td>'.$langs->trans("Warehouse").'</td>';
+			print '<td>';
+			$ents = $entrepot->list_array();
+			print '<a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$_GET["entrepot_id"].'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].'</a>';
+			print '</td>';
+		}
+
+		print "<td>".$langs->trans("Author")."</td><td>$author->fullname</td>\n";
+
+		if ($commande->note)
+		{
+	  print '<tr><td colspan="3">Note : '.nl2br($commande->note)."</td></tr>";
+		}
+		print "</table>";
+
+		/*
+		 * Lignes de commandes
+		 *
+		 */
+		echo '<br><table class="noborder" width="100%">';
+
+		$lignes = $commande->fetch_lines(1);
+
+		/* Lecture des livraisons d�j� effectu�es */
+		$commande->livraison_array();
+
+		$num = sizeof($commande->lignes);
+		$i = 0;
+
+		if ($num)
+		{
 	  print '<tr class="liste_titre">';
 	  print '<td width="54%">'.$langs->trans("Description").'</td>';
 	  print '<td align="center">Quan. command�e</td>';
 	  print '<td align="center">Quan. livr�e</td>';
 	  print '<td align="center">Quan. � livrer</td>';
 	  if ($conf->stock->enabled)
-	    {
-	      print '<td width="12%" align="center">'.$langs->trans("Stock").'</td>';
-	    }
+	  {
+	  	print '<td width="12%" align="center">'.$langs->trans("Stock").'</td>';
+	  }
 	  print "</tr>\n";
-	}
-      $var=true;
-      while ($i < $num)
-	{
+		}
+		$var=true;
+		while ($i < $num)
+		{
 	  $ligne = $commande->lignes[$i];
 	  $var=!$var;
 	  print "<tr $bc[$var]>\n";
 	  if ($ligne->fk_product > 0)
-	    {      
-	      $product = new Product($db);
-	      $product->fetch($ligne->fk_product);
-	      
-	      print '<td>';
-	      print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
-	      if ($ligne->description) print nl2br($ligne->description);
-	      print '</td>';
-	    }
+	  {
+	  	$product = new Product($db);
+	  	$product->fetch($ligne->fk_product);
+	  	 
+	  	print '<td>';
+	  	print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
+	  	if ($ligne->description) print nl2br($ligne->description);
+	  	print '</td>';
+	  }
 	  else
-	    {
-	      print "<td>".nl2br($ligne->description)."</td>\n";
-	    }
-	  
+	  {
+	  	print "<td>".nl2br($ligne->description)."</td>\n";
+	  }
+	   
 	  print '<td align="center">'.$ligne->qty.'</td>';
 	  /*
 	   *
@@ -297,57 +297,57 @@ if ($_GET["action"] == 'create')
 
 	  $quantite_commandee = $ligne->qty;
 	  $quantite_a_livrer = $quantite_commandee - $quantite_livree;
-	      
-        if ($conf->stock->enabled)
-        {
-            $stock = $product->stock_entrepot[$_GET["entrepot_id"]];
-            $stock+=0;  // Convertit en num�rique
-            
-            // Quantit� � livrer
-            print '<td align="center">';
-            print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
-            print '<input name="qtyl'.$i.'" type="text" size="6" value="'.min($quantite_a_livrer, $stock).'">';
-            print '</td>';
-        
-            // Stock
-            if ($stock < $quantite_a_livrer)
-            {
-                print '<td align="center">'.$stock.' '.img_alerte().'</td>';
-            }
-            else
-            {
-                print '<td align="center">'.$stock.'</td>';
-            }
-        }
-        else
-        {
-            // Quantit� � livrer
-            print '<td align="center">';
-            print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
-            print '<input name="qtyl'.$i.'" type="text" size="6" value="'.$quantite_a_livrer.'">';
-            print '</td>';
-        }
+	   
+	  if ($conf->stock->enabled)
+	  {
+	  	$stock = $product->stock_entrepot[$_GET["entrepot_id"]];
+	  	$stock+=0;  // Convertit en num�rique
+
+	  	// Quantit� � livrer
+	  	print '<td align="center">';
+	  	print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
+	  	print '<input name="qtyl'.$i.'" type="text" size="6" value="'.min($quantite_a_livrer, $stock).'">';
+	  	print '</td>';
+
+	  	// Stock
+	  	if ($stock < $quantite_a_livrer)
+	  	{
+	  		print '<td align="center">'.$stock.' '.img_alerte().'</td>';
+	  	}
+	  	else
+	  	{
+	  		print '<td align="center">'.$stock.'</td>';
+	  	}
+	  }
+	  else
+	  {
+	  	// Quantit� � livrer
+	  	print '<td align="center">';
+	  	print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
+	  	print '<input name="qtyl'.$i.'" type="text" size="6" value="'.$quantite_a_livrer.'">';
+	  	print '</td>';
+	  }
 
 	  print "</tr>\n";
-	  
+	   
 	  $i++;
 	  $var=!$var;
-	}	      
-
-      /*
-       *
-       */
-
-      print '<tr><td align="center" colspan="4"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
-      print "</table>";
-      print '</form>';
-    } 
-  else 
-    {
-      dolibarr_print_error($db);
-    }
-} 
-else 
+		}
+
+		/*
+		 *
+		 */
+
+		print '<tr><td align="center" colspan="4"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
+		print "</table>";
+		print '</form>';
+	}
+	else
+	{
+		dolibarr_print_error($db);
+	}
+}
+else
 /* *************************************************************************** */
 /*                                                                             */
 /* Mode vue et edition                                                         */
@@ -355,284 +355,293 @@ else
 /* *************************************************************************** */
 {
 	if ($_GET["id"] > 0)
-  {
-  	$livraison = new Livraison($db);
-    $result = $livraison->fetch($_GET["id"]);
-  
-    if ($livraison->origin_id)
-    {
-    	$object = $livraison->origin;
-    	$livraison->fetch_object();
-    }
-
-    if ( $livraison->id > 0)
-    {
-    	$soc = new Societe($db);
-    	$soc->fetch($livraison->socid);
-    	
-    	$h=0;
-    	if ($conf->expedition_bon->enabled)
-    	{
-    		$head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$livraison->expedition_id;
-    		$head[$h][1] = $langs->trans("SendingCard");
-    		$h++;
-    	}
-    	
-    	$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$livraison->id;
-      $head[$h][1] = $langs->trans("DeliveryCard");
-      $hselected = $h;
-      $h++;
-      
-      dolibarr_fiche_head($head, $hselected, $langs->trans("Sending"));
-    
-      /*
-       * Confirmation de la suppression
-       *
-       */
-      if ($_GET["action"] == 'delete')
-      {
-      	$expedition_id = $_GET["expid"];
-      	$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&amp;expid='.$expedition_id,'Supprimer le bon de livraison','Etes-vous s�r de vouloir supprimer ce bon de livraison ?','confirm_delete');
-      	print '<br>';
-      }
-      
-      /*
-       * Confirmation de la validation
-       *
-       */
-      if ($_GET["action"] == 'valid')
-      {
-      	$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid');
-      	print '<br>';
-      }
-      
-      
-      /*
-       *   Livraison
-       */
-      print '<table class="border" width="100%">';
-    
-      // Ref
-      print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
-      print '<td colspan="3">'.$livraison->ref.'</td></tr>';
-    
-      // Client
-      print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
-      print '<td align="3">'.$soc->getNomUrl(1).'</td>';
-      print "</tr>";
-    
-      // Document origine
-      if ($conf->commande->enabled)
-      {
-      	print '<tr><td>'.$langs->trans("RefOrder").'</td>';
-      	print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$livraison->commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$livraison->commande->ref."</a></td>\n";
-      	print '</tr>';
-      }
-      else
-      {
-      	print '<tr><td>'.$langs->trans("RefProposal").'</td>';
-      	print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/expedition/propal.php?propalid='.$livraison->propal->id.'">'.img_object($langs->trans("ShowProposal"),'propal').' '.$livraison->propal->ref."</a></td>\n";
-      	print '</tr>';
-      }
-    
-      // Ref client
-      print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
-      print '<td colspan="3">'.$livraison->ref_client."</a></td>\n";
-      print '</tr>';
-      
-      // Date
-      print '<tr><td>'.$langs->trans("Date").'</td>';
-      print '<td colspan="3">'.dolibarr_print_date($livraison->date_creation,'dayhourtext')."</td>\n";
-      print '</tr>';
-      
-      // Statut
-      print '<tr><td>'.$langs->trans("Status").'</td>';
-      print '<td colspan="3">'.$livraison->getLibStatut(4)."</td>\n";
-      print '</tr>';
-      
-      if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
-      {
-      	// Entrepot
-        $entrepot = new Entrepot($db);
-        $entrepot->fetch($livraison->entrepot_id);
-        print '<tr><td width="20%">'.$langs->trans("Warehouse").'</td>';
-        print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td>';
-        print '</tr>';
-      }
-      
-      print "</table>\n";
-    
-      /*
-       * Lignes produits
-       */
-      print '<br><table class="noborder" width="100%">';
-            
-      $num_prod = sizeof($livraison->lignes);
-            
-      if ($num_prod)
-      {
-      	$i = 0;
-            	
-        print '<tr class="liste_titre">';
-        print '<td>'.$langs->trans("Products").'</td>';
-        print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
-        print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
-        print "</tr>\n";
-            	
-        $var=true;
-        while ($i < $num_prod)
-        {
-        	$var=!$var;
-          print "<tr $bc[$var]>";
-          if ($livraison->lignes[$i]->fk_product > 0)
-          {
-          	$product = new Product($db);
-            $product->fetch($livraison->lignes[$i]->fk_product);
-                	
-            print '<td>';
-            print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$livraison->lignes[$i]->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
-            if ($livraison->lignes[$i]->description) print '<br>'.$livraison->lignes[$i]->description;
-            print '</td>';
-          }
-          else
-          {
-          	print "<td>".$livraison->lignes[$i]->description."</td>\n";
-          }
-          
-          print '<td align="center">'.$livraison->lignes[$i]->qty_asked.'</td>';
-          print '<td align="center">'.$livraison->lignes[$i]->qty_shipped.'</td>';
-    
-          print "</tr>";
-    
-          $i++;
-        }
-      }
-      
-      print "</table>\n";
-    
-      print "\n</div>\n";
-    
-    
-      /*
-       *    Boutons actions
-       */
-    
-      if ($user->societe_id == 0)
-      {
-      	print '<div class="tabsAction">';
-      	
-      	if (! eregi('^(valid|delete)',$_REQUEST["action"]))
-      	{
-      		if ($livraison->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
-      		{
-      			print '<a class="butAction" href="fiche.php?id='.$livraison->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
-      		}
-      		
-      		if ($livraison->brouillon && $user->rights->expedition->livraison->supprimer)
-	        {
-	        	if ($conf->expedition_bon->enabled)
-	          {
-	          	print '<a class="butActionDelete" href="fiche.php?id='.$livraison->id.'&amp;expid='.$livraison->expedition_id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
-	          }
-	          else
-	          {
-	          	print '<a class="butActionDelete" href="fiche.php?id='.$livraison->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
-	          }
-	        }
-	      }
-	      
-	      print '</div>';
-	    }
-	    print "\n";    
-	    
-	    print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
-	    
-	    /*
-       * Documents g�n�r�s
-       */
-            
-      $livraisonref = sanitize_string($livraison->ref);
-      $filedir = $conf->livraison_bon->dir_output . '/' . $livraisonref;            
-      $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
-            
-      $genallowed=$user->rights->expedition->livraison->creer;
-      $delallowed=$user->rights->expedition->livraison->supprimer;
-      
-      $somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
-    
-      /*
-       * D�j� livre
-       */
-      $sql = "SELECT ld.fk_product, ld.description, ld.qty as qty_shipped, ld.fk_livraison as livraison_id";
-      $sql.= ", l.ref, ".$db->pdate("l.date_livraison")." as date_livraison";
-      $sql.= ", cd.rowid, cd.qty as qty_commande";
-      $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
-      $sql.= " , ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l";
-      $sql.= " WHERE l.rowid <> ".$livraison->id;
-      $sql.= " AND cd.rowid = ld.fk_origin_line";
-      $sql.= " AND ld.fk_livraison = l.rowid";
-      $sql.= " AND l.fk_statut > 0";
-      $sql.= " ORDER BY cd.fk_product";
-      
-      $resql = $db->query($sql);
-      if ($resql)
-      {
-      	$num = $db->num_rows($resql);
-      	$i = 0;
-      	
-      	if ($num)
-        {
-        	print '<br>';
-    
-          print_titre($langs->trans("OtherSendingsForSameOrder"));
-          print '<table class="liste" width="100%">';
-          print '<tr class="liste_titre">';
-          print '<td align="left">'.$langs->trans("Sending").'</td>';
-          print '<td>'.$langs->trans("Description").'</td>';
-          print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
-          print '<td align="center">'.$langs->trans("Date").'</td>';
-          print "</tr>\n";
-          
-          $var=True;
-          while ($i < $num)
-          {
-          	$var=!$var;
-            $objp = $db->fetch_object($resql);
-            print "<tr $bc[$var]>";
-            print '<td align="left"><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
-            if ($objp->fk_product > 0)
-            {
-            	$product = new Product($db);
-              $product->fetch($objp->fk_product);
-              
-              print '<td>';
-              print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
-              if ($objp->description) print nl2br($objp->description);
-              print '</td>';
-            }
-            else
-            {
-            	print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
-            }
-            print '<td align="center">'.$objp->qty_shipped.'</td>';
-            print '<td align="center">'.dolibarr_print_date($objp->date_livraison,"dayhour").'</td>';
-            print '</tr>';
-            $i++;
-          }
-          
-          print '</table>';
-        }
-        $db->free($resql);
-      }
-      else
-      {
-      	dolibarr_print_error($db);
-      }
-      
-      print '</td><td valign="top" width="50%">';
+	{
+		$livraison = new Livraison($db);
+		$result = $livraison->fetch($_GET["id"]);
+		$livraison->fetch_client();
+		
+		if ($livraison->origin_id)
+		{
+			$object = $livraison->origin;
+			$livraison->fetch_object();
+		}
+
+		if ( $livraison->id > 0)
+		{
+			$soc = new Societe($db);
+			$soc->fetch($livraison->socid);
+			 
+			$h=0;
+			if ($conf->expedition_bon->enabled)
+			{
+				$head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$livraison->expedition_id;
+				$head[$h][1] = $langs->trans("SendingCard");
+				$h++;
+			}
+			 
+			$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$livraison->id;
+			$head[$h][1] = $langs->trans("DeliveryCard");
+			$hselected = $h;
+			$h++;
+
+			dolibarr_fiche_head($head, $hselected, $langs->trans("Sending"));
+
+			/*
+			 * Confirmation de la suppression
+			 *
+			 */
+			if ($_GET["action"] == 'delete')
+			{
+				$expedition_id = $_GET["expid"];
+				$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&amp;expid='.$expedition_id,'Supprimer le bon de livraison','Etes-vous s�r de vouloir supprimer ce bon de livraison ?','confirm_delete');
+				print '<br>';
+			}
+
+			/*
+			 * Confirmation de la validation
+			 *
+			 */
+			if ($_GET["action"] == 'valid')
+			{
+				$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid');
+				print '<br>';
+			}
+
+
+			/*
+			 *   Livraison
+			 */
+			print '<table class="border" width="100%">';
+
+			// Ref
+			print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
+			print '<td colspan="3">'.$livraison->ref.'</td></tr>';
+
+			// Client
+			print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
+			print '<td align="3">'.$soc->getNomUrl(1).'</td>';
+			print "</tr>";
+
+			// Document origine
+			if ($conf->commande->enabled)
+			{
+				print '<tr><td>'.$langs->trans("RefOrder").'</td>';
+				$order=new Commande($db);
+				$order->fetch($livraison->origin_id);
+				print '<td colspan="3">';
+				print $order->getNomUrl(1,4);
+				print "</td>\n";
+				print '</tr>';
+			}
+			else
+			{
+				$propal=new Propal($db);
+				$propal->fetch($livraison->origin_id);
+				print '<tr><td>'.$langs->trans("RefProposal").'</td>';
+				print '<td colspan="3">';
+				print $propal->getNomUrl(1,'expedition');
+				print "</td>\n";
+				print '</tr>';
+			}
+
+			// Ref client
+			print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
+			print '<td colspan="3">'.$livraison->ref_client."</a></td>\n";
+			print '</tr>';
+
+			// Date
+			print '<tr><td>'.$langs->trans("Date").'</td>';
+			print '<td colspan="3">'.dolibarr_print_date($livraison->date_creation,'dayhourtext')."</td>\n";
+			print '</tr>';
+
+			// Statut
+			print '<tr><td>'.$langs->trans("Status").'</td>';
+			print '<td colspan="3">'.$livraison->getLibStatut(4)."</td>\n";
+			print '</tr>';
+
+			if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
+			{
+				// Entrepot
+				$entrepot = new Entrepot($db);
+				$entrepot->fetch($livraison->entrepot_id);
+				print '<tr><td width="20%">'.$langs->trans("Warehouse").'</td>';
+				print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td>';
+				print '</tr>';
+			}
+
+			print "</table>\n";
+
+			/*
+			 * Lignes produits
+			 */
+			print '<br><table class="noborder" width="100%">';
+
+			$num_prod = sizeof($livraison->lignes);
+
+			if ($num_prod)
+			{
+				$i = 0;
+				 
+				print '<tr class="liste_titre">';
+				print '<td>'.$langs->trans("Products").'</td>';
+				print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
+				print '<td align="center">'.$langs->trans("QtyReceived").'</td>';
+				print "</tr>\n";
+				 
+				$var=true;
+				while ($i < $num_prod)
+				{
+					$var=!$var;
+					print "<tr $bc[$var]>";
+					if ($livraison->lignes[$i]->fk_product > 0)
+					{
+						$product = new Product($db);
+						$product->fetch($livraison->lignes[$i]->fk_product);
+						 
+						print '<td>';
+						print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$livraison->lignes[$i]->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
+						if ($livraison->lignes[$i]->description) print '<br>'.$livraison->lignes[$i]->description;
+						print '</td>';
+					}
+					else
+					{
+						print "<td>".$livraison->lignes[$i]->description."</td>\n";
+					}
+
+					print '<td align="center">'.$livraison->lignes[$i]->qty_asked.'</td>';
+					print '<td align="center">'.$livraison->lignes[$i]->qty_shipped.'</td>';
+
+					print "</tr>";
+
+					$i++;
+				}
+			}
+
+			print "</table>\n";
+
+			print "\n</div>\n";
+
+
+			/*
+			 *    Boutons actions
+			 */
+
+			if ($user->societe_id == 0)
+			{
+				print '<div class="tabsAction">';
+				 
+				if (! eregi('^(valid|delete)',$_REQUEST["action"]))
+				{
+					if ($livraison->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0)
+					{
+						print '<a class="butAction" href="fiche.php?id='.$livraison->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
+					}
+
+					if ($livraison->brouillon && $user->rights->expedition->livraison->supprimer)
+					{
+						if ($conf->expedition_bon->enabled)
+						{
+							print '<a class="butActionDelete" href="fiche.php?id='.$livraison->id.'&amp;expid='.$livraison->expedition_id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
+						}
+						else
+						{
+							print '<a class="butActionDelete" href="fiche.php?id='.$livraison->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
+						}
+					}
+				}
+				 
+				print '</div>';
+			}
+			print "\n";
+			 
+			print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
+			 
+			/*
+			 * Documents g�n�r�s
+			 */
+
+			$livraisonref = sanitize_string($livraison->ref);
+			$filedir = $conf->livraison_bon->dir_output . '/' . $livraisonref;
+			$urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
+
+			$genallowed=$user->rights->expedition->livraison->creer;
+			$delallowed=$user->rights->expedition->livraison->supprimer;
+
+			$somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
+
+			/*
+			 * D�j� livre
+			 */
+			$sql = "SELECT ld.fk_product, ld.description, ld.qty as qty_shipped, ld.fk_livraison as livraison_id";
+			$sql.= ", l.ref, ".$db->pdate("l.date_livraison")." as date_livraison";
+			$sql.= ", cd.rowid, cd.qty as qty_commande";
+			$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
+			$sql.= " , ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l";
+			$sql.= " WHERE l.rowid <> ".$livraison->id;
+			$sql.= " AND cd.rowid = ld.fk_origin_line";
+			$sql.= " AND ld.fk_livraison = l.rowid";
+			$sql.= " AND l.fk_statut > 0";
+			$sql.= " ORDER BY cd.fk_product";
+
+			$resql = $db->query($sql);
+			if ($resql)
+			{
+				$num = $db->num_rows($resql);
+				$i = 0;
+				 
+				if ($num)
+				{
+					print '<br>';
+
+					print_titre($langs->trans("OtherSendingsForSameOrder"));
+					print '<table class="liste" width="100%">';
+					print '<tr class="liste_titre">';
+					print '<td align="left">'.$langs->trans("Sending").'</td>';
+					print '<td>'.$langs->trans("Description").'</td>';
+					print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
+					print '<td align="center">'.$langs->trans("Date").'</td>';
+					print "</tr>\n";
+
+					$var=True;
+					while ($i < $num)
+					{
+						$var=!$var;
+						$objp = $db->fetch_object($resql);
+						print "<tr $bc[$var]>";
+						print '<td align="left"><a href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
+						if ($objp->fk_product > 0)
+						{
+							$product = new Product($db);
+							$product->fetch($objp->fk_product);
+
+							print '<td>';
+							print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
+							if ($objp->description) print nl2br($objp->description);
+							print '</td>';
+						}
+						else
+						{
+							print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
+						}
+						print '<td align="center">'.$objp->qty_shipped.'</td>';
+						print '<td align="center">'.dolibarr_print_date($objp->date_livraison,"dayhour").'</td>';
+						print '</tr>';
+						$i++;
+					}
+
+					print '</table>';
+				}
+				$db->free($resql);
+			}
+			else
+			{
+				dolibarr_print_error($db);
+			}
+
+			print '</td><td valign="top" width="50%">';
 
 			// Rien � droite
-			
+				
 			print '</td></tr></table>';
 		}
 		else
@@ -642,10 +651,10 @@ else
 		}
 	}
 	else
-  {
-  	/* Expedition non trouv�e */
-  	print "Expedition inexistante ou acc�s refus�";
-  }
+	{
+		/* Expedition non trouv�e */
+		print "Expedition inexistante ou acc�s refus�";
+	}
 }
 
 $db->close();
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index 304ac86057179ab7d31a2c6ae0ff764eaa5dc4eb..1b941dff72b02a02b6de29d2878db503c1851188 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -1890,7 +1890,11 @@ class Propal extends CommonObject
         {
           $lien = '<a href="'.DOL_URL_ROOT.'/compta/propal.php?propalid='.$this->id. $get_params .'">';
         }
-		$lienfin='</a>';
+        if($option == 'expedition')
+        {
+          $lien = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?propalid='.$this->id. $get_params .'">';
+        }
+        $lienfin='</a>';
 		
 		$picto='order';
 		$label=$langs->trans("ShowPropal").': '.$this->ref;