diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php
index fec9175f6379d3d5b676aa406062a09494b94d49..de49c8e781edf4fe55637f25842ae691e768e79f 100644
--- a/htdocs/fichinter/contact.php
+++ b/htdocs/fichinter/contact.php
@@ -53,7 +53,8 @@ if ($action == 'addcontact' && $user->rights->ficheinter->creer)
 {
     if ($result > 0 && $id > 0)
     {
-  		$result = $object->add_contact(GETPOST('contactid','int'), GETPOST('type','int'), GETPOST('source','alpha'));
+    	$contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
+  		$result = $object->add_contact($contactid, GETPOST('type','int'), GETPOST('source','alpha'));
     }
 
 	if ($result >= 0)
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 0956980ce9cac7a9e7f2cb8c7f9af4455c6cf33f..22a0bdc4946de16461f696d7d055cca2df86f892 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -628,8 +628,9 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
 		$result = $object->fetch($id);
 
 		if ($result > 0 && $id > 0)
-		{
-			$result = $object->add_contact(GETPOST('contactid','int'), GETPOST('type','int'), GETPOST('source','alpha'));
+		{
+			$contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
+			$result = $object->add_contact($contactid, GETPOST('type','int'), GETPOST('source','alpha'));
 		}
 
 		if ($result >= 0)
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index 376697cfcadc2fba197942004fa96d4e7684b615..e6c876c23f6587775df9fd58ea19aef175efe1c1 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -92,7 +92,7 @@ if (empty($reshook))
     {
         $object->fetch($id);
     	$result = $object->setValueFrom('fk_product_type', $_POST['fk_product_type']);
-    	Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
+    	Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
     	exit;
     }
 
@@ -101,7 +101,7 @@ if (empty($reshook))
     {
     	$object->fetch($id);
     	$result = $object->setValueFrom('fk_barcode_type', $_POST['fk_barcode_type']);
-    	Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
+    	Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
     	exit;
     }
 
@@ -111,7 +111,7 @@ if (empty($reshook))
     	$object->fetch($id);
     	//Todo: ajout verification de la validite du code barre en fonction du type
     	$result = $object->setValueFrom('barcode', $_POST['barcode']);
-    	Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
+    	Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
     	exit;
     }
 
@@ -227,7 +227,7 @@ if (empty($reshook))
 
             if ($id > 0)
             {
-                Header("Location: fiche.php?id=".$id);
+                Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
                 exit;
             }
             else
@@ -374,7 +374,7 @@ if (empty($reshook))
 
         if ( ($object->type == 0 && $user->rights->produit->supprimer)	|| ($object->type == 1 && $user->rights->service->supprimer) )
         {
-            $result = $object->delete($id);
+            $result = $object->delete($object->id);
         }
 
         if ($result > 0)
@@ -677,7 +677,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
         $object = new Product($db);
         $object->fetch($id, $ref);                   // For use with "pure canvas" (canvas that contains templates only)
     }
-   	$objcanvas->assign_values($action, $id, $ref);	// Set value for templates
+   	$objcanvas->assign_values($action, $object->id, $ref);	// Set value for templates
     $objcanvas->display_canvas($action);				// Show template
 }
 else
@@ -1277,7 +1277,7 @@ if ($action == 'clone' || $conf->use_javascript_ajax)
     array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
     );
     // Paiement incomplet. On demande si motif = escompte ou autre
-    $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600);
+    $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600);
 }
 
 
@@ -1293,7 +1293,7 @@ if ($action == '' || $action == 'view')
 {
     if ($user->rights->produit->creer || $user->rights->service->creer)
     {
-        if ($object->no_button_edit <> 1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$id.'">'.$langs->trans("Modify").'</a>';
+        if ($object->no_button_edit <> 1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
 
         if ($object->no_button_copy <> 1)
         {
@@ -1303,12 +1303,12 @@ if ($action == '' || $action == 'view')
             }
             else
             {
-                print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&amp;id='.$id.'">'.$langs->trans("ToClone").'</a>';
+                print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&amp;id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
             }
         }
     }
 
-    $object_is_used = $object->isObjectUsed($id);
+    $object_is_used = $object->isObjectUsed($object->id);
     if (($object->type == 0 && $user->rights->produit->supprimer)
     || ($object->type == 1 && $user->rights->service->supprimer))
     {
@@ -1320,7 +1320,7 @@ if ($action == '' || $action == 'view')
             }
             else
             {
-                print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;id='.$id.'">'.$langs->trans("Delete").'</a>';
+                print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;id='.$object->id.'">'.$langs->trans("Delete").'</a>';
             }
         }
         else
@@ -1391,7 +1391,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
                 {
                     $objp = $db->fetch_object($result);
                     $var=!$var;
-                    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
+                    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
                     print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
                     print '<input type="hidden" name="action" value="addinpropal">';
                     print "<tr ".$bc[$var].">";
@@ -1429,7 +1429,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
 
             $var=true;
             $otherprop = $propal->liste_array(1,1,1);
-            print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
+            print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
             print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
             print '<table class="nobordernopadding" width="100%">';
             if (is_array($otherprop) && count($otherprop))
@@ -1508,7 +1508,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
                 {
                     $objc = $db->fetch_object($result);
                     $var=!$var;
-                    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
+                    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
                     print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
                     print '<input type="hidden" name="action" value="addincommande">';
                     print "<tr ".$bc[$var].">";
@@ -1547,7 +1547,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
 
             $var=true;
             $othercom = $commande->liste_array(1, $user);
-            print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
+            print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
             print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
             print '<table class="nobordernopadding" width="100%">';
             if (is_array($othercom) && count($othercom))
@@ -1622,7 +1622,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
                 {
                     $objp = $db->fetch_object($result);
                     $var=!$var;
-                    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
+                    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
                     print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
                     print '<input type="hidden" name="action" value="addinfacture">';
                     print "<tr $bc[$var]>";
@@ -1687,7 +1687,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
                         $objp = $db->fetch_object($result);
 
                         $var=!$var;
-                        print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
+                        print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
                         print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
                         print '<input type="hidden" name="action" value="addinfacture">';
                         print "<tr ".$bc[$var].">";
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index b31b2ccb32847131587218202eb72348a10f9cb9..a8ebfba5b168b1f1cc7b428437ddcd32e2c265c4 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -85,10 +85,10 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->s
 {
 	if ($object->fetch($id) >= 0 )
 	{
-		$result=$projecstatict->fetch($object->fk_projet);
-		if (! empty($projecstatic->socid))
+		$result=$projectstatic->fetch($object->fk_projet);
+		if (! empty($projectstatic->socid))
 		{
-			$projecstatic->societe->fetch($projecstatic->socid);
+			$projectstatic->societe->fetch($projectstatic->socid);
 		}
 
 		if ($object->delete($user) > 0)