Clean code: No more fetch to clone
This commit is contained in:
parent
0f3ed254fd
commit
9bc6c41ca7
@ -278,7 +278,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
// Create new object
|
||||
if ($result > 0 && !$error) {
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Change values
|
||||
$object->civility_id = trim(GETPOST("civility_id", 'alphanohtml'));
|
||||
|
||||
@ -170,7 +170,8 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
if ($action == 'update' && $user->rights->adherent->configurer) {
|
||||
$object->fetch($rowid);
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
$object->label= trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->status = (int) $status;
|
||||
|
||||
@ -677,7 +677,7 @@ if (empty($reshook) && $action == 'update') {
|
||||
$object->fetch($id);
|
||||
$object->fetch_optionals();
|
||||
$object->fetch_userassigned();
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Clean parameters
|
||||
if ($fulldayevent) {
|
||||
@ -927,7 +927,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes
|
||||
$object->fetch($id);
|
||||
$object->fetch_optionals();
|
||||
$object->fetch_userassigned();
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
if ($user->rights->agenda->myactions->delete
|
||||
|| $user->rights->agenda->allactions->delete) {
|
||||
|
||||
@ -212,7 +212,7 @@ if (GETPOST("viewperuser", 'alpha') || $mode == 'show_peruser') {
|
||||
$event->fetch($actionid);
|
||||
$event->fetch_optionals();
|
||||
$event->fetch_userassigned();
|
||||
$event->oldcopy = clone $event;
|
||||
$event->oldcopy = dol_clone($event);
|
||||
|
||||
$result = $event->delete();
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ if ($action == 'delete_action' && $user->rights->agenda->delete) {
|
||||
$event->fetch($actionid);
|
||||
$event->fetch_optionals();
|
||||
$event->fetch_userassigned();
|
||||
$event->oldcopy = clone $event;
|
||||
$event->oldcopy = dol_clone($event);
|
||||
|
||||
$result = $event->delete();
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ if ($action == 'delete_action' && $user->rights->agenda->delete) {
|
||||
$event->fetch($actionid);
|
||||
$event->fetch_optionals();
|
||||
$event->fetch_userassigned();
|
||||
$event->oldcopy = clone $event;
|
||||
$event->oldcopy = dol_clone($event);
|
||||
|
||||
$result = $event->delete();
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->societe->contact
|
||||
|
||||
$result = $object->update_perso($id, $user);
|
||||
if ($result > 0) {
|
||||
$object->oldcopy = clone $object;
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Logo/Photo save
|
||||
$dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos';
|
||||
|
||||
@ -3135,8 +3135,7 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$this->oldcopy = new ContratLigne($this->db);
|
||||
$this->oldcopy->fetch($this->id);
|
||||
$this->oldcopy = dol_clone($this);
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||
|
||||
@ -71,19 +71,19 @@ class Comment extends CommonObject
|
||||
public $fk_user_modif;
|
||||
|
||||
/**
|
||||
* @var int Entity
|
||||
* @var int Entity
|
||||
*/
|
||||
public $entity;
|
||||
|
||||
/**
|
||||
* @var string import key
|
||||
* @var string Import key
|
||||
*/
|
||||
public $import_key;
|
||||
|
||||
public $comments = array();
|
||||
|
||||
/**
|
||||
* @var Comment Object oldcopy
|
||||
* @var Comment Object oldcopy
|
||||
*/
|
||||
public $oldcopy;
|
||||
|
||||
|
||||
@ -533,7 +533,7 @@ class Fichinter extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if (!$error) {
|
||||
$this->oldcopy = clone $this;
|
||||
$this->oldcopy = dol_clone($this);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -1422,7 +1422,7 @@ class Fichinter extends CommonObject
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->oldcopy = clone $this;
|
||||
$this->oldcopy = dol_clone($this);
|
||||
$this->ref_client = $ref_client;
|
||||
}
|
||||
|
||||
|
||||
@ -1051,9 +1051,7 @@ class Product extends CommonObject
|
||||
|
||||
if ($result >= 0) {
|
||||
if (empty($this->oldcopy)) {
|
||||
$org = new self($this->db);
|
||||
$org->fetch($this->id);
|
||||
$this->oldcopy = $org;
|
||||
$this->oldcopy = dol_clone($this);
|
||||
}
|
||||
|
||||
// Test if batch management is activated on existing product
|
||||
|
||||
@ -388,9 +388,7 @@ class Productlot extends CommonObject
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
if (empty($this->oldcopy)) {
|
||||
$org = new self($this->db);
|
||||
$org->fetch($this->id);
|
||||
$this->oldcopy = $org;
|
||||
$this->oldcopy = dol_clone($this);
|
||||
}
|
||||
|
||||
// Update request
|
||||
|
||||
@ -263,9 +263,7 @@ class Dolresource extends CommonObject
|
||||
}
|
||||
|
||||
if (empty($this->oldcopy)) {
|
||||
$org = new self($this->db);
|
||||
$org->fetch($this->id);
|
||||
$this->oldcopy = $org;
|
||||
$this->oldcopy = dol_clone($this);
|
||||
}
|
||||
|
||||
// Update request
|
||||
|
||||
@ -149,7 +149,7 @@ if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) {
|
||||
{
|
||||
$objectuser->fetch($id);
|
||||
|
||||
$objectuser->oldcopy = clone $objectuser;
|
||||
$objectuser->oldcopy = dol_clone($objectuser);
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user