diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a750fd2bba6..4a041c504b3 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -289,7 +289,7 @@ if (empty($reshook)) { } // Create new object if ($result > 0 && !$error) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Change values $object->civility_id = trim(GETPOST("civility_id", 'alphanohtml')); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 7d201cd2625..86f4ace09f9 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -187,7 +187,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) { if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->fetch($rowid); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $object->label= trim($label); $object->morphy = trim($morphy); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index bd3255491fc..6ddbf261246 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -110,7 +110,7 @@ if (empty($reshook)) { } } - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $triggermodname = 'ASSET_MODIFY'; // Name of trigger action code to execute when we modify record // Action dispose object diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index b21d0a1c27c..cd3f78a291e 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -92,7 +92,7 @@ if ($cancel) { // Action mise a jour d'une categorie if ($action == 'update' && $user->rights->categorie->creer) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $object->label = $label; $object->description = dol_htmlcleanlastbr($description); $object->color = $color; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index aaa3b19bb40..ef9fd3b9f00 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -699,7 +699,7 @@ if (empty($reshook) && $action == 'update') { $object->fetch($id); $object->fetch_optionals(); $object->fetch_userassigned(); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Clean parameters if ($fulldayevent) { @@ -968,7 +968,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes $object->fetch($id); $object->fetch_optionals(); $object->fetch_userassigned(); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); if ($user->hasRight('agenda', 'myactions', 'delete') || $user->hasRight('agenda', 'allactions', 'delete')) { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index b078bb5fef5..5037d685de5 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -276,7 +276,7 @@ if (empty($reshook)) { if ($action == 'update_extras') { $object->fetch($id); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 879e0288634..c4a93f22976 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1608,7 +1608,7 @@ if (empty($reshook)) { // warehouse $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); } elseif ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 87300eb4c45..c869ed396a0 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1445,7 +1445,7 @@ if (empty($reshook)) { } if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 5181608fd50..7ee3b708a3b 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -405,7 +405,7 @@ if (empty($reshook)) { setEventMessages($line->error, $line->errors, 'errors'); } } elseif ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a15d73edb33..93f422b7025 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2889,7 +2889,7 @@ if (empty($reshook)) { if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 99714c1f124..1aa2d5cd5a3 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -102,7 +102,7 @@ if ($reshook < 0) { if (empty($reshook)) { if ($action == 'setbankaccount' && $permissiontoadd) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $object->fk_bank_account = GETPOST('fk_bank_account', 'int'); $object->update($user); } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 27cd73c2949..f405ce799b5 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -521,7 +521,7 @@ if (empty($reshook)) { // Update extrafields if ($action == 'update_extras' && !empty($user->rights->societe->contact->creer)) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index f2a05d0eb10..c24cd37ba18 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -65,7 +65,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('societe', 'con $result = $object->update_perso($id, $user); if ($result > 0) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Logo/Photo save $dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos'; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index e3cd8d35aee..46248615e12 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -890,7 +890,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), null, 'errors'); } } elseif ($action == 'update_extras' && $permissiontoadd) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $attribute = GETPOST('attribute', 'alphanohtml'); @@ -914,7 +914,7 @@ if (empty($reshook)) { } } elseif ($action == 'setref_supplier' && $permissiontoadd) { if (!$cancel) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { @@ -930,7 +930,7 @@ if (empty($reshook)) { } } elseif ($action == 'setref_customer' && $permissiontoadd) { if (!$cancel) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer', 'alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index d9127a6a27c..07136bd760a 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -350,7 +350,7 @@ if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOST('id', 'int') > 0 && !em if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) { $object->fetch(GETPOST('id', 'int')); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $attribute = GETPOST('attribute', 'alphanohtml'); diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 478b58cd1af..d83921630a6 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -194,7 +194,7 @@ if ($action == 'setdate_delivery' && $user->rights->expedition->delivery->creer) // Update extrafields if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 58e61c2d537..f161686481c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -196,7 +196,7 @@ if (empty($reshook)) { } if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 740cd7c380f..9259d6804b1 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -188,7 +188,7 @@ if (empty($reshook)) { } if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1d3367c99c6..98e058345a8 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -351,7 +351,7 @@ if (empty($reshook)) { } if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 81c2ba403b4..f37ae574d63 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -745,7 +745,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index a5185f50acc..6680de25efb 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -159,7 +159,7 @@ if (empty($reshook)) { if ($action == 'update_extras' && $user->hasRight('societe', 'creer')) { $object->fetch($id); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 7920b21cdd7..a560ff8f4d5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1194,7 +1194,7 @@ if (empty($reshook)) { if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 3d8bdf23d36..558574b3a0a 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -402,7 +402,7 @@ if (empty($reshook)) { setEventMessages($line->error, $line->errors, 'errors'); } } elseif ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8f086be1154..7c87aba41bc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1922,7 +1922,7 @@ if (empty($reshook)) { } } if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index c06467d1d24..912d5e5cf61 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -304,7 +304,7 @@ if (empty($reshook)) { if ($action == 'update' && GETPOSTISSET('savevalidator') && !empty($user->rights->holiday->approve)) { $object->fetch($id); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $object->fk_validator = GETPOST('valideur', 'int'); @@ -463,7 +463,7 @@ if (empty($reshook)) { // If draft and owner of leave if ($object->statut == Holiday::STATUS_DRAFT && $cancreate) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $object->statut = Holiday::STATUS_VALIDATED; @@ -571,7 +571,7 @@ if (empty($reshook)) { } if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); @@ -599,7 +599,7 @@ if (empty($reshook)) { // If status is waiting approval and approver is also user if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $object->date_approval = dol_now(); $object->fk_user_approve = $user->id; diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index c67d055a7e2..05d24abd3eb 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -681,7 +681,7 @@ function sendMail($id, $cancreate, $now, $autoValidation) if ($result) { // If draft and owner of leave if ($object->statut == Holiday::STATUS_VALIDATED && $cancreate) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); //if ($autoValidation) $object->statut = Holiday::STATUS_VALIDATED; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5be47a5d42f..fcf1c216aa7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -460,7 +460,7 @@ if (empty($reshook)) { // Quick edit for extrafields if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b36c134d20b..937574d80fb 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -141,7 +141,7 @@ if (empty($reshook)) { if ($action == 'setcost_price') { if ($id) { $result = $object->fetch($id); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); $object->cost_price = price2num($cost_price); $result = $object->update($object->id, $user); if ($result > 0) { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 5baf343556e..ed3af51bf7b 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -237,7 +237,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 42adc0a471a..7a6e7264521 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -234,7 +234,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; /* if ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 001d674522a..85645b9a237 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -262,7 +262,7 @@ if (empty($reshook)) { } if ($action == 'update_extras' && $permissiontoadd) { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a0f8f6f7612..29a8ea251ae 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -408,7 +408,7 @@ if (empty($reshook)) { if ($action == 'update_extras') { $object->fetch($socid); - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index a03d52ecbd0..bf94b96c906 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1135,7 +1135,7 @@ if (empty($reshook)) { // Multicurrency rate $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } elseif ($action == 'update_extras') { - $object->oldcopy = dol_clone($object); + $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));