use oldcopy only to retrieve old values instaed undeclared properties

This commit is contained in:
Frédéric France 2023-01-18 22:28:43 +01:00
parent 80d46a22f1
commit 9cd6adb6c8

View File

@ -322,9 +322,6 @@ if (empty($reshook)) {
$result = $object->fetch($id);
$object->oldcopy = clone $object;
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
$result = $object->delete(); // TODO Add $user as first param
if ($result > 0) {
setEventMessages("RecordDeleted", null, 'mesgs');
@ -408,9 +405,6 @@ if (empty($reshook)) {
$object->oldcopy = clone $object;
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
$object->socid = GETPOST("socid", 'int');
$object->lastname = (string) GETPOST("lastname", 'alpha');
$object->firstname = (string) GETPOST("firstname", 'alpha');
@ -972,7 +966,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
/* set country at end because it will trigger page refresh */
console.log("Set country id to '.dol_escape_js($objsoc->country_id).'");
$(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */
});
});
})'."\n";
print '</script>'."\n";
}
@ -982,8 +976,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="contactid" value="'.$object->id.'">';
print '<input type="hidden" name="old_lastname" value="'.$object->lastname.'">';
print '<input type="hidden" name="old_firstname" value="'.$object->firstname.'">';
if (!empty($backtopage)) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
@ -1033,7 +1025,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<div class="paddingrightonly valignmiddle inline-block quatrevingtpercent">';
print '<textarea class="flat minwidth200 centpercent" name="address" id="address">'.(GETPOSTISSET("address") ? GETPOST("address", 'alphanohtml') : $object->address).'</textarea>';
print '</div><div class="paddingrightonly valignmiddle inline-block">';
if ($conf->use_javascript_ajax) {
if (!empty($conf->use_javascript_ajax)) {
print '<a href="#" id="copyaddressfromsoc">'.$langs->trans('CopyAddressFromSoc').'</a><br>';
}
print '</div>';
@ -1636,7 +1628,7 @@ function showSocialNetwork()
items.show();
lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("HideSocialNetwork")).'");
if(chgCookieState) {document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=true; SameSite=Strict";}
}
}
}
</script>';
}