} $id = GETPOST('id', 'alpha'); // We accept non numeric id. We will filter later. // create a jobs object $object = new Cronjob($db); $filter = array(); if (!empty($id)) { if (!is_numeric($id)) { echo "Error: Bad value for parameter job id"; dol_syslog("cron_run_jobs.php Bad value for parameter job id", LOG_WARNING); exit; } $filter = array(); $filter['t.rowid'] = $id; } $result = $object->fetch_all('DESC', 't.rowid', 0, 0, 1, $filter); if ($result < 0) { echo "Error: " . $cronjob->error; dol_syslog("cron_run_jobs.php fetch Error" . $cronjob->error, LOG_WARNING); exit; } // current date $now = dol_now(); $nbofjobs = count($object->lines); $nbofjobslaunchedok = 0; $nbofjobslaunchedko = 0; if (is_array($object->lines) && count($object->lines) > 0) { // Loop over job foreach ($object->lines as $line) { dol_syslog("cron_run_jobs.php fetch cronjobid: " . $line->id, LOG_WARNING); //If date_next_jobs is less of current dat, execute the program, and store the execution time of the next execution in database
* View */ $form = new Form($db); $pagetitle = $langs->trans("CronList"); llxHeader('', $pagetitle); print_fiche_titre($pagetitle, '', 'setup'); print $langs->trans('CronInfo'); if ($action == 'delete') { print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=" . $id . '&status=' . $status, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1); } if ($action == 'execute') { print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=" . $id . '&status=' . $status, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1); } // liste des jobs creer $object = new Cronjob($db); $result = $object->fetch_all($sortorder, $sortfield, $limit, $offset, $status, $filter); if ($result < 0) { setEventMessage($object->error, 'errors'); } print "<br><br>"; print '<form method="GET" action="' . $url_form . '" name="search_form">' . "\n"; print '<input type="hidden" name="status" value="' . $status . '" >'; print '<table width="100%" class="noborder">'; print '<tr class="liste_titre">'; $arg_url = '&page=' . $page . '&status=' . $status . '&search_label=' . $search_label; print_liste_field_titre($langs->trans("CronLabel"), $_SERVEUR['PHP_SELF'], "t.label", "", $arg_url, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("CronTask"), '', '', "", $arg_url, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("CronDtStart"), $_SERVEUR['PHP_SELF'], "t.datestart", "", $arg_url, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("CronDtEnd"), $_SERVEUR['PHP_SELF'], "t.dateend", "", $arg_url, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("CronDtLastLaunch"), $_SERVEUR['PHP_SELF'], "t.datelastrun", "", $arg_url, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("CronDtNextLaunch"), $_SERVEUR['PHP_SELF'], "t.datenextrun", "", $arg_url, '', $sortfield, $sortorder);