From e6af0facdd6c50d766ebd8ea3b91edaaba1d4389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 23:27:07 +0100 Subject: [PATCH] keep info on latest activation version of module --- htdocs/admin/modulehelp.php | 5 +++++ htdocs/core/modules/DolibarrModules.class.php | 15 +++++++++++++-- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index a3c7c3d5c08..4ef01ab29af 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -262,6 +262,11 @@ if ($ip) { $text .= '
'.$langs->trans("LastActivationIP").': '; $text .= $ip; } +$lastactivationversion = $tmp['lastactivationversion']; +if ($lastactivationversion) { + $text .= '
'.$langs->trans("LastActivationVersion").': '; + $text .= $lastactivationversion; +} $moreinfo = $text; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 50171253938..9ecb73234de 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -957,7 +957,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $tmp = json_decode($obj->note, true); } if ($obj) { - return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms)); + return array( + 'authorid' => $tmp['authorid'], + 'ip' => $tmp['ip'], + 'lastactivationdate' => $this->db->jdate($obj->tms), + 'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'), + ); } } @@ -991,7 +996,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err++; } - $note = json_encode(array('authorid'=>(is_object($user) ? $user->id : 0), 'ip'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']))); + $note = json_encode( + array( + 'authorid' => (is_object($user) ? $user->id : 0), + 'ip' => (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']), + 'lastactivationversion' => $this->version, + ) + ); $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES"; $sql .= " (".$this->db->encrypt($this->const_name); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4601f2c15b9..5b936c49291 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -353,6 +353,7 @@ LastStableVersion=Latest stable version LastActivationDate=Latest activation date LastActivationAuthor=Latest activation author LastActivationIP=Latest activation IP +LastActivationVersion=Latest activation version UpdateServerOffline=Update server offline WithCounter=Manage a counter GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags can be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as the previous one but an offset corresponding to the number to the right of the + sign is applied starting on the first %s.
{000000@x} same as the previous one but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then the sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.