Browse Source

Fix button to save must be hidden if in readonly mode

Laurent Destailleur 1 year ago
parent
commit
dea7edc22a
1 changed files with 7 additions and 5 deletions
  1. 7 5
      htdocs/cron/admin/cron.php

+ 7 - 5
htdocs/cron/admin/cron.php

@@ -94,13 +94,13 @@ if (getDolGlobalString('CRON_DISABLE_KEY_CHANGE')) {
 }
 print '<td>';
 if (!getDolGlobalString('CRON_DISABLE_KEY_CHANGE')) {
-	print '<input type="text" class="flat minwidth300"'.$disabled.' id="CRON_KEY" name="CRON_KEY" value="'.(GETPOST('CRON_KEY') ? GETPOST('CRON_KEY') : (getDolGlobalString('CRON_KEY') ? $conf->global->CRON_KEY : '')).'">';
+	print '<input type="text" class="flat minwidth300 widthcentpercentminusx"'.$disabled.' id="CRON_KEY" name="CRON_KEY" value="'.(GETPOST('CRON_KEY') ? GETPOST('CRON_KEY') : getDolGlobalString('CRON_KEY')).'">';
 	if (!empty($conf->use_javascript_ajax)) {
 		print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
 	}
 } else {
-	print(getDolGlobalString('CRON_KEY') ? $conf->global->CRON_KEY : '');
-	print '<input type="hidden" id="CRON_KEY" name="CRON_KEY" value="'.(GETPOST('CRON_KEY') ? GETPOST('CRON_KEY') : (getDolGlobalString('CRON_KEY') ? $conf->global->CRON_KEY : '')).'">';
+	print getDolGlobalString('CRON_KEY');
+	print '<input type="hidden" id="CRON_KEY" name="CRON_KEY" value="'.(GETPOST('CRON_KEY') ? GETPOST('CRON_KEY') : getDolGlobalString('CRON_KEY')).'">';
 }
 print '</td>';
 print '<td>&nbsp;</td>';
@@ -110,7 +110,9 @@ print '</table>';
 
 print dol_get_fiche_end();
 
-print $form->buttonsSaveCancel("Save", '');
+if (!getDolGlobalString('CRON_DISABLE_KEY_CHANGE')) {
+	print $form->buttonsSaveCancel("Save", '');
+}
 
 print '</form>';
 
@@ -119,7 +121,7 @@ print '<br><br><br>';
 
 //print $langs->trans("UseMenuModuleToolsToAddCronJobs", dol_buildpath('/cron/list.php?leftmenu=admintools', 1)).'<br>';
 if (getDolGlobalString('CRON_WARNING_DELAY_HOURS')) {
-	print info_admin($langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS)).'<br>';
+	print info_admin($langs->trans("WarningCronDelayed", getDolGlobalString('CRON_WARNING_DELAY_HOURS'))).'<br>';
 }
 
 print '<br>';