diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php
index e0daf054fc5..12076d4f8e9 100644
--- a/htdocs/admin/system/dolibarr.php
+++ b/htdocs/admin/system/dolibarr.php
@@ -30,6 +30,7 @@ require '../../main.inc.php';
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
+ * @var Societe $mysoc
* @var Translate $langs
* @var User $user
*
@@ -45,6 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin"));
@@ -58,6 +60,9 @@ if (!$user->admin) {
$sfurl = '';
$version = '0.0';
+// Version blockedlog
+$versionbadge = ''.getBlockedLogVersionToShow().'';
+
/*
* Actions
@@ -171,14 +176,41 @@ print '
'.$langs->trans("VersionLastUpgrade").' '.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'';
}
-print ' |
'."\n";
-print ''.$langs->trans("VersionLastInstall").' ('.$langs->trans("Database").') | ';
if (getDolGlobalString('MAIN_VERSION_LAST_INSTALL')) {
- print ''.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'';
+ print ' '.$langs->trans("VersionLastInstall").': '.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'';
}
print ' |
'."\n";
+
+if (isALNERunningVersion()) {
+ print '';
+ print '| '.$langs->trans("VersionOfModule", $langs->transnoentitiesnoconv("BlockedLog")).' | ';
+ print $versionbadge;
+ print ' | ';
+ print '
';
+}
+
print '';
print '';
+
+// Add a complementary optional information
+$infotoshow = '';
+if ($mysoc->country_code == 'FR') {
+ $islne = isALNEQualifiedVersion(1, 1);
+ if ($islne) {
+ if (preg_match('/\-/', getBlockedLogVersionToShow())) {
+ // This is an alpha or beta version
+ $infotoshow = $langs->trans("LNECandidateVersionForCertificationFR", getBlockedLogVersionToShow());
+ } else {
+ $infotoshow = $langs->trans("LNECertifiedVersionFR", getBlockedLogVersionToShow());
+ }
+ } else {
+ $infotoshow = $langs->trans("NotCertifiedVersionFR", getBlockedLogVersionToShow());
+ }
+}
+if ($infotoshow) {
+ print info_admin($infotoshow, 0, 0, 'info');
+}
+
print '
';
// Session
diff --git a/htdocs/blockedlog/admin/filecheck.php b/htdocs/blockedlog/admin/filecheck.php
index e235621ba53..71546bf126c 100644
--- a/htdocs/blockedlog/admin/filecheck.php
+++ b/htdocs/blockedlog/admin/filecheck.php
@@ -109,7 +109,6 @@ if (isALNERunningVersion()) {
print '';
}
-
print '';
print '';
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 9596116944f..d2441658c7d 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -129,7 +129,7 @@ class BlockedLog
public $fk_user = 0;
/**
- * @var int|string
+ * @var int|string Note we store in database in gmt time, not in server timezone time
*/
public $date_creation;
@@ -1321,12 +1321,14 @@ class BlockedLog
$previoushash = '';
$previousid = 0;
+ $previousdatecreation = 0;
try {
$tmparray = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done and transaction closed
$previoushash = $tmparray['previoushash'];
$previousid = $tmparray['previousid'];
+ $previousdatecreation = $tmparray['previousdatecreation'];
$concatenateddata = $this->buildKeyForSignature(); // All the information for the hash (meta data + data saved)
@@ -1420,7 +1422,7 @@ class BlockedLog
// Call remote API service to record the last counter
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
try {
- $resultcall = callApiToPushCounter((int) $this->id, $this->signature, 0, (int) $previousid, $previoushash);
+ $resultcall = callApiToPushCounter((int) $this->id, $this->signature, $this->date_creation, 0, (int) $previousid, $previoushash, $previousdatecreation);
} catch (Exception $e) {
$error++;
$this->error = $e->getMessage();
@@ -1601,10 +1603,11 @@ class BlockedLog
$previousid = 0;
$previoussignature = '';
+ $previousdatecreation = 0;
// Fast search of previous record by searching with beforeid - 1. This is very fast and will work 99% of time.
if ($beforeid) {
- $sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog";
+ $sql = "SELECT rowid, signature, date_creation, object_format FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity = ".((int) $conf->entity);
$sql .= " AND rowid = ".((int) $beforeid - 1);
$sql .= ($withlock ? " FOR UPDATE " : ""); // To be sure transaction the get last hash to generate the next one will be unlocked once transaction to create new record is finished
@@ -1615,6 +1618,11 @@ class BlockedLog
if ($obj) {
$previousid = $obj->rowid;
$previoussignature = $obj->signature;
+ $tz = 'gmt';
+ if (empty($obj->object_format) || $obj->object_format == 'V1') {
+ $tz = 'tzserver';
+ }
+ $previousdatecreation = $this->db->jdate($obj->date_creation, $tz);
}
} else {
dol_print_error($this->db);
@@ -1624,7 +1632,7 @@ class BlockedLog
if (empty($previoussignature)) {
// Note: a select max rowid and then a select to get signature seems not faster due to filter on entity
- $sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog";
+ $sql = "SELECT rowid, signature, date_creation, object_format FROM ".MAIN_DB_PREFIX."blockedlog";
if ($beforeid) {
$sql .= $this->db->hintindex('entity_rowid', 1);
}
@@ -1641,6 +1649,11 @@ class BlockedLog
if ($obj) {
$previousid = $obj->rowid;
$previoussignature = $obj->signature;
+ $tz = 'gmt';
+ if (empty($obj->object_format) || $obj->object_format == 'V1') {
+ $tz = 'tzserver';
+ }
+ $previousdatecreation = $this->db->jdate($obj->date_creation, $tz);
}
} else {
dol_print_error($this->db);
@@ -1654,7 +1667,7 @@ class BlockedLog
$previoussignature = $this->getOrInitFirstSignature();
}
- return array('previousid' => $previousid, 'previoushash' => $previoussignature);
+ return array('previousid' => $previousid, 'previoushash' => $previoussignature, 'previousdatecreation' => $previousdatecreation);
}
/**
diff --git a/htdocs/blockedlog/lib/blockedlog.lib.php b/htdocs/blockedlog/lib/blockedlog.lib.php
index 4484ba7fcb1..2c9a60a3ea6 100644
--- a/htdocs/blockedlog/lib/blockedlog.lib.php
+++ b/htdocs/blockedlog/lib/blockedlog.lib.php
@@ -369,14 +369,16 @@ function sumAmountsForUnalterableEvent($block, &$refinvoicefound, &$totalhtamoun
/**
* Call remote API service to push the last counter and signature
*
- * @param int $id Last counter ID/value
- * @param string $signature Signature
- * @param int $test Add property test to 1 if it is for test
- * @param int $previousid Last counter ID/value
- * @param string $previoussignature Signature
- * @return int Return <0 if KO, 0 if nothing done, >0 if OK
+ * @param int $id Counter ID/value of ne record
+ * @param string $signature Signature of new record
+ * @param int $datecreation Date creation of new record
+ * @param int $test Add property test to 1 if it is for test
+ * @param int $previousid Counter ID/value of previous record
+ * @param string $previoussignature Signature of previous record
+ * @param int $previousdatecreation Date creation of previous record
+ * @return int Return <0 if KO, 0 if nothing done, >0 if OK
*/
-function callApiToPushCounter($id, $signature, $test, $previousid, $previoussignature)
+function callApiToPushCounter($id, $signature, $datecreation, $test, $previousid, $previoussignature, $previousdatecreation)
{
global $mysoc, $conf;
@@ -391,7 +393,7 @@ function callApiToPushCounter($id, $signature, $test, $previousid, $previoussign
$hash_unique_id = getHashUniqueIdOfRegistration($algo); // The hash of the unique IDof instance
$t = microtime(true);
- $micro = sprintf("%06d", (int) ($t - floor($t)) * 1000000);
+ $micro = sprintf("%06d", (int) (($t - floor($t)) * 1000000));
$data = '';
$data .= 'hash_algo=dol_hash-'.urlencode($algo);
@@ -407,8 +409,10 @@ function callApiToPushCounter($id, $signature, $test, $previousid, $previoussign
$data .= '&lastrowid='.(int) $id;
$data .= '&lastsignature='.urlencode($signature);
+ $data .= '&lastdatecreation='.urlencode($datecreation);
$data .= '&previousrowid='.(int) $previousid;
$data .= '&previoussignature='.urlencode($previoussignature);
+ $data .= '&previousdatecreation='.urlencode($previousdatecreation);
if ($test) {
$data .= '&test=1';
}
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index f7c2bfa86e9..068a68404ea 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -553,7 +553,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler
});
';
if (count($arraysql)) {
- print ' - '.$langs->trans("ShowHideDetails").'';
+ print ' - '.$langs->trans("ShowHideDetails").'';
} else {
print ' - '.$langs->trans("ScriptIsEmpty").'';
}
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 38a2e7c01b5..71874386713 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -875,7 +875,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
});
});
';
- print ''.$langs->trans("ShowHideDetails").'';
+ print ''.$langs->trans("ShowHideDetails").'';
//}
print ''."\n";
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index e74a598d058..53121172667 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -3911,7 +3911,8 @@ if (!function_exists("llxFooter")) {
if (isModEnabled('blockedlog') && ($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') && $forcepushcounter) {
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
- if (!isALNEQualifiedVersion()) {
+ $islne = isALNEQualifiedVersion(1, 1);
+ if (!$islne) {
print "\n\n";
} elseif (!isRegistrationDataSaved()) {
print "\n\n";
@@ -3926,7 +3927,7 @@ if (!function_exists("llxFooter")) {
if ((int) $tmpresult2['previousid']) {
// Call remote API service to record the last counter
- $resultcall = callApiToPushCounter((int) $tmpresult['previousid'], $tmpresult['previoushash'], 1, (int) $tmpresult2['previousid'], $tmpresult2['previoushash']);
+ $resultcall = callApiToPushCounter((int) $tmpresult['previousid'], $tmpresult['previoushash'], $tmpresult['previousdatecreation'], 1, (int) $tmpresult2['previousid'], $tmpresult2['previoushash'], $tmpresult2['previousdatecreation']);
print "\n\n";
}