diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 3c6f7563590..4da28dfdeb9 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2017 Laurent Destailleur +/* Copyright (C) 2017 ATM Consulting + * Copyright (C) 2017-2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,6 +115,8 @@ class BlockedLog public $ref_object = ''; public $object_data = null; + public $object_version = ''; + public $user_fullname = ''; /** @@ -674,7 +676,7 @@ class BlockedLog $langs->load("blockedlog"); $sql = "SELECT b.rowid, b.date_creation, b.signature, b.signature_line, b.amounts, b.action, b.element, b.fk_object, b.entity,"; - $sql .= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.object_data"; + $sql .= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.object_data, b.object_version"; $sql .= " FROM ".MAIN_DB_PREFIX."blockedlog as b"; if ($id) $sql .= " WHERE b.rowid = ".$id; @@ -704,6 +706,7 @@ class BlockedLog $this->user_fullname = $obj->user_fullname; $this->object_data = $this->dolDecodeBlockedData($obj->object_data); + $this->object_version = $obj->object_version; $this->signature = $obj->signature; $this->signature_line = $obj->signature_line; @@ -826,6 +829,7 @@ class BlockedLog $sql .= " date_object,"; $sql .= " ref_object,"; $sql .= " object_data,"; + $sql .= " object_version,"; $sql .= " certified,"; $sql .= " fk_user,"; $sql .= " user_fullname,"; @@ -841,6 +845,7 @@ class BlockedLog $sql .= "'".$this->db->idate($this->date_object)."',"; $sql .= "'".$this->db->escape($this->ref_object)."',"; $sql .= "'".$this->db->escape(serialize($this->object_data))."',"; + $sql .= "'".$this->db->escape($this->object_version)."',"; $sql .= "0,"; $sql .= $this->fk_user.","; $sql .= "'".$this->db->escape($this->user_fullname)."',"; @@ -914,7 +919,11 @@ class BlockedLog private function buildKeyForSignature() { //print_r($this->object_data); - return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true); + if (((int) $this->object_version) > 12) { + return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true); + } else { + return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true); + } } diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index fade1208c9c..0d0a3a23fae 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -203,3 +203,5 @@ ALTER TABLE llx_categorie MODIFY type integer NOT NULL DEFAULT 1; ALTER TABLE llx_societe_remise_except ADD COLUMN vat_src_code varchar(10) DEFAULT ''; +ALTER TABLE llx_blockedlog ADD COLUMN object_version varchar(32) DEFAULT ''; + diff --git a/htdocs/install/mysql/tables/llx_blockedlog.sql b/htdocs/install/mysql/tables/llx_blockedlog.sql index cf1db2e329e..09adfaf15d1 100644 --- a/htdocs/install/mysql/tables/llx_blockedlog.sql +++ b/htdocs/install/mysql/tables/llx_blockedlog.sql @@ -33,6 +33,7 @@ CREATE TABLE llx_blockedlog signature varchar(100) NOT NULL, signature_line varchar(100) NOT NULL, object_data text, + object_version varchar(32) DEFAULT ''; certified integer ) ENGINE=innodb;