QUAL: Use dol_clone with parameter 2 for ->oldcopy

This commit is contained in:
Laurent Destailleur 2023-10-11 19:10:24 +02:00
parent 92ec85df26
commit c32fe8dc5f
33 changed files with 39 additions and 39 deletions

View File

@ -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'));

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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')) {

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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);
}

View File

@ -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'));

View File

@ -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';

View File

@ -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) {

View File

@ -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');

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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;

View File

@ -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;

View File

@ -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'));

View File

@ -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) {

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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);

View File

@ -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'));