Revert option ECM_AUTO_TREE_ENABLED into ECM_AUTO_TREE_HIDEN

This commit is contained in:
Laurent Destailleur 2023-01-02 02:23:28 +01:00
parent 73e5d6d2d2
commit f3bdecd111
5 changed files with 22 additions and 21 deletions

View File

@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->load("admin");
$action = GETPOST('action', 'aZ09');
if (!$user->admin) {
accessforbidden();
}
@ -41,6 +43,7 @@ if (!$user->admin) {
*/
// set
$reg = array();
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
@ -67,6 +70,8 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
* View
*/
$form = new Form($db);
$help_url = '';
llxHeader('', $langs->trans("ECMSetup"), $help_url);
@ -81,26 +86,21 @@ print dol_get_fiche_head($head, 'ecm', '', -1, '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '<td class="center" width="100px">'.$langs->trans("Value").'</td>'."\n";
print '</tr>';
$form = new Form($db);
// Mail required for members
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ECMAutoTree").'</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" width="100">';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('ECM_AUTO_TREE_ENABLED');
print ajax_constantonoff('ECM_AUTO_TREE_HIDEN', null, null, 1);
} else {
if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} elseif (!empty($conf->global->USER_MAIL_REQUIRED)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
}
print '</td></tr>';

View File

@ -54,7 +54,7 @@ function ecm_prepare_dasboard_head($object)
$head[$h][2] = 'index';
$h++;
if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) {
$head[$h][0] = DOL_URL_ROOT.'/ecm/index_auto.php';
$head[$h][1] = $langs->trans("ECMSectionsAuto").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3);
$head[$h][2] = 'index_auto';

View File

@ -74,12 +74,6 @@ class modECM extends DolibarrModules
$this->const = array(); // List of parameters
$r = 0;
$this->const[$r][0] = "ECM_AUTO_TREE_ENABLED";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "1";
$this->const[$r][3] = 'Auto tree is enabled by default';
$this->const[$r][4] = 0;
// Boxes
$this->boxes = array(); // List of boxes
$r = 0;
@ -182,7 +176,7 @@ class modECM extends DolibarrModules
'langs'=>'ecm',
'position'=>103,
'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload',
'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("ECM_AUTO_TREE_ENABLED")',
'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")',
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);

View File

@ -309,7 +309,7 @@ llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $m
// Add sections to manage
$rowspan = 0;
$sectionauto = array();
if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) {
if (isModEnabled("product") || isModEnabled("service")) {
$langs->load("products");
$rowspan++; $sectionauto[] = array('position'=>10, 'level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts"));

View File

@ -490,6 +490,13 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
migrate_contractdet_rank();
}
// Scripts for 18.0
$afterversionarray = explode('.', '170.9');
$beforeversionarray = explode('.', '18.0.9');
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
migrate_contractdet_rank();
}
}