Debug v16

This commit is contained in:
Laurent Destailleur 2022-06-30 12:37:41 +02:00
parent 78831513a7
commit 7acf02d6da
5 changed files with 18 additions and 13 deletions

View File

@ -768,7 +768,7 @@ if (($action == "create") || ($action == "edit")) {
if (!$user->rights->cron->create) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").'</a>';
} else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Clone").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&token='.newToken().'&id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
if (empty($object->status)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&token='.newToken().'&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>';

View File

@ -869,7 +869,7 @@ class Cronjob extends CommonObject
// Clear fields
$object->status = self::STATUS_DISABLED;
$object->label = $langs->trans("CopyOf").' '.$object->label;
$object->label = $langs->trans("CopyOf").' '.$langs->trans($object->label);
// Create clone
$object->context['createfromclone'] = 'createfromclone';

View File

@ -33,10 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "cron", "bills", "members"));
if (!$user->rights->cron->read) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$confirm = GETPOST('confirm', 'alpha');
@ -87,6 +83,15 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Security
if (!$user->rights->cron->read) {
accessforbidden();
}
$permissiontoread = $user->rights->cron->read;
$permissiontoadd = $user->rights->cron->create ? $user->rights->cron->create : $user->rights->cron->write;
$permissiontodelete = $user->rights->cron->delete;
$permissiontoexecute = $user->rights->cron->execute;
/*
@ -129,7 +134,7 @@ if (empty($reshook)) {
}
// Delete jobs
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete) {
if ($action == 'confirm_delete' && $confirm == "yes" && $permissiontodelete) {
//Delete cron task
$object = new Cronjob($db);
$object->id = $id;
@ -141,7 +146,7 @@ if (empty($reshook)) {
}
// Execute jobs
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute) {
if ($action == 'confirm_execute' && $confirm == "yes" && $permissiontoexecute) {
if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey) {
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
$action = '';
@ -196,9 +201,6 @@ if (empty($reshook)) {
// Mass actions
$objectclass = 'CronJob';
$objectlabel = 'CronJob';
$permissiontoread = $user->rights->cron->read;
$permissiontoadd = $user->rights->cron->create ? $user->rights->cron->create : $user->rights->cron->write;
$permissiontodelete = $user->rights->cron->delete;
$uploaddir = $conf->cron->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction && $permissiontoadd) {
@ -353,7 +355,7 @@ if ($action == 'execute') {
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1);
}
if ($action == 'delete') {
if ($action == 'delete' && empty($toselect)) { // Used when we make a delete on 1 line (not used for mass delete)
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1);
}
@ -386,7 +388,6 @@ if ($optioncss != '') {
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';

View File

@ -650,3 +650,5 @@ ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN ext_payment_id varchar
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (140, 'PCN2020-LUXEMBURG', 'Plan comptable normalisé 2020 Luxembourgeois', 1);
ALTER TABLE llx_cronjob ADD UNIQUE INDEX uk_cronjob (label, entity);

View File

@ -21,3 +21,5 @@ ALTER TABLE llx_cronjob ADD INDEX idx_cronjob_datelastrun (datelastrun);
ALTER TABLE llx_cronjob ADD INDEX idx_cronjob_datenextrun (datenextrun);
ALTER TABLE llx_cronjob ADD INDEX idx_cronjob_datestart (datestart);
ALTER TABLE llx_cronjob ADD INDEX idx_cronjob_dateend (dateend);
ALTER TABLE llx_cronjob ADD UNIQUE INDEX uk_cronjob (label, entity);