mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-24 05:44:25 +01:00
Debug v24
This commit is contained in:
@@ -688,7 +688,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
|
||||
$object->period = 'year='.GETPOSTINT('yeartoexport').(GETPOSTINT('monthtoexport') ? ' month='.GETPOSTINT('monthtoexport') : '');
|
||||
|
||||
$action = 'BLOCKEDLOG_EXPORT';
|
||||
$result = $b->setObjectData($object, $action, 0, $user, null);
|
||||
$result = $b->setObjectData($object, $action, 0, $user, 0);
|
||||
//var_dump($b); exit;
|
||||
|
||||
if ($result < 0) {
|
||||
|
||||
@@ -168,19 +168,19 @@ class BlockedLog
|
||||
public $debuginfo;
|
||||
|
||||
/**
|
||||
* Array of tracked event codes
|
||||
* Array of tracked event codes. They are event codes that triggers a record in the unalterable log (and you can filter in list of events).
|
||||
* @var array<string,string|mixed>
|
||||
*/
|
||||
public $trackedevents = array();
|
||||
|
||||
/**
|
||||
* Array of controlled event codes
|
||||
* Array of controlled event codes. They are event the execute a control when they occurs. An error return will cancel the action.
|
||||
* @var array<string,string|mixed>
|
||||
*/
|
||||
public $controlledevents = array();
|
||||
|
||||
/**
|
||||
* Array of tracked modules (key => label)
|
||||
* Array of tracked modules (key => label). List of modules we can see in module_pos.
|
||||
* @var array<int|string,string>
|
||||
*/
|
||||
public $trackedmodules = array();
|
||||
@@ -506,6 +506,8 @@ class BlockedLog
|
||||
|
||||
// Generic fields
|
||||
|
||||
// entity
|
||||
$this->entity = $object->entity ?? getDolEntity();
|
||||
// action
|
||||
$this->action = $action;
|
||||
// amount
|
||||
@@ -1242,8 +1244,12 @@ class BlockedLog
|
||||
$this->date_creation = dol_now();
|
||||
|
||||
$this->object_version = DOL_VERSION;
|
||||
|
||||
// The object_format define the formatting rules into buildKeyForSignature and buildFirstPartOfKeyForSignature and buildFinalSignatureHash
|
||||
$this->object_format = 'V1'; // TODO Switch to V2 when v2 support is complete
|
||||
$this->object_format = 'V1'; // TODO Switch to V2 for every version
|
||||
if (defined('CERTIF_LNE') && in_array((int) constant('CERTIF_LNE'), array(1, 2))) {
|
||||
$this->object_format = 'V2';
|
||||
}
|
||||
|
||||
$previoushash = '';
|
||||
$previousid = 0;
|
||||
|
||||
@@ -362,9 +362,11 @@ function callApiToPushCounter($id, $signature, $test, $previousid, $previoussign
|
||||
$algo = 'sha256';
|
||||
$hash_unique_id = getHashUniqueIdOfRegistration($algo);
|
||||
|
||||
$data = 'hash_algo=dol_hash-'.urlencode($algo);
|
||||
$data = '';
|
||||
$data .= 'hash_algo=dol_hash-'.urlencode($algo);
|
||||
$data .= '&hash_unique_id='.urlencode($hash_unique_id);
|
||||
$data .= '&action=dolibarrpushcounter';
|
||||
$data .= '&datesys='.urlencode(dol_print_date(dol_now(), 'standard', 'gmt'));
|
||||
$data .= '&version='.(float) DOL_VERSION;
|
||||
$data .= '&version_full='.urlencode(DOL_VERSION);
|
||||
$data .= '&entity='.(int) $conf->entity;
|
||||
@@ -377,19 +379,6 @@ function callApiToPushCounter($id, $signature, $test, $previousid, $previoussign
|
||||
$data .= '&test=1';
|
||||
}
|
||||
|
||||
/*
|
||||
$data = array(
|
||||
'action' => 'dolibarrpushcounter',
|
||||
'hash_algo' => 'dol_hash-'.$algo,
|
||||
'hash_unique_id' => $hash_unique_id,
|
||||
'version' => (float) DOL_VERSION,
|
||||
'version_full' => urlencode(DOL_VERSION),
|
||||
'entity=' => (int) $conf->entity
|
||||
);
|
||||
$data['lastrowid'] = (int) $this->id;
|
||||
$data['lastsignature'] = urlencode($this->signature);
|
||||
*/
|
||||
|
||||
$addheaders = array();
|
||||
$timeoutconnect = 1;
|
||||
$timeoutresponse = 1;
|
||||
|
||||
@@ -162,7 +162,7 @@ class modBlockedLog extends DolibarrModules
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories.
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @param string $options Options when enabling module ('', 'noboxes', 'acceptredirect', 'forceinit')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
@@ -174,13 +174,14 @@ class modBlockedLog extends DolibarrModules
|
||||
require_once DOL_DOCUMENT_ROOT . '/blockedlog/class/blockedlog.class.php';
|
||||
$b = new BlockedLog($this->db);
|
||||
|
||||
// forceinit can be set to bypass this redirection
|
||||
// any value of $options except 'acceptredirect' will bypass this redirection
|
||||
if (isALNEQualifiedVersion(1, 1) && $options == 'acceptredirect') {
|
||||
// We first switch on registration page
|
||||
header("Location: ".DOL_URL_ROOT.'/blockedlog/admin/registration.php?origin=initmodule&withtab=0');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
|
||||
@@ -224,7 +225,7 @@ class modBlockedLog extends DolibarrModules
|
||||
$this->db->commit();
|
||||
|
||||
|
||||
// We add an entry to show we enable module
|
||||
// We add an entry to show we enable the module
|
||||
|
||||
$object = new stdClass();
|
||||
$object->id = 0;
|
||||
@@ -235,7 +236,7 @@ class modBlockedLog extends DolibarrModules
|
||||
|
||||
// Add first entry in unalterable Log to track that module was activated
|
||||
$action = 'MODULE_SET';
|
||||
$result = $b->setObjectData($object, $action, 0, $user, null);
|
||||
$result = $b->setObjectData($object, $action, 0, $user, 0);
|
||||
|
||||
if ($result < 0) {
|
||||
$this->error = $b->error;
|
||||
@@ -243,14 +244,27 @@ class modBlockedLog extends DolibarrModules
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$res = $b->create($user);
|
||||
if ($res <= 0) {
|
||||
$this->db->rollback();
|
||||
|
||||
$this->error = $b->error;
|
||||
$this->errors = $b->errors;
|
||||
return $res;
|
||||
}
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
$resinit = $this->_init($sql, $options);
|
||||
if ($resinit <= 0) {
|
||||
$this->db->rollback();
|
||||
|
||||
return $resinit;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,7 +295,7 @@ class modBlockedLog extends DolibarrModules
|
||||
$object->label = 'Module disabled';
|
||||
|
||||
$b = new BlockedLog($this->db);
|
||||
$result = $b->setObjectData($object, 'MODULE_RESET', 0, $user, null);
|
||||
$result = $b->setObjectData($object, 'MODULE_RESET', 0, $user, 0);
|
||||
if ($result < 0) {
|
||||
$this->error = $b->error;
|
||||
$this->errors = $b->errors;
|
||||
|
||||
@@ -84,11 +84,13 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
$b = new BlockedLog($this->db);
|
||||
$b->loadTrackedEvents(); // Get the list of tracked events into $b->trackedevents
|
||||
|
||||
// Tracked events
|
||||
// Tracked or controlled events
|
||||
if (!in_array($action, array_keys($b->trackedevents)) && !in_array($action, array_keys($b->controlledevents))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If we are here, we are on an action code that will have a control or will generate a record in blockedlog database.
|
||||
|
||||
if ($action === 'PAYMENT_CUSTOMER_CREATE' && $object->element == 'payment') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
|
||||
if (isALNERunningVersion() && $mysoc->country_code == 'FR') {
|
||||
@@ -206,7 +208,8 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
return -1;
|
||||
}
|
||||
|
||||
$res = $b->create($user); // Insert event in unalterable log. We are in a trigger so inside a global db transaction.
|
||||
// Insert event in unalterable log. We are in a trigger so inside a global db transaction.
|
||||
$res = $b->create($user);
|
||||
|
||||
if ($res < 0) {
|
||||
$this->setErrorsFromObject($b);
|
||||
|
||||
@@ -3861,14 +3861,14 @@ function migrate_reset_blocked_log($db, $langs, $conf)
|
||||
} else {
|
||||
// Add set line
|
||||
$object = new stdClass();
|
||||
$object->id = 1;
|
||||
$object->id = 0;
|
||||
$object->element = 'module';
|
||||
$object->ref = 'systemevent';
|
||||
$object->entity = $obj->entity;
|
||||
$object->date = dol_now();
|
||||
|
||||
$b = new BlockedLog($db);
|
||||
$b->setObjectData($object, 'MODULE_SET', 0, $user, null);
|
||||
$b->setObjectData($object, 'MODULE_SET', 0, $user, 0);
|
||||
|
||||
$res = $b->create($user);
|
||||
if ($res <= 0) {
|
||||
|
||||
@@ -3784,6 +3784,8 @@ if (!function_exists("llxFooter")) {
|
||||
|
||||
$arrayofmoredata = array(
|
||||
'action' => 'dolibarrping',
|
||||
'datesys' => dol_print_date(dol_now(), 'standard', 'gmt'),
|
||||
|
||||
'country_code' => ($mysoc->country_code ? $mysoc->country_code : 'unknown')
|
||||
);
|
||||
printCodeForPing($constanttosavelastko, $constanttosavefirstok, $arrayofmoredata, $forceping);
|
||||
@@ -3828,6 +3830,7 @@ if (!function_exists("llxFooter")) {
|
||||
|
||||
$arrayofdata = array(
|
||||
'action' => 'dolibarrregistration',
|
||||
'datesys' => dol_print_date(dol_now(), 'standard', 'gmt'),
|
||||
|
||||
'company_name' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_NAME', $mysoc->name),
|
||||
'company_email' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_EMAIL', $mysoc->email),
|
||||
|
||||
@@ -4,5 +4,20 @@ QUICK TOOL FOR CERTIFICATION
|
||||
***** To generate manually the filelist of files footprints:
|
||||
~/git/dolibarr_xxx/dev/build/generate_filelist_xml.php' release=auto
|
||||
|
||||
|
||||
***** To reload demo database
|
||||
~/git/dolibarr_test/dev/initdemo/initdemo.sh confirmresetblockedlog 'mysqldump_dolibarr_24.0.0.sql' dolibarr_test 3306 dolibarr_test xxxxpass
|
||||
|
||||
|
||||
***** To force all event in the blockedlog to year 2025
|
||||
UPDATE votre_table SET
|
||||
date_object = STR_TO_DATE(CONCAT('2025-', DATE_FORMAT(date_object, '%m-%d')), '%Y-%m-%d'),
|
||||
date_creation = STR_TO_DATE(CONCAT('2025-', DATE_FORMAT(date_creation, '%m-%d')), '%Y-%m-%d');
|
||||
|
||||
|
||||
***** To force date of a server to make tests
|
||||
sudo timedatectl set-ntp false; sudo timedatectl set-time "2025-01-15 09:30:00"; sudo timedatectl status;
|
||||
sudo /etc/init.d/apache2 stop; sudo /etc/init.d/apache2 start; sudo /etc/init.d/apache2 status;
|
||||
|
||||
***** To restore current date
|
||||
sudo timedatectl set-ntp true
|
||||
|
||||
Reference in New Issue
Block a user