diff --git a/ChangeLog b/ChangeLog
index e63d2f537b038fa41ad59542295a3254e692269b..dd57b6137b34674085c74f0cf563824e20c6a0be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@ For users:
 - Look enhancements for graphics (add transparency).
 - Added statistics report for supplier invoices
 - Added average amount in invoices statistics reports.
+- Can move a contract line to another contract of same third party.
 
 For translators:
 - The errors language file contains only error or warning messages with 
diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php
index 6290f6265c1877ef56fbf45ef0f1bbd5f8a82a86..92e7752c6b840d567a8dfd38a476689bbfea241c 100644
--- a/htdocs/contrat/contrat.class.php
+++ b/htdocs/contrat/contrat.class.php
@@ -1117,11 +1117,10 @@ class Contrat extends CommonObject
         }
     }
  
- 
-    /** 
-     *    \brief      R�cup�re les lignes de detail du contrat
-     *    \param      statut      Statut des lignes detail � r�cup�rer
-     *    \return     array       Tableau des lignes de details
+     /** 
+     *    \brief      Return list of line rowid
+     *    \param      statut      Status of lines to get
+     *    \return     array       Array of line's rowid
      */
     function array_detail($statut=-1)
     {
@@ -1132,6 +1131,7 @@ class Contrat extends CommonObject
         $sql.= " WHERE fk_contrat =".$this->id;
         if ($statut >= 0) $sql.= " AND statut = '$statut'";
    
+        dolibarr_syslog("Contrat::array_detail() sql=".$sql,LOG_DEBUG);
         $resql=$this->db->query($sql);
         if ($resql)
         {
@@ -1151,12 +1151,49 @@ class Contrat extends CommonObject
             return -1;
         }
     }
+    
+    /** 
+     *  	\brief      Return list of other contracts for same company than current contract
+     *		\param		option		'all' or 'others'
+     *  	\return     array   	Array of contracts id
+     */
+    function getListOfContracts($option='all')
+    {
+        $tab=array();
+        
+        $sql = "SELECT c.rowid, c.ref";
+        $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c";
+        $sql.= " WHERE fk_soc =".$this->socid;
+        if ($option == 'others') $sql.= " AND c.rowid != ".$this->id;
+
+        dolibarr_syslog("Contrat::getOtherContracts() sql=".$sql,LOG_DEBUG);
+        $resql=$this->db->query($sql);
+        if ($resql)
+        {
+            $num=$this->db->num_rows($resql);
+            $i=0;
+            while ($i < $num)
+            {
+                $obj = $this->db->fetch_object($resql);
+                $contrat=new Contrat($this->db);
+                $contrat->fetch($obj->rowid);
+                $tab[]=$contrat;
+                $i++;
+            }
+            return $tab;
+        }
+        else
+        {
+            $this->error=$this->db->error();
+            return -1;
+        }
+    }
 
 
     /**
      *      \brief      Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord
      *      \param      user        Objet user
-     *      \param      mode        "inactive" pour services � activer, "expired" pour services expir�s
+     *      \param      mode        "inactive" pour services a activer, "expired" pour services expires
      *      \return     int         <0 si ko, >0 si ok
      */
     function load_board($user,$mode)
@@ -1275,7 +1312,7 @@ class ContratLigne
 
 	/**
 	 *      \brief     Constructeur d'objets ligne de contrat
-	 *      \param     DB      handler d'acc�s base de donn�e
+	 *      \param     DB      Database access handler
 	 */
     function ContratLigne($DB)
     {
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 952f10fcc37c4cd5fd4510010a97e52882a3572b..da17170cc77bf0cf473cc2330e1163b427159fa5 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -131,10 +131,6 @@ if ($_POST["date_end_real_updatemonth"] && $_POST["date_end_real_updateday"] &&
     $date_end_real_update=dolibarr_mktime(12, 0 , 0, $_POST["date_end_real_updatemonth"], $_POST["date_end_real_updateday"], $_POST["date_end_real_updateyear"]);
 }
 
-
-/*
- * Actions
- */
 if ($_POST["action"] == 'add')
 {
     $datecontrat = dolibarr_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
@@ -391,6 +387,32 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
     }
 }
 
+if ($_POST["action"] == 'confirm_move' && $_POST["confirm"] == 'yes')
+{
+    if ($user->rights->contrat->creer)
+    {
+    	if ($_POST['newcid'] > 0)
+    	{
+    		$contractline = new ContratLigne($db);
+    		$result=$contractline->fetch($_GET["lineid"]);
+	        $contractline->fk_contrat = $_POST["newcid"];
+	        $result=$contractline->update($user,1);
+	        if ($result >= 0)
+			{
+				Header("Location: ".$_SERVER['PHP_SELF'].'?id='.$_GET['id']);
+				return;
+			}
+			else
+			{
+				$mesg='<div class="error">'.$contrat->error.'</div>';
+			}
+    	}
+		else
+		{
+			$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'</div>';
+		}
+    }
+}
 
 
 /*
@@ -716,7 +738,9 @@ else
 		$servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1);
 		$colorb='333333';
 
-        /*
+		$arrayothercontracts=$contrat->getListOfContracts('others');
+		
+		/*
          * Lignes de contrats
          */
 
@@ -734,7 +758,7 @@ else
 			// Area with common detail of line
 			print '<table class="noborder" width="100%">';
 
-			$sql = "SELECT cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty, cd.rowid,";
+			$sql = "SELECT cd.rowid, cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty,";
 			$sql.= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice,";
 			$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_debut, ".$db->pdate("cd.date_ouverture")." as date_debut_reelle,";
 			$sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin, ".$db->pdate("cd.date_cloture")." as date_fin_reelle,";
@@ -795,8 +819,17 @@ else
 					{
 						print '<td>&nbsp;</td>';
 					}
-					// Icon update et delete (statut contrat 0=brouillon,1=valid�,2=ferm�)
+					// Icon move, update et delete (statut contrat 0=brouillon,1=valid�,2=ferm�)
 					print '<td align="right" nowrap="nowrap">';
+					if (sizeof($arrayothercontracts) && $contrat->statut != 2  && $user->rights->contrat->creer)
+					{
+						print '<a href="fiche.php?id='.$id.'&amp;action=move&amp;rowid='.$objp->rowid.'">';
+						print img_picto($langs->trans("MoveToAnotherContract"),'uparrow');
+						print '</a>';
+					}
+					else {
+						print '&nbsp;';
+					}
 					if ($contrat->statut != 2  && $user->rights->contrat->creer)
 					{
 						print '<a href="fiche.php?id='.$id.'&amp;action=editline&amp;rowid='.$objp->rowid.'">';
@@ -824,11 +857,11 @@ else
 						print '<tr '.$bc[$var].'>';
 						print '<td colspan="6">';
 	
-						// Date pr�vues
+						// Date planned
 						print $langs->trans("DateStartPlanned").': ';
 						if ($objp->date_debut) {
 							print dolibarr_print_date($objp->date_debut);
-							// Warning si date prevu pass�e et pas en service
+							// Warning si date prevu passee et pas en service
 							if ($objp->statut == 0 && $objp->date_debut < time() - $conf->contrat->warning_delay) { print " ".img_warning($langs->trans("Late")); }
 						}
 						else print $langs->trans("Unknown");
@@ -904,6 +937,27 @@ else
 			print "</table>";
 
 
+			/*
+			 * Confirmation to move service toward another contract
+			 */
+			if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lignes[$cursorline-1]->id == $_GET["rowid"])
+			{
+				//print '<br />';
+				$arraycontractid=array();
+				foreach($arrayothercontracts as $contractcursor)
+				{
+					$arraycontractid[$contractcursor->id]=$contractcursor->ref;
+				}
+				//var_dump($arraycontractid);
+				// Cr�e un tableau formulaire
+				$formquestion=array(
+				'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
+				array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
+				
+				$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&amp;lineid=".$_GET["rowid"],$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
+				print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
+			}
+			
 			/*
 			 * Confirmation de la validation activation
 			 */
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index f26301b4c57be5228f1dbe1298dfae03570b4e97..384627e61bcaec8aabef1fb6c52c8770553dedaf 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -1960,7 +1960,6 @@ class Form
    *    \param  action      	action
    *	\param	formquestion	an array with forms complementary inputs
    */
-	 
   function form_confirm($page, $title, $question, $action, $formquestion='')
   {
     global $langs;
@@ -1987,7 +1986,9 @@ class Form
 	    	}
 	    	if ($input['type'] == 'select') 
 	    	{
-
+				print '<tr><td valign="top">';
+				print $this->select_array($input['name'],$input['values'],'',1);
+				print '</td></tr>';
 	    	}
 	    	if ($input['type'] == 'checkbox') 
 	    	{
@@ -2910,6 +2911,7 @@ class Form
     function select_array($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $optionType=0, $option='', $translate=0)
     {
         global $langs;
+        // \TODO Simplify optionType and option (only one should be necessary)
         if ($optionType == 1 && $option != '')
         {
         	print '<select class="flat" name="'.$htmlname.'" '.$option.'>';
@@ -2938,7 +2940,7 @@ class Form
             if ($key_in_label)
             {
             	$selectOptionValue = $key.' - '.($translate?$langs->trans($value):$value);
-              print $selectOptionValue;
+            	print $selectOptionValue;
             }
             else
             {
diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang
index 655b483aa8f1b2855c16b63354e01cc2f4659d7d..2100fcd330d138c6cd2dfdb44e85c2d91e4fca74 100644
--- a/htdocs/langs/en_US/contracts.lang
+++ b/htdocs/langs/en_US/contracts.lang
@@ -69,6 +69,9 @@ ServiceStatus=Status of service
 DraftContracts=Drafts contracts
 CloseRefusedBecauseOneServiceActive=Contract can't be closed as ther is at least one open service on it
 CloseAllContracts=Close all contracts
+MoveToAnotherContract=Move service into another contract.
+ConfirmMoveToAnotherContract=I choosed new target contract and confirm I want to move this service into this contract.
+ConfirmMoveToAnotherContractQuestion=Choose in which existing contract (of same third party), you want to move this service to ?
 ##### Types de contacts #####
 TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract
 TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up contract
diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang
index 7898f8bf5e9366d15d4544e9120cf9f974622bbd..4f0baa34707659eced8c401fdf7a863de8827f3c 100644
--- a/htdocs/langs/fr_FR/contracts.lang
+++ b/htdocs/langs/fr_FR/contracts.lang
@@ -69,6 +69,9 @@ ServiceStatus=Statut du service
 DraftContracts=Contrats brouillons
 CloseRefusedBecauseOneServiceActive=Fermeture du contrat impossible car il y a au moins un service actif
 CloseAllContracts=Tout cl�turer
+MoveToAnotherContract=D�placer le service vers un autre contrat de ce tiers.
+ConfirmMoveToAnotherContract=J'ai choisi le contrat cible et confirme le d�placement du service dans ce contrat.
+ConfirmMoveToAnotherContractQuestion=Choisissez vers quel autre contrat de ce m�me tiers, vous voulez d�placer ce service ?
 ##### Types de contacts #####
 TypeContact_contrat_internal_SALESREPSIGN=Commercial signataire du contrat
 TypeContact_contrat_internal_SALESREPFOLL=Commercial suivi du contrat