--- /tmp/dsg/dolibarr/htdocs/cron/github_card.php
+++ /tmp/dsg/dolibarr/htdocs/cron/client_card.php
@@ -39,12 +39,10 @@
if (!$user->rights->cron->create) accessforbidden();
$id = GETPOST('id', 'int');
-$action = GETPOST('action', 'aZ09');
+$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
-$backtopage = GETPOST('backtopage', 'alpha');
-$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
-
+$backtourl = GETPOST('backtourl', 'alpha');
$securitykey = GETPOST('securitykey', 'alpha');
@@ -64,18 +62,22 @@
if (!empty($cancel))
{
- if (!empty($id) && empty($backtopage))
+ if (!empty($id) && empty($backtourl))
{
$action = '';
- } else {
- if ($backtopage)
- {
- header("Location: ".$backtopage);
- exit;
- } else {
- header("Location: ".DOL_URL_ROOT.'/cron/list.php');
- exit;
- }
+ }
+ else
+ {
+ if ($backtourl)
+ {
+ header("Location: ".$backtourl);
+ exit;
+ }
+ else
+ {
+ header("Location: ".DOL_URL_ROOT.'/cron/list.php');
+ exit;
+ }
}
}
@@ -88,7 +90,9 @@
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
- } else {
+ }
+ else
+ {
Header("Location: ".DOL_URL_ROOT.'/cron/list.php');
exit;
}
@@ -97,50 +101,56 @@
// Execute jobs
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute)
{
- if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
- {
- setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
- $action = '';
- } else {
- $now = dol_now(); // Date we start
-
- $result = $object->run_jobs($user->login);
-
- if ($result < 0)
- {
- setEventMessages($object->error, $object->errors, 'errors');
- $action = '';
- } else {
- $res = $object->reprogram_jobs($user->login, $now);
- if ($res > 0)
- {
- if ($object->lastresult > 0) setEventMessages($langs->trans("JobFinished"), null, 'warnings');
- else setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
- $action = '';
- } else {
- setEventMessages($object->error, $object->errors, 'errors');
- $action = '';
- }
- }
- }
+ if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
+ {
+ setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
+ $action = '';
+ }
+ else
+ {
+ $now = dol_now(); // Date we start
+
+ $result = $object->run_jobs($user->login);
+
+ if ($result < 0)
+ {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = '';
+ }
+ else
+ {
+ $res = $object->reprogram_jobs($user->login, $now);
+ if ($res > 0)
+ {
+ if ($object->lastresult > 0) setEventMessages($langs->trans("JobFinished"), null, 'warnings');
+ else setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
+ $action = '';
+ }
+ else
+ {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = '';
+ }
+ }
+ }
}
if ($action == 'add')
{
- $object->jobtype = GETPOST('jobtype');
- $object->label = GETPOST('label');
- $object->command = GETPOST('command');
- $object->classesname = GETPOST('classesname', 'alphanohtml');
- $object->objectname = GETPOST('objectname', 'aZ09');
- $object->methodename = GETPOST('methodename', 'aZ09');
+ $object->jobtype = GETPOST('jobtype', 'alpha');
+ $object->label = GETPOST('label', 'alpha');
+ $object->command = GETPOST('command', 'alpha');
+ $object->priority = GETPOST('priority', 'int');
+ $object->classesname = GETPOST('classesname', 'alpha');
+ $object->objectname = GETPOST('objectname', 'alpha');
+ $object->methodename = GETPOST('methodename', 'alpha');
$object->params = GETPOST('params');
$object->md5params = GETPOST('md5params');
- $object->module_name = GETPOST('module_name');
- $object->note_private = GETPOST('note', 'restricthtml');
+ $object->module_name = GETPOST('module_name', 'alpha');
+ $object->note = GETPOST('note', 'none');
$object->datestart = dol_mktime(GETPOST('datestarthour', 'int'), GETPOST('datestartmin', 'int'), 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'));
$object->dateend = dol_mktime(GETPOST('dateendhour', 'int'), GETPOST('dateendmin', 'int'), 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'));
- $object->priority = GETPOST('priority', 'int');
$object->datenextrun = dol_mktime(GETPOST('datenextrunhour', 'int'), GETPOST('datenextrunmin', 'int'), 0, GETPOST('datenextrunmonth', 'int'), GETPOST('datenextrunday', 'int'), GETPOST('datenextrunyear', 'int'));
$object->unitfrequency = GETPOST('unitfrequency', 'int');
$object->frequency = GETPOST('nbfrequency', 'int');
@@ -153,7 +163,8 @@
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
- } else {
+ }
+ else {
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action = '';
}
@@ -166,16 +177,16 @@
$object->jobtype = GETPOST('jobtype');
$object->label = GETPOST('label');
$object->command = GETPOST('command');
- $object->classesname = GETPOST('classesname', 'alphanohtml');
- $object->objectname = GETPOST('objectname', 'aZ09');
- $object->methodename = GETPOST('methodename', 'aZ09');
+ $object->classesname = GETPOST('classesname', 'alpha');
+ $object->priority = GETPOST('priority', 'int');
+ $object->objectname = GETPOST('objectname', 'alpha');
+ $object->methodename = GETPOST('methodename', 'alpha');
$object->params = GETPOST('params');
$object->md5params = GETPOST('md5params');
- $object->module_name = GETPOST('module_name');
- $object->note_private = GETPOST('note', 'restricthtml');
+ $object->module_name = GETPOST('module_name', 'alpha');
+ $object->note = GETPOST('note', 'none');
$object->datestart = dol_mktime(GETPOST('datestarthour', 'int'), GETPOST('datestartmin', 'int'), 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'));
$object->dateend = dol_mktime(GETPOST('dateendhour', 'int'), GETPOST('dateendmin', 'int'), 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'));
- $object->priority = GETPOST('priority', 'int');
$object->datenextrun = dol_mktime(GETPOST('datenextrunhour', 'int'), GETPOST('datenextrunmin', 'int'), 0, GETPOST('datenextrunmonth', 'int'), GETPOST('datenextrunday', 'int'), GETPOST('datenextrunyear', 'int'));
$object->unitfrequency = GETPOST('unitfrequency', 'int');
$object->frequency = GETPOST('nbfrequency', 'int');
@@ -188,7 +199,8 @@
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
- } else {
+ }
+ else {
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action = '';
}
@@ -205,7 +217,8 @@
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
- } else {
+ }
+ else {
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action = '';
}
@@ -223,7 +236,8 @@
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
- } else {
+ }
+ else {
setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
$action = '';
}
@@ -243,7 +257,8 @@
if ($action == 'edit' || empty($action) || $action == 'delete' || $action == 'execute')
{
$head = cron_prepare_head($object);
-} elseif ($action == 'create')
+}
+elseif ($action == 'create')
{
print load_fiche_titre($langs->trans("CronTask"), '', 'title_setup');
}
@@ -299,7 +314,7 @@
{
print '
\n";
-} else {
+}
+else
+{
/*
* view card
*/
- $now = dol_now();
-
- print dol_get_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron');
+ $now = dol_now();
+
+ dol_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron');
$linkback = ''.$langs->trans("BackToList").'';
@@ -583,9 +611,7 @@
print '';
print $langs->trans('CronNote')." | ";
- if (!is_null($object->note_private) && $object->note_private != '') {
- print $langs->trans($object->note_private);
- }
+ print $langs->trans($object->note);
print " |
";
if (!empty($conf->multicompany->enabled))
@@ -595,7 +621,9 @@
if (!$object->entity)
{
print $langs->trans("AllEntities");
- } else {
+ }
+ else
+ {
$mc->getInfo($object->entity);
print $mc->label;
}
@@ -603,7 +631,7 @@
}
print '';
- print '';
+ print '';
print '
';
@@ -623,12 +651,12 @@
print '';
print $langs->trans('CronDtStart')." | ";
- if (!empty($object->datestart)) {print $form->textwithpicto(dol_print_date($object->datestart, 'dayhoursec'), $langs->trans("CurrentTimeZone")); }
+ if (!empty($object->datestart)) {print dol_print_date($object->datestart, 'dayhoursec'); }
print " |
";
print "";
print $langs->trans('CronDtEnd')." | ";
- if (!empty($object->dateend)) {print $form->textwithpicto(dol_print_date($object->dateend, 'dayhoursec'), $langs->trans("CurrentTimeZone")); }
+ if (!empty($object->dateend)) {print dol_print_date($object->dateend, 'dayhoursec'); }
print " |
";
print "";
@@ -653,7 +681,8 @@
print ' ('.$langs->trans('CronFrom').')';
print " | ";
if (!$object->status) print $langs->trans("Disabled");
- elseif (!empty($object->datenextrun)) { print img_picto('', 'object_calendarday').' '.$form->textwithpicto(dol_print_date($object->datenextrun, 'dayhoursec'), $langs->trans("CurrentTimeZone")); } else { print $langs->trans('CronNone'); }
+ elseif (!empty($object->datenextrun)) { print img_picto('', 'object_calendarday').' '.dol_print_date($object->datenextrun, 'dayhoursec'); }
+ else { print $langs->trans('CronNone'); }
if ($object->status == Cronjob::STATUS_ENABLED)
{
if ($object->maxrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("MaxRunReached"));
@@ -672,12 +701,12 @@
print ' |
';
print $langs->trans('CronDtLastLaunch')." | ";
- if (!empty($object->datelastrun)) {print $form->textwithpicto(dol_print_date($object->datelastrun, 'dayhoursec'), $langs->trans("CurrentTimeZone")); } else {print $langs->trans('CronNone'); }
+ if (!empty($object->datelastrun)) {print dol_print_date($object->datelastrun, 'dayhoursec'); } else {print $langs->trans('CronNone'); }
print " |
";
print '';
print $langs->trans('CronDtLastResult')." | ";
- if (!empty($object->datelastresult)) {print $form->textwithpicto(dol_print_date($object->datelastresult, 'dayhoursec'), $langs->trans("CurrentTimeZone")); } else {print $langs->trans('CronNone'); }
+ if (!empty($object->datelastresult)) {print dol_print_date($object->datelastresult, 'dayhoursec'); } else {print $langs->trans('CronNone'); }
print " |
";
print '';
@@ -693,9 +722,9 @@
print " |
";
print '';
- print '';
-
- print dol_get_fiche_end();
+ print '';
+
+ dol_fiche_end();
print "\n\n';
--- /tmp/dsg/dolibarr/htdocs/cron/github_info.php
+++ /tmp/dsg/dolibarr/htdocs/cron/client_info.php
@@ -48,7 +48,7 @@
$head = cron_prepare_head($object);
-print dol_get_fiche_head($head, 'info', $langs->trans("CronTask"), -1, 'cron');
+dol_fiche_head($head, 'info', $langs->trans("CronTask"), -1, 'cron');
$linkback = ''.$langs->trans("BackToList").'';
--- /tmp/dsg/dolibarr/htdocs/cron/github_list.php
+++ /tmp/dsg/dolibarr/htdocs/cron/client_list.php
@@ -36,7 +36,7 @@
if (!$user->rights->cron->read) accessforbidden();
-$action = GETPOST('action', 'aZ09');
+$action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
@@ -55,12 +55,10 @@
if (!$sortfield) $sortfield = 't.status,t.priority';
if (!$sortorder) $sortorder = 'DESC,ASC';
-$mode = GETPOST('mode', 'aZ09');
+$search_status = (GETPOSTISSET('search_status') ?GETPOST('search_status', 'int') : GETPOST('status', 'int'));
+
//Search criteria
-$search_status = (GETPOSTISSET('search_status') ?GETPOST('search_status', 'int') : GETPOST('status', 'int'));
$search_label = GETPOST("search_label", 'alpha');
-$search_module_name = GETPOST("search_module_name", 'alpha');
-$search_lastresult = GETPOST("search_lastresult", "alpha");
$securitykey = GETPOST('securitykey', 'alpha');
$diroutputmassaction = $conf->cronjob->dir_output.'/temp/massgeneration/'.$user->id;
@@ -99,7 +97,6 @@
{
$search_label = '';
$search_status = -1;
- $search_lastresult = '';
$toselect = '';
$search_array_options = array();
}
@@ -131,47 +128,51 @@
// Execute jobs
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute)
{
- if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
- {
- setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
- $action = '';
- } else {
- $object = new Cronjob($db);
- $job = $object->fetch($id);
-
- $now = dol_now(); // Date we start
-
- $resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK
- if ($resrunjob < 0) {
- setEventMessages($object->error, $object->errors, 'errors');
- }
-
- // Programm next run
- $res = $object->reprogram_jobs($user->login, $now);
- if ($res > 0)
- {
- if ($resrunjob >= 0) // We show the result of reprogram only if no error message already reported
- {
- if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
- else setEventMessages($langs->trans("JobFinished"), null, 'errors');
- }
- $action = '';
- } else {
- setEventMessages($object->error, $object->errors, 'errors');
- $action = '';
- }
-
- $param = '&search_status='.urlencode($search_status);
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
- if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
- if ($search_label) $param .= '&search_label='.urlencode($search_label);
- if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
- // Add $param from extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
-
- header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '')); // Make a redirect to avoid to run twice the job when using back
- exit;
- }
+ if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
+ {
+ setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
+ $action = '';
+ }
+ else
+ {
+ $object = new Cronjob($db);
+ $job = $object->fetch($id);
+
+ $now = dol_now(); // Date we start
+
+ $resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK
+ if ($resrunjob < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ // Programm next run
+ $res = $object->reprogram_jobs($user->login, $now);
+ if ($res > 0)
+ {
+ if ($resrunjob >= 0) // We show the result of reprogram only if no error message already reported
+ {
+ if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
+ else setEventMessages($langs->trans("JobFinished"), null, 'errors');
+ }
+ $action = '';
+ }
+ else
+ {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = '';
+ }
+
+ $param = '&search_status='.urlencode($search_status);
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
+ if ($search_label) $param .= '&search_label='.urlencode($search_label);
+ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
+ // Add $param from extra fields
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
+
+ header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '')); // Make a redirect to avoid to run twice the job when using back
+ exit;
+ }
}
// Mass actions
@@ -195,7 +196,9 @@
elseif ($massaction == 'enable') $result = $tmpcron->setStatut(Cronjob::STATUS_ENABLED);
//else dol_print_error($db, 'Bad value for massaction');
if ($result < 0) setEventMessages($tmpcron->error, $tmpcron->errors, 'errors');
- } else {
+ }
+ else
+ {
$error++;
}
}
@@ -213,6 +216,7 @@
$pagetitle = $langs->trans("CronList");
llxHeader('', $pagetitle);
+
$sql = "SELECT";
$sql .= " t.rowid,";
@@ -249,7 +253,6 @@
$sql .= " FROM ".MAIN_DB_PREFIX."cronjob as t";
$sql .= " WHERE entity IN (0,".$conf->entity.")";
if ($search_status >= 0 && $search_status < 2 && $search_status != '') $sql .= " AND t.status = ".(empty($search_status) ? '0' : '1');
-if ($search_lastresult != '') $sql .= natural_search("t.lastresult", $search_lastresult, 1);
//Manage filter
if (is_array($filter) && count($filter) > 0) {
foreach ($filter as $key => $value) {
@@ -257,8 +260,8 @@
}
}
$sqlwhere = array();
-if (!empty($search_module_name)) {
- $sqlwhere[] = '(t.module_name='.$db->escape($search_module_name).')';
+if (!empty($module_name)) {
+ $sqlwhere[] = '(t.module_name='.$db->escape($module_name).')';
}
if (count($sqlwhere) > 0) {
$sql .= " WHERE ".implode(' AND ', $sqlwhere);
@@ -276,13 +279,13 @@
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
- $result = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($result);
- if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
- {
- $page = 0;
- $offset = 0;
- }
+ $result = $db->query($sql);
+ $nbtotalofrecords = $db->num_rows($result);
+ if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
+ {
+ $page = 0;
+ $offset = 0;
+ }
}
$sql .= $db->plimit($limit + 1, $offset);
@@ -299,9 +302,6 @@
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_status) $param .= '&search_status='.urlencode($search_status);
if ($search_label) $param .= '&search_label='.urlencode($search_label);
-if ($search_module_name) $param .= '&search_module_name='.urlencode($search_module_name);
-if ($search_lastresult) $param .= '&search_lastresult='.urlencode($search_lastresult);
-if ($mode) $param .= '&mode='.urlencode($mode);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -328,13 +328,6 @@
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
-if ($mode == 'modulesetup') {
- $linkback = ''.$langs->trans("BackToModuleList").'';
- print load_fiche_titre($langs->trans("CronSetup"), $linkback, 'title_setup');
-
- // Configuration header
- $head = cronadmin_prepare_head();
-}
print '