Debug v23

This commit is contained in:
Laurent Destailleur 2026-01-08 21:45:10 +01:00
parent aa0b793f78
commit 5eb088cbfc
2 changed files with 29 additions and 8 deletions

View file

@ -1709,6 +1709,25 @@ class BlockedLog
}
/**
* Check if module can be enabled.
*
* @return string '' if ok, error message if not possible
*/
public function canBeEnabled()
{
global $dolibarr_main_force_https;
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
if (isALNEQualifiedVersion(0, 1) && empty($dolibarr_main_force_https)) {
return 'Error: The HTTPS must be forced by setting the $dolibarr_main_force_https into Dolibarr conf/conf.php file to allow the use of this module in France.';
}
return '';
}
/**
* Check if module can be disabled.
*
@ -1718,6 +1737,8 @@ class BlockedLog
{
global $mysoc;
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
$canbedisabled = 1;
if (isALNEQualifiedVersion() && $mysoc->country_code == 'FR') {
$canbedisabled = 0;

View file

@ -171,17 +171,20 @@ class modBlockedLog extends DolibarrModules
$sql = array();
require_once DOL_DOCUMENT_ROOT . '/blockedlog/class/blockedlog.class.php';
$b = new BlockedLog($this->db);
$this->db->begin();
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
// Check that the HTTPS is forced
global $dolibarr_main_force_https;
if (isALNEQualifiedVersion(0, 1) && empty($dolibarr_main_force_https)) {
$this->error = 'Error: The HTTPS must be forced by setting the $dolibarr_main_force_https into Dolibarr conf/conf.php file to allow the use of this module in France.';
$s = $b->canBeEnabled();
if ($s) { // Activation not allowed
$this->error = $s;
return 0;
}
@ -217,7 +220,6 @@ class modBlockedLog extends DolibarrModules
// We add an entry to show we enable module
require_once DOL_DOCUMENT_ROOT . '/blockedlog/class/blockedlog.class.php';
$object = new stdClass();
$object->id = 0;
@ -226,8 +228,6 @@ class modBlockedLog extends DolibarrModules
$object->entity = $conf->entity;
$object->date = dol_now();
$b = new BlockedLog($this->db);
// Add first entry in unalterable Log to track that module was activated
$action = 'MODULE_SET';
$result = $b->setObjectData($object, $action, 0, $user, null);