Selaa lähdekoodia

Fix standardize 'createfromclone' param when cloning

Laurent Destailleur 6 vuotta sitten
vanhempi
commit
2bbaae88d6
40 muutettua tiedostoa jossa 84 lisäystä ja 60 poistoa
  1. 5 1
      htdocs/accountancy/class/bookkeeping.class.php
  2. 2 0
      htdocs/asset/class/asset.class.php
  3. 2 3
      htdocs/comm/action/class/actioncomm.class.php
  4. 1 3
      htdocs/comm/mailing/class/mailing.class.php
  5. 1 2
      htdocs/comm/propal/class/propal.class.php
  6. 1 2
      htdocs/commande/class/commande.class.php
  7. 1 2
      htdocs/compta/bank/class/bankcateg.class.php
  8. 1 4
      htdocs/compta/facture/class/facture.class.php
  9. 2 3
      htdocs/compta/facture/class/paymentterm.class.php
  10. 4 1
      htdocs/compta/sociales/class/cchargesociales.class.php
  11. 2 3
      htdocs/compta/sociales/class/paymentsocialcontribution.class.php
  12. 2 3
      htdocs/contrat/class/contrat.class.php
  13. 1 1
      htdocs/core/actions_addupdatedelete.inc.php
  14. 4 1
      htdocs/core/class/ctyperesource.class.php
  15. 2 0
      htdocs/core/class/emailsenderprofile.class.php
  16. 2 4
      htdocs/cron/class/cronjob.class.php
  17. 2 5
      htdocs/don/class/paymentdonation.class.php
  18. 3 0
      htdocs/ecm/class/ecmfiles.class.php
  19. 2 0
      htdocs/emailcollector/class/emailcollector.class.php
  20. 2 0
      htdocs/emailcollector/class/emailcollectoraction.class.php
  21. 2 0
      htdocs/emailcollector/class/emailcollectorfilter.class.php
  22. 1 2
      htdocs/expensereport/class/expensereport.class.php
  23. 2 5
      htdocs/expensereport/class/paymentexpensereport.class.php
  24. 1 2
      htdocs/fichinter/class/fichinter.class.php
  25. 1 2
      htdocs/fourn/class/fournisseur.commande.class.php
  26. 3 1
      htdocs/fourn/class/fournisseur.commande.dispatch.class.php
  27. 1 4
      htdocs/fourn/class/fournisseur.facture.class.php
  28. 2 0
      htdocs/modulebuilder/template/class/myobject.class.php
  29. 1 3
      htdocs/product/class/productbatch.class.php
  30. 2 2
      htdocs/product/class/productcustomerprice.class.php
  31. 3 1
      htdocs/product/class/propalmergepdfproduct.class.php
  32. 2 0
      htdocs/product/inventory/class/inventory.class.php
  33. 3 0
      htdocs/product/stock/class/productlot.class.php
  34. 3 0
      htdocs/product/stock/class/productstockentrepot.class.php
  35. 2 0
      htdocs/societe/class/companypaymentmode.class.php
  36. 2 0
      htdocs/societe/class/societeaccount.class.php
  37. 3 0
      htdocs/supplier_proposal/class/supplier_proposal.class.php
  38. 3 0
      htdocs/ticket/class/ticket.class.php
  39. 3 0
      htdocs/website/class/website.class.php
  40. 2 0
      htdocs/website/class/websitepage.class.php

+ 5 - 1
htdocs/accountancy/class/bookkeeping.class.php

@@ -1418,6 +1418,7 @@ class BookKeeping extends CommonObject
 		dol_syslog(__METHOD__, LOG_DEBUG);
 
 		global $user;
+
 		$error = 0;
 		$object = new BookKeeping($this->db);
 
@@ -1432,6 +1433,7 @@ class BookKeeping extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result = $object->create($user);
 
 		// Other options
@@ -1441,6 +1443,8 @@ class BookKeeping extends CommonObject
 			dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (! $error) {
 			$this->db->commit();
@@ -1449,7 +1453,7 @@ class BookKeeping extends CommonObject
 		} else {
 			$this->db->rollback();
 
-			return - 1;
+			return -1;
 		}
 	}
 

+ 2 - 0
htdocs/asset/class/asset.class.php

@@ -238,6 +238,8 @@ class Asset extends CommonObject
 			$this->errors = $object->errors;
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();

+ 2 - 3
htdocs/comm/action/class/actioncomm.class.php

@@ -490,8 +490,6 @@ class ActionComm extends CommonObject
     {
         global $db, $user, $langs, $conf, $hookmanager;
 
-        $this->context['createfromclone']='createfromclone';
-
         $error=0;
         $now=dol_now();
 
@@ -524,7 +522,8 @@ class ActionComm extends CommonObject
 		}
 
         // Create clone
-        $result=$this->create($fuser);
+		$this->context['createfromclone']='createfromclone';
+		$result=$this->create($fuser);
         if ($result < 0) $error++;
 
         if (! $error)

+ 1 - 3
htdocs/comm/mailing/class/mailing.class.php

@@ -279,8 +279,6 @@ class Mailing extends CommonObject
 
 		$object=new Mailing($this->db);
 
-		$object->context['createfromclone']='createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -314,6 +312,7 @@ class Mailing extends CommonObject
 		}
 
 		// Create clone
+		$object->context['createfromclone']='createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -345,7 +344,6 @@ class Mailing extends CommonObject
 				$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles ";
 				$sql.= " WHERE fk_mailing = ".$fromid;
 
-				dol_syslog(get_class($this)."::createFromClone", LOG_DEBUG);
 				$result=$this->db->query($sql);
 				if ($result)
 				{

+ 1 - 2
htdocs/comm/propal/class/propal.class.php

@@ -1222,8 +1222,6 @@ class Propal extends CommonObject
 
 		dol_include_once('/projet/class/project.class.php');
 
-		$this->context['createfromclone']='createfromclone';
-
 		$error=0;
 		$now=dol_now();
 
@@ -1284,6 +1282,7 @@ class Propal extends CommonObject
 		if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client	= '';
 
 		// Create clone
+		$this->context['createfromclone']='createfromclone';
 		$result=$clonedObj->create($user);
 		if ($result < 0) $error++;
 		else

+ 1 - 2
htdocs/commande/class/commande.class.php

@@ -1066,8 +1066,6 @@ class Commande extends CommonOrder
 
 		$error=0;
 
-		$this->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// get lines so they will be clone
@@ -1108,6 +1106,7 @@ class Commande extends CommonOrder
 			$this->ref_client         = '';
 
 			// Create clone
+			$this->context['createfromclone'] = 'createfromclone';
 			$result=$this->create($user);
 			if ($result < 0) $error++;
 

+ 1 - 2
htdocs/compta/bank/class/bankcateg.class.php

@@ -280,8 +280,6 @@ class BankCateg // extends CommonObject
 
 		$object = new BankCateg($this->db);
 
-		$object->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -290,6 +288,7 @@ class BankCateg // extends CommonObject
 		$object->statut = 0;
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result = $object->create($user);
 
 		// Other options

+ 1 - 4
htdocs/compta/facture/class/facture.class.php

@@ -951,8 +951,6 @@ class Facture extends CommonInvoice
 
 		$error=0;
 
-		$this->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// get extrafields so they will be clone
@@ -962,8 +960,6 @@ class Facture extends CommonInvoice
 		// Load source object
 		$objFrom = clone $this;
 
-
-
 		// Change socid if needed
 		if (! empty($socid) && $socid != $this->socid)
 		{
@@ -1008,6 +1004,7 @@ class Facture extends CommonInvoice
 		}
 
 		// Create clone
+		$this->context['createfromclone'] = 'createfromclone';
 		$result=$this->create($user);
 		if ($result < 0) $error++;
 		else {

+ 2 - 3
htdocs/compta/facture/class/paymentterm.class.php

@@ -404,8 +404,6 @@ class PaymentTerm // extends CommonObject
 
 		$object=new PaymentTerm($this->db);
 
-		$object->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -417,6 +415,7 @@ class PaymentTerm // extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -430,7 +429,7 @@ class PaymentTerm // extends CommonObject
 		//{
 		//}
 
-		unset($this->context['createfromclone']);
+		unset($object->context['createfromclone']);
 
 		// End
 		if (! $error)

+ 4 - 1
htdocs/compta/sociales/class/cchargesociales.class.php

@@ -369,6 +369,7 @@ class Cchargesociales
 		// ...
 
 		// Create clone
+		$this->context['createfromclone'] = 'createfromclone';
 		$result = $object->create($user);
 
 		// Other options
@@ -378,6 +379,8 @@ class Cchargesociales
 			dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
 		}
 
+		unset($this->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();
@@ -386,7 +389,7 @@ class Cchargesociales
 		} else {
 			$this->db->rollback();
 
-			return - 1;
+			return -1;
 		}
 	}
 

+ 2 - 3
htdocs/compta/sociales/class/paymentsocialcontribution.class.php

@@ -459,8 +459,6 @@ class PaymentSocialContribution extends CommonObject
 
 		$object=new PaymentSocialContribution($this->db);
 
-		$object->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -472,6 +470,7 @@ class PaymentSocialContribution extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -488,7 +487,7 @@ class PaymentSocialContribution extends CommonObject
 
 		}
 
-		unset($this->context['createfromclone']);
+		unset($object->context['createfromclone']);
 
 		// End
 		if (! $error)

+ 2 - 3
htdocs/contrat/class/contrat.class.php

@@ -2388,8 +2388,6 @@ class Contrat extends CommonObject
 
 		dol_include_once('/projet/class/project.class.php');
 
-		$this->context['createfromclone'] = 'createfromclone';
-
 		$error = 0;
 
 		$this->fetch($this->id);
@@ -2440,6 +2438,7 @@ class Contrat extends CommonObject
 		}
 
 		// Create clone
+		$clonedObj->context['createfromclone'] = 'createfromclone';
 		$result = $clonedObj->create($user);
 		if ($result < 0) {
 			$error ++;
@@ -2479,7 +2478,7 @@ class Contrat extends CommonObject
 			}
 		}
 
-		unset($this->context['createfromclone']);
+		unset($clonedObj->context['createfromclone']);
 
 		// End
 		if (! $error) {

+ 1 - 1
htdocs/core/actions_addupdatedelete.inc.php

@@ -202,7 +202,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd)
 	{
 		if ($object->id > 0)
 		{
-			// Because createFromClone modifies the object, we must clone it so that we can restore it later
+			// Because createFromClone modifies the object, we must clone it so that we can restore it later if error
 			$orig = clone $object;
 
 			$result=$object->createFromClone($user, $object->id);

+ 4 - 1
htdocs/core/class/ctyperesource.class.php

@@ -427,6 +427,7 @@ class Ctyperesource
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result = $object->create($user);
 
 		// Other options
@@ -436,6 +437,8 @@ class Ctyperesource
 			dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();
@@ -444,7 +447,7 @@ class Ctyperesource
 		} else {
 			$this->db->rollback();
 
-			return - 1;
+			return -1;
 		}
 	}
 

+ 2 - 0
htdocs/core/class/emailsenderprofile.class.php

@@ -207,6 +207,8 @@ class EmailSenderProfile extends CommonObject
 			$this->errors = $object->errors;
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();

+ 2 - 4
htdocs/cron/class/cronjob.class.php

@@ -757,8 +757,6 @@ class Cronjob extends CommonObject
 
 		$object=new Cronjob($this->db);
 
-		$object->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -770,6 +768,7 @@ class Cronjob extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -782,10 +781,9 @@ class Cronjob extends CommonObject
 		//if (! $error)
 		//{
 
-
 		//}
 
-		unset($this->context['createfromclone']);
+		unset($object->context['createfromclone']);
 
 		// End
 		if (! $error)

+ 2 - 5
htdocs/don/class/paymentdonation.class.php

@@ -419,8 +419,6 @@ class PaymentDonation extends CommonObject
 
 		$object=new PaymentDonation($this->db);
 
-		$object->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -432,6 +430,7 @@ class PaymentDonation extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -444,11 +443,9 @@ class PaymentDonation extends CommonObject
 		if (! $error)
 		{
 
-
-
 		}
 
-		unset($this->context['createfromclone']);
+		unset($object->context['createfromclone']);
 
 		// End
 		if (! $error)

+ 3 - 0
htdocs/ecm/class/ecmfiles.class.php

@@ -732,6 +732,7 @@ class EcmFiles extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result = $object->create($user);
 
 		// Other options
@@ -741,6 +742,8 @@ class EcmFiles extends CommonObject
 			dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();

+ 2 - 0
htdocs/emailcollector/class/emailcollector.class.php

@@ -274,6 +274,8 @@ class EmailCollector extends CommonObject
             $this->errors = $object->errors;
         }
 
+        unset($object->context['createfromclone']);
+
         // End
         if (!$error) {
             $this->db->commit();

+ 2 - 0
htdocs/emailcollector/class/emailcollectoraction.class.php

@@ -247,6 +247,8 @@ class EmailCollectorAction extends CommonObject
 	        $this->errors = $object->errors;
 	    }
 
+	    unset($object->context['createfromclone']);
+
 	    // End
 	    if (!$error) {
 	        $this->db->commit();

+ 2 - 0
htdocs/emailcollector/class/emailcollectorfilter.class.php

@@ -222,6 +222,8 @@ class EmailCollectorFilter extends CommonObject
 	        $this->errors = $object->errors;
 	    }
 
+	    unset($object->context['createfromclone']);
+
 	    // End
 	    if (!$error) {
 	        $this->db->commit();

+ 1 - 2
htdocs/expensereport/class/expensereport.class.php

@@ -315,8 +315,6 @@ class ExpenseReport extends CommonObject
 
         if (empty($fk_user_author)) $fk_user_author = $user->id;
 
-        $this->context['createfromclone'] = 'createfromclone';
-
         $this->db->begin();
 
         // get extrafields so they will be clone
@@ -339,6 +337,7 @@ class ExpenseReport extends CommonObject
         $this->date_validation    = '';
 
         // Create clone
+        $this->context['createfromclone'] = 'createfromclone';
         $result=$this->create($user);
         if ($result < 0) $error++;
 

+ 2 - 5
htdocs/expensereport/class/paymentexpensereport.class.php

@@ -421,8 +421,6 @@ class PaymentExpenseReport extends CommonObject
 
 		$object=new PaymentExpenseReport($this->db);
 
-		$object->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -434,6 +432,7 @@ class PaymentExpenseReport extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -446,11 +445,9 @@ class PaymentExpenseReport extends CommonObject
 		if (! $error)
 		{
 
-
-
 		}
 
-		unset($this->context['createfromclone']);
+		unset($object->context['createfromclone']);
 
 		// End
 		if (! $error)

+ 1 - 2
htdocs/fichinter/class/fichinter.class.php

@@ -1118,8 +1118,6 @@ class Fichinter extends CommonObject
 
 		$error=0;
 
-		$this->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// get extrafields so they will be clone
@@ -1158,6 +1156,7 @@ class Fichinter extends CommonObject
 		$this->ref_client         = '';
 
 		// Create clone
+		$this->context['createfromclone'] = 'createfromclone';
 		$result=$this->create($user);
 		if ($result < 0) $error++;
 

+ 1 - 2
htdocs/fourn/class/fournisseur.commande.class.php

@@ -1417,8 +1417,6 @@ class CommandeFournisseur extends CommonOrder
 
         $error=0;
 
-		$this->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -1439,6 +1437,7 @@ class CommandeFournisseur extends CommonOrder
         $this->date_approve2      = '';
 
         // Create clone
+        $this->context['createfromclone'] = 'createfromclone';
         $result=$this->create($user);
         if ($result < 0) $error++;
 

+ 3 - 1
htdocs/fourn/class/fournisseur.commande.dispatch.class.php

@@ -463,6 +463,7 @@ class CommandeFournisseurDispatch extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -475,9 +476,10 @@ class CommandeFournisseurDispatch extends CommonObject
 		if (! $error)
 		{
 
-
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (! $error)
 		{

+ 1 - 4
htdocs/fourn/class/fournisseur.facture.class.php

@@ -2489,8 +2489,6 @@ class FactureFournisseur extends CommonInvoice
 
         $object=new FactureFournisseur($this->db);
 
-		$object->context['createfromclone'] = 'createfromclone';
-
 		$this->db->begin();
 
         // Load source object
@@ -2521,6 +2519,7 @@ class FactureFournisseur extends CommonInvoice
         }
 
         // Create clone
+        $object->context['createfromclone'] = 'createfromclone';
         $result=$object->create($user);
 
         // Other options
@@ -2533,8 +2532,6 @@ class FactureFournisseur extends CommonInvoice
         if (! $error)
         {
 
-
-
         }
 
         unset($object->context['createfromclone']);

+ 2 - 0
htdocs/modulebuilder/template/class/myobject.class.php

@@ -276,6 +276,8 @@ class MyObject extends CommonObject
 	        $this->errors = $object->errors;
 	    }
 
+	    unset($object->context['createfromclone']);
+
 	    // End
 	    if (!$error) {
 	        $this->db->commit();

+ 1 - 3
htdocs/product/class/productbatch.class.php

@@ -338,8 +338,6 @@ class Productbatch extends CommonObject
 
 		$object=new Productbatch($this->db);
 
-		$object->context['createfromclone']='createfromclone';
-
  		$this->db->begin();
 
 		// Load source object
@@ -351,6 +349,7 @@ class Productbatch extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone']='createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -363,7 +362,6 @@ class Productbatch extends CommonObject
 		if (! $error)
 		{
 
-
 		}
 
 		unset($object->context['createfromclone']);

+ 2 - 2
htdocs/product/class/productcustomerprice.class.php

@@ -907,8 +907,6 @@ class Productcustomerprice extends CommonObject
 
 		$object = new Productcustomerprice($this->db);
 
-		$object->context['createfromclone']='createfromclone';
-
 		$this->db->begin();
 
 		// Load source object
@@ -920,6 +918,7 @@ class Productcustomerprice extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone']='createfromclone';
 		$result = $object->create($user);
 
 		// Other options
@@ -929,6 +928,7 @@ class Productcustomerprice extends CommonObject
 		}
 
 		if (! $error) {
+
 		}
 
 		unset($object->context['createfromclone']);

+ 3 - 1
htdocs/product/class/propalmergepdfproduct.class.php

@@ -582,6 +582,7 @@ class Propalmergepdfproduct extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone']='createfromclone';
 		$result=$object->create($user);
 
 		// Other options
@@ -594,9 +595,10 @@ class Propalmergepdfproduct extends CommonObject
 		if (! $error)
 		{
 
-
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (! $error)
 		{

+ 2 - 0
htdocs/product/inventory/class/inventory.class.php

@@ -247,6 +247,8 @@ class Inventory extends CommonObject
 			$this->errors = $object->errors;
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();

+ 3 - 0
htdocs/product/stock/class/productlot.class.php

@@ -454,6 +454,7 @@ class Productlot extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result = $object->create($user);
 
 		// Other options
@@ -463,6 +464,8 @@ class Productlot extends CommonObject
 			dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();

+ 3 - 0
htdocs/product/stock/class/productstockentrepot.class.php

@@ -443,6 +443,7 @@ class ProductStockEntrepot extends CommonObject
 		// ...
 
 		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
 		$result = $object->create($user);
 
 		// Other options
@@ -452,6 +453,8 @@ class ProductStockEntrepot extends CommonObject
 			dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();

+ 2 - 0
htdocs/societe/class/companypaymentmode.class.php

@@ -269,6 +269,8 @@ class CompanyPaymentMode extends CommonObject
 	        $this->errors = $object->errors;
 	    }
 
+	    unset($object->context['createfromclone']);
+
 	    // End
 	    if (!$error) {
 	        $this->db->commit();

+ 2 - 0
htdocs/societe/class/societeaccount.class.php

@@ -240,6 +240,8 @@ class SocieteAccount extends CommonObject
 	        $this->errors = $object->errors;
 	    }
 
+	    unset($object->context['createfromclone']);
+
 	    // End
 	    if (!$error) {
 	        $this->db->commit();

+ 3 - 0
htdocs/supplier_proposal/class/supplier_proposal.class.php

@@ -1176,6 +1176,7 @@ class SupplierProposal extends CommonObject
         $this->ref = $modSupplierProposal->getNextValue($objsoc,$this);
 
         // Create clone
+        $this->context['createfromclone'] = 'createfromclone';
         $result=$this->create($user);
         if ($result < 0) $error++;
 
@@ -1191,6 +1192,8 @@ class SupplierProposal extends CommonObject
             }
         }
 
+        unset($this->context['createfromclone']);
+
         // End
         if (! $error)
         {

+ 3 - 0
htdocs/ticket/class/ticket.class.php

@@ -966,6 +966,7 @@ class Ticket extends CommonObject
         // Clear fields
         // ...
         // Create clone
+        $object->context['createfromclone'] = 'createfromclone';
         $result = $object->create($user);
 
         // Other options
@@ -977,6 +978,8 @@ class Ticket extends CommonObject
         if (!$error) {
         }
 
+        unset($object->context['createfromclone']);
+
         // End
         if (!$error) {
             $this->db->commit();

+ 3 - 0
htdocs/website/class/website.class.php

@@ -598,6 +598,7 @@ class Website extends CommonObject
 
 				// Create new file
 				$objectpagenew = $objectpageold->createFromClone($user, $pageid, $objectpageold->pageurl, '', 0, $object->id, 1);
+
 				//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
 				if (is_object($objectpagenew) && $objectpagenew->pageurl)
 				{
@@ -646,6 +647,8 @@ class Website extends CommonObject
 		    }
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();

+ 2 - 0
htdocs/website/class/websitepage.class.php

@@ -447,6 +447,8 @@ class WebsitePage extends CommonObject
 			dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
 		}
 
+		unset($object->context['createfromclone']);
+
 		// End
 		if (!$error) {
 			$this->db->commit();