Skip to content

Commit

Permalink
[TPL] fix: backward compatibility for user group
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Mar 7, 2022
1 parent 978d6eb commit 54cc598
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions core/tpl/digiriskdolibarr_projectcreation_action.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_READERGROUP_SET', $usergroup_id, 'integer', 0, '', $conf->entity);
}

if ( $conf->global->DIGIRISKDOLIBARR_READERGROUP_UPDATED == 0 ) {
$usergroup_id = $conf->global->DIGIRISKDOLIBARR_READERGROUP_SET;
if ($usergroup_id > 0) {
$usergroup->fetch($usergroup_id);
$usergroup->name = $conf->global->MAIN_INFO_SOCIETE_NOM . ' - ' . $langs->trans('DigiriskReaderGroup');
$usergroup->note = $langs->trans('DigiriskReaderGroupDescription');
$usergroup->update($user);
}
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_READERGROUP_UPDATED', 1, 'integer', 0, '', $conf->entity);
}

if ( $conf->global->DIGIRISKDOLIBARR_USERGROUP_SET == 0 ) {
require_once DOL_DOCUMENT_ROOT . '/user/class/usergroup.class.php';

Expand Down Expand Up @@ -297,6 +308,17 @@
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_USERGROUP_UPDATED', 1, 'integer', 0, '', $conf->entity);
}

if ( $conf->global->DIGIRISKDOLIBARR_USERGROUP_UPDATED == 1 ) {
$usergroup_id = $conf->global->DIGIRISKDOLIBARR_USERGROUP_SET;
if ($usergroup_id > 0) {
$usergroup->fetch($usergroup_id);
$usergroup->name = $conf->global->MAIN_INFO_SOCIETE_NOM . ' - ' . $langs->trans('DigiriskReaderGroup');
$usergroup->note = $langs->trans('DigiriskReaderGroupDescription');
$usergroup->update($user);
}
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_USERGROUP_UPDATED', 2, 'integer', 0, '', $conf->entity);
}

if ( $conf->global->DIGIRISKDOLIBARR_ADMINUSERGROUP_SET == 0 ) {
require_once DOL_DOCUMENT_ROOT . '/user/class/usergroup.class.php';

Expand Down Expand Up @@ -349,6 +371,17 @@
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_ADMINUSERGROUP_UPDATED', 1, 'integer', 0, '', $conf->entity);
}

if ( $conf->global->DIGIRISKDOLIBARR_ADMINUSERGROUP_UPDATED == 1 ) {
$usergroup_id = $conf->global->DIGIRISKDOLIBARR_ADMINUSERGROUP_SET;
if ($usergroup_id > 0) {
$usergroup->fetch($usergroup_id);
$usergroup->name = $conf->global->MAIN_INFO_SOCIETE_NOM . ' - ' . $langs->trans('DigiriskAdminUserGroup');
$usergroup->note = $langs->trans('DigiriskAdminUserGroupDescription');
$usergroup->update($user);
}
dolibarr_set_const($db, 'DIGIRISKDOLIBARR_ADMINUSERGROUP_UPDATED', 2, 'integer', 0, '', $conf->entity);
}

if ($conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH_UPDATED == 0) {
require_once __DIR__ . '/../../class/digiriskelement/groupment.class.php';

Expand Down

0 comments on commit 54cc598

Please sign in to comment.