Skip to content

Commit

Permalink
#251 [Mod] fix: check saturne before enabled module
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Mar 7, 2023
1 parent 98b295d commit 8279f43
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/modules/modDoliMeet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ public function __construct($db)
global $langs, $conf;
$this->db = $db;

require_once __DIR__ . '/../../../saturne/lib/saturne_functions.lib.php';

saturne_load_langs(['dolimeet@dolimeet']);
if (isModEnabled('saturne')) {
require_once __DIR__ . '/../../../saturne/lib/saturne_functions.lib.php';
saturne_load_langs(['dolimeet@dolimeet']);
} else {
$this->error++;
$this->errors[] = $langs->trans('activateModuleDependNotSatisfied', 'DoliMeet', 'Saturne');
}

// ID for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
Expand Down Expand Up @@ -564,7 +568,8 @@ public function init($options = ''): int
dolibarr_set_const($this->db, 'DOLIMEET_VERSION', $this->version, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($this->db, 'DOLIMEET_DB_VERSION', $this->version, 'chaine', 0, '', $conf->entity);

if ($result < 0) {
if ($result < 0 || $this->error > 0) {
setEventMessages('', $this->errors, 'errors');
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

Expand Down

0 comments on commit 8279f43

Please sign in to comment.