dolibarr  7.0.0-beta
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
3  * Copyright (C) 2013 Florian Henry <florian.henry@open-concpt.pro>
4  * Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
26 require '../main.inc.php';
27 
28 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
29 
30 // librairie jobs
31 require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php";
32 require_once DOL_DOCUMENT_ROOT."/core/class/html.formcron.class.php";
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
34 
35 
36 $langs->load("admin");
37 $langs->load("cron");
38 
39 if (!$user->rights->cron->create) accessforbidden();
40 
41 $id=GETPOST('id','int');
42 $action=GETPOST('action','alpha');
43 $confirm=GETPOST('confirm','alpha');
44 $cancel=GETPOST('cancel','alpha');
45 $backtourl=GETPOST('backtourl','alpha');
46 $securitykey = GETPOST('securitykey','alpha');
47 
48 
49 /*
50  * Actions
51  */
52 
53 $object = new Cronjob($db);
54 if (!empty($id))
55 {
56  $result=$object->fetch($id);
57  if ($result < 0)
58  {
59  setEventMessages($object->error, $object->errors, 'errors');
60  }
61 }
62 
63 if (!empty($cancel))
64 {
65  if (!empty($id) && empty($backtourl))
66  {
67  $action='';
68  }
69  else
70  {
71  if ($backtourl)
72  {
73  header("Location: ".$backtourl);
74  exit;
75  }
76  else
77  {
78  header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-2');
79  exit;
80  }
81  }
82 }
83 
84 // Delete jobs
85 if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete)
86 {
87  $result = $object->delete($user);
88 
89  if ($result < 0)
90  {
91  setEventMessages($object->error, $object->errors, 'errors');
92  $action='edit';
93  }
94  else
95  {
96  Header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-2');
97  exit;
98  }
99 }
100 
101 // Execute jobs
102 if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute)
103 {
104  if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
105  {
106  setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
107  $action='';
108  }
109  else
110  {
111  $now = dol_now(); // Date we start
112 
113  $result=$object->run_jobs($user->login);
114 
115  if ($result < 0)
116  {
117  setEventMessages($object->error, $object->errors, 'errors');
118  $action='';
119  }
120  else
121  {
122  $res = $object->reprogram_jobs($user->login, $now);
123  if ($res > 0)
124  {
125  if ($object->lastresult > 0) setEventMessages($langs->trans("JobFinished"), null, 'warnings');
126  else setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
127  $action='';
128  }
129  else
130  {
131  setEventMessages($object->error, $object->errors, 'errors');
132  $action='';
133  }
134  }
135  }
136 }
137 
138 
139 if ($action=='add')
140 {
141  $object->jobtype=GETPOST('jobtype','alpha');
142  $object->label=GETPOST('label','alpha');
143  $object->command=GETPOST('command','alpha');
144  $object->priority=GETPOST('priority','int');
145  $object->classesname=GETPOST('classesname','alpha');
146  $object->objectname=GETPOST('objectname','alpha');
147  $object->methodename=GETPOST('methodename','alpha');
148  $object->params=GETPOST('params');
149  $object->md5params=GETPOST('md5params');
150  $object->module_name=GETPOST('module_name','alpha');
151  $object->note=GETPOST('note','none');
152  $object->datestart=dol_mktime(GETPOST('datestarthour','int'), GETPOST('datestartmin','int'), 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
153  $object->dateend=dol_mktime(GETPOST('dateendhour','int'), GETPOST('dateendmin','int'), 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
154  $object->datenextrun=dol_mktime(GETPOST('datenextrunhour','int'), GETPOST('datenextrunmin','int'), 0, GETPOST('datenextrunmonth','int'), GETPOST('datenextrunday','int'), GETPOST('datenextrunyear','int'));
155  $object->unitfrequency=GETPOST('unitfrequency','int');
156  $object->frequency=GETPOST('nbfrequency','int');
157  $object->maxrun=GETPOST('maxrun','int');
158 
159  // Add cron task
160  $result = $object->create($user);
161 
162  // test du Resultat de la requete
163  if ($result < 0) {
164  setEventMessages($object->error, $object->errors, 'errors');
165  $action='create';
166  }
167  else {
168  setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
169  $action='';
170  }
171 }
172 
173 // Save parameters
174 if ($action=='update')
175 {
176  $object->id=$id;
177  $object->jobtype=GETPOST('jobtype');
178  $object->label=GETPOST('label');
179  $object->command=GETPOST('command');
180  $object->classesname=GETPOST('classesname','alpha');
181  $object->priority=GETPOST('priority','int');
182  $object->objectname=GETPOST('objectname','alpha');
183  $object->methodename=GETPOST('methodename','alpha');
184  $object->params=GETPOST('params');
185  $object->md5params=GETPOST('md5params');
186  $object->module_name=GETPOST('module_name','alpha');
187  $object->note=GETPOST('note','none');
188  $object->datestart=dol_mktime(GETPOST('datestarthour','int'), GETPOST('datestartmin','int'), 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
189  $object->dateend=dol_mktime(GETPOST('dateendhour','int'), GETPOST('dateendmin','int'), 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
190  $object->datenextrun=dol_mktime(GETPOST('datenextrunhour','int'), GETPOST('datenextrunmin','int'), 0, GETPOST('datenextrunmonth','int'), GETPOST('datenextrunday','int'), GETPOST('datenextrunyear','int'));
191  $object->unitfrequency=GETPOST('unitfrequency','int');
192  $object->frequency=GETPOST('nbfrequency','int');
193  $object->maxrun=GETPOST('maxrun','int');
194 
195  // Add cron task
196  $result = $object->update($user);
197 
198  // test du Resultat de la requete
199  if ($result < 0) {
200  setEventMessages($object->error, $object->errors, 'errors');
201  $action='edit';
202  }
203  else {
204  setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
205  $action='';
206  }
207 }
208 
209 if ($action=='activate')
210 {
211  $object->status=1;
212 
213  // Add cron task
214  $result = $object->update($user);
215 
216  // test du Resultat de la requete
217  if ($result < 0) {
218  setEventMessages($object->error, $object->errors, 'errors');
219  $action='edit';
220  }
221  else {
222  setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
223  $action='';
224  }
225 }
226 
227 if ($action=='inactive')
228 {
229  $object->status=0;
230 
231  // Add cron task
232  $result = $object->update($user);
233 
234  // test du Resultat de la requete
235  if ($result < 0) {
236  setEventMessages($object->error, $object->errors, 'errors');
237  $action='edit';
238  }
239  else {
240  setEventMessages($langs->trans('CronSaveSucess'), null, 'mesgs');
241  $action='';
242  }
243 }
244 
245 
246 
247 /*
248  * View
249  */
250 
251 $form = new Form($db);
252 $formCron = new FormCron($db);
253 
254 llxHeader('',$langs->trans("CronAdd"));
255 
256 if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute')
257 {
258  $head=cron_prepare_head($object);
259 }
260 elseif ($action=='create')
261 {
262  print load_fiche_titre($langs->trans("CronTask"),'','title_setup');
263 }
264 
265 if ($conf->use_javascript_ajax)
266 {
267  print "\n".'<script type="text/javascript" language="javascript">';
268  print 'jQuery(document).ready(function () {
269  function initfields()
270  {
271  if ($("#jobtype option:selected").val()==\'method\') {
272  $(".blockmethod").show();
273  $(".blockcommand").hide();
274  }
275  if ($("#jobtype option:selected").val()==\'command\') {
276  $(".blockmethod").hide();
277  $(".blockcommand").show();
278  }
279  }
280  initfields();
281  jQuery("#jobtype").change(function() {
282  initfields();
283  });
284  })';
285  print '</script>'."\n";
286 }
287 
288 if ($action == 'delete')
289 {
290  print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1);
291 
292  $action='';
293 }
294 
295 if ($action == 'execute'){
296  print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id.'&securitykey='.$securitykey,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
297 
298  $action='';
299 }
300 
301 
302 
303 /*
304  * Create Template
305  */
306 
307 if (empty($object->status) && $action != 'create')
308 {
309  setEventMessages($langs->trans("CronTaskInactive"), null, 'warnings');
310 }
311 
312 if (($action=="create") || ($action=="edit"))
313 {
314  print '<form name="cronform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
315  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
316  print '<input type="hidden" name="backtourl" value="'.GETPOST('backtourl').'">'."\n";
317  if (!empty($object->id)) {
318  print '<input type="hidden" name="action" value="update">'."\n";
319  print '<input type="hidden" name="id" value="'.$object->id.'">'."\n";
320  } else {
321  print '<input type="hidden" name="action" value="add">'."\n";
322  }
323 
324  if ($action=="edit") dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron');
325  else dol_fiche_head('');
326 
327  print '<table class="border" width="100%">';
328 
329  print '<tr><td class="fieldrequired titlefieldcreate">';
330  print $langs->trans('CronLabel')."</td>";
331  print "<td><input type=\"text\" size=\"30\" name=\"label\" value=\"".$object->label."\" /> ";
332  print "</td>";
333  print "<td>";
334  print "</td>";
335  print "</tr>\n";
336 
337  print '<tr><td class="fieldrequired">';
338  print $langs->trans('CronType')."</td><td>";
339  print $formCron->select_typejob('jobtype',$object->jobtype);
340  print "</td>";
341  print "<td>";
342  print "</td>";
343  print "</tr>\n";
344 
345  print '<tr class="blockmethod"><td>';
346  print $langs->trans('CronModule')."</td><td>";
347  print "<input type=\"text\" size=\"20\" name=\"module_name\" value=\"".$object->module_name."\" /> ";
348  print "</td>";
349  print "<td>";
350  print $form->textwithpicto('',$langs->trans("CronModuleHelp"),1,'help');
351  print "</td>";
352  print "</tr>\n";
353 
354  print '<tr class="blockmethod"><td>';
355  print $langs->trans('CronClassFile')."</td><td>";
356  print '<input type="text" class="minwidth300" name="classesname" value="'.$object->classesname.'" /> ';
357  print "</td>";
358  print "<td>";
359  print $form->textwithpicto('',$langs->trans("CronClassFileHelp"),1,'help');
360  print "</td>";
361  print "</tr>\n";
362 
363  print '<tr class="blockmethod"><td>';
364  print $langs->trans('CronObject')."</td><td>";
365  print "<input type=\"text\" size=\"20\" name=\"objectname\" value=\"".$object->objectname."\" /> ";
366  print "</td>";
367  print "<td>";
368  print $form->textwithpicto('',$langs->trans("CronObjectHelp"),1,'help');
369  print "</td>";
370  print "</tr>\n";
371 
372  print '<tr class="blockmethod"><td>';
373  print $langs->trans('CronMethod')."</td><td>";
374  print '<input type="text" class="minwidth300" name="methodename" value="'.$object->methodename.'" /> ';
375  print "</td>";
376  print "<td>";
377  print $form->textwithpicto('',$langs->trans("CronMethodHelp"),1,'help');
378  print "</td>";
379  print "</tr>\n";
380 
381  print '<tr class="blockmethod"><td>';
382  print $langs->trans('CronArgs')."</td><td>";
383  print "<input type=\"text\" class=\"quatrevingtpercent\" name=\"params\" value=\"".$object->params."\" /> ";
384  print "</td>";
385  print "<td>";
386  print $form->textwithpicto('',$langs->trans("CronArgsHelp"),1,'help');
387  print "</td>";
388  print "</tr>\n";
389 
390  print '<tr class="blockcommand"><td>';
391  print $langs->trans('CronCommand')."</td><td>";
392  print "<input type=\"text\" size=\"50\" name=\"command\" value=\"".$object->command."\" /> ";
393  print "</td>";
394  print "<td>";
395  print $form->textwithpicto('',$langs->trans("CronCommandHelp"),1,'help');
396  print "</td>";
397  print "</tr>\n";
398 
399  print '<tr><td>';
400  print $langs->trans('CronNote')."</td><td>";
401  $doleditor = new DolEditor('note', $object->note, '', 160, 'dolibarr_notes', 'In', true, false, 0, ROWS_4, '90%');
402  $doleditor->Create();
403  print "</td>";
404  print "<td>";
405  print "</td>";
406  print "</tr>\n";
407 
408  print '<tr><td class="fieldrequired">';
409  print $langs->trans('CronEvery')."</td>";
410  print "<td>";
411  print '<select name="nbfrequency">';
412  for ($i=1; $i<=60; $i++)
413  {
414  if ($object->frequency == $i)
415  {
416  print "<option value='".$i."' selected>".$i."</option>";
417  }
418  else
419  {
420  print "<option value='".$i."'>".$i."</option>";
421  }
422  }
423  print "</select>";
424  $input = " <input type=\"radio\" name=\"unitfrequency\" value=\"60\" id=\"frequency_minute\" ";
425  if($object->unitfrequency=="60")
426  {
427  $input .= ' checked />';
428  }
429  else{
430  $input .= ' />';
431  }
432  $input .= "<label for=\"frequency_minute\">".$langs->trans('Minutes')."</label>";
433  print $input;
434 
435  $input = " <input type=\"radio\" name=\"unitfrequency\" value=\"3600\" id=\"frequency_heures\" ";
436  if($object->unitfrequency=="3600"){
437  $input .= ' checked />';
438  }
439  else{
440  $input .= ' />';
441  }
442  $input .= "<label for=\"frequency_heures\">".$langs->trans('Hours')."</label>";
443  print $input;
444 
445  $input = " <input type=\"radio\" name=\"unitfrequency\" value=\"86400\" id=\"frequency_jours\" ";
446  if($object->unitfrequency=="86400"){
447  $input .= ' checked />';
448  }
449  else{
450  $input .= ' />';
451  }
452  $input .= "<label for=\"frequency_jours\">".$langs->trans('Days')."</label>";
453  print $input;
454 
455  $input = " <input type=\"radio\" name=\"unitfrequency\" value=\"604800\" id=\"frequency_semaine\" ";
456  if($object->unitfrequency=="604800"){
457  $input .= ' checked />';
458  }
459  else{
460  $input .= ' />';
461  }
462  $input .= "<label for=\"frequency_semaine\">".$langs->trans('Weeks')."</label>";
463  print $input;
464  print "</td>";
465  print "<td>";
466  print "</td>";
467  print "</tr>\n";
468 
469  print "<tr><td>";
470  print $langs->trans('CronDtStart')."</td><td>";
471  if(!empty($object->datestart))
472  {
473  $form->select_date($object->datestart,'datestart',1,1,'',"cronform");
474  }
475  else
476  {
477  $form->select_date('','datestart',1,1,'',"cronform");
478  }
479  print "</td>";
480  print "<td>";
481  print "</td>";
482  print "</tr>\n";
483 
484  print "<tr><td>";
485  print $langs->trans('CronDtEnd')."</td><td>";
486  if(!empty($object->dateend)){
487  $form->select_date($object->dateend,'dateend',1,1,'',"cronform");
488  }
489  else{
490  $form->select_date(-1,'dateend',1,1,1,"cronform");
491  }
492  print "</td>";
493  print "<td>";
494  print "</td>";
495  print "</tr>\n";
496 
497  print "<tr><td>";
498  print $langs->trans('CronPriority')."</td>";
499  $priority=0;
500  if (!empty($object->priority)) {
501  $priority=$object->priority;
502  }
503  print "<td><input type=\"text\" size=\"2\" name=\"priority\" value=\"".$priority."\" /> ";
504  print "</td>";
505  print "<td>";
506  print "</td>";
507  print "</tr>\n";
508 
509  print '<tr><td>';
510  $maxrun='';
511  if (!empty($object->maxrun)) {
512  $maxrun=$object->maxrun;
513  }
514  print $langs->trans('CronMaxRun')."</td>";
515  print "<td><input type=\"text\" size=\"2\" name=\"maxrun\" value=\"".$maxrun."\" /> ";
516  print "</td>";
517  print "<td>";
518  print "</td>";
519  print "</tr>\n";
520 
521  print '<tr><td>';
522  print $langs->trans('CronDtNextLaunch');
523  print ' ('.$langs->trans('CronFrom').')';
524  print "</td><td>";
525  if(!empty($object->datenextrun))
526  {
527  $form->select_date($object->datenextrun,'datenextrun',1,1,'',"cronform");
528  }
529  else
530  {
531  $form->select_date(-1,'datenextrun',1,1,'',"cronform");
532  }
533  print "</td>";
534  print "<td>";
535  print "</td>";
536  print "</tr>";
537 
538  print '</table>';
539 
540  dol_fiche_end();
541 
542  print '<div align="center">';
543  print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
544  print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
545  print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
546  print "</div>";
547 
548  print "</form>\n";
549 
550 }
551 else
552 {
553  /*
554  * view card
555  */
556  $now = dol_now();
557 
558  dol_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron');
559 
560  $linkback = '<a href="' . DOL_URL_ROOT . '/cron/list.php?status=-2">' . $langs->trans("BackToList") . '</a>';
561 
562  $morehtmlref='<div class="refidno">';
563  $morehtmlref.='</div>';
564 
565  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
566 
567  // box add_jobs_box
568  print '<div class="fichecenter">';
569  print '<div class="underbanner clearboth"></div>';
570  print '<table class="border" width="100%">';
571 
572  print '<tr><td class="titlefield">';
573  print $langs->trans('CronLabel')."</td>";
574  print "<td>".$langs->trans($object->label);
575  print "</td></tr>";
576 
577  print "<tr><td>";
578  print $langs->trans('CronType')."</td><td>";
579  print $formCron->select_typejob('jobtype',$object->jobtype,1);
580  print "</td></tr>";
581 
582  print '<tr class="blockmethod"><td>';
583  print $langs->trans('CronModule')."</td><td>";
584  print $object->module_name;
585  print "</td></tr>";
586 
587  print '<tr class="blockmethod"><td>';
588  print $langs->trans('CronClassFile')."</td><td>";
589  print $object->classesname;
590  print "</td></tr>";
591 
592  print '<tr class="blockmethod"><td>';
593  print $langs->trans('CronObject')."</td><td>";
594  print $object->objectname;
595  print "</td></tr>";
596 
597  print '<tr class="blockmethod"><td>';
598  print $langs->trans('CronMethod')."</td><td>";
599  print $object->methodename;
600  print "</td></tr>";
601 
602  print '<tr class="blockmethod"><td>';
603  print $langs->trans('CronArgs')."</td><td>";
604  print $object->params;
605  print "</td></tr>";
606 
607  print '<tr class="blockcommand"><td>';
608  print $langs->trans('CronCommand')."</td><td>";
609  print $object->command;
610  print "</td></tr>";
611 
612  print '<tr><td>';
613  print $langs->trans('CronNote')."</td><td>";
614  print $langs->trans($object->note);
615  print "</td></tr>";
616 
617  print '</table>';
618  print '</div>';
619 
620  print '<br>';
621 
622 
623  print '<div class="fichecenter">';
624  print '<div class="underbanner clearboth"></div>';
625  print '<table class="border" width="100%">';
626 
627  print '<tr><td class="titlefield">';
628  print $langs->trans('CronEvery')."</td>";
629  print "<td>";
630  if($object->unitfrequency == "60") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Minutes');
631  if($object->unitfrequency == "3600") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Hours');
632  if($object->unitfrequency == "86400") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Days');
633  if($object->unitfrequency == "604800") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Weeks');
634  print "</td></tr>";
635 
636  print '<tr><td>';
637  print $langs->trans('CronDtStart')."</td><td>";
638  if(!empty($object->datestart)) {print dol_print_date($object->datestart,'dayhoursec');}
639  print "</td></tr>";
640 
641  print "<tr><td>";
642  print $langs->trans('CronDtEnd')."</td><td>";
643  if(!empty($object->dateend)) {print dol_print_date($object->dateend,'dayhoursec');}
644  print "</td></tr>";
645 
646  print "<tr><td>";
647  print $langs->trans('CronPriority')."</td>";
648  print "<td>".$object->priority;
649  print "</td></tr>";
650 
651  print "<tr><td>";
652  print $langs->trans('CronMaxRun')."</td>";
653  print "<td>";
654  print $object->maxrun>0?$object->maxrun:'';
655  print "</td></tr>";
656 
657  print "<tr><td>";
658  print $langs->trans('CronNbRun')."</td>";
659  print "<td>".$object->nbrun;
660  print "</td></tr>";
661 
662  // Date next run (from)
663  print '<tr><td>';
664  print $langs->trans('CronDtNextLaunch');
665  print ' ('.$langs->trans('CronFrom').')';
666  print "</td><td>";
667  //print '<strong>';
668  if (! $object->status) print $langs->trans("Disabled");
669  elseif (!empty($object->datenextrun)) { print img_picto('','object_calendarday').' '.dol_print_date($object->datenextrun,'dayhoursec');}
670  else {print $langs->trans('CronNone');}
671  //print '</strong>';
672  if ($object->maxnbrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("Finished"));
673  if ($object->datenextrun && $object->datenextrun < $now) print img_warning($langs->trans("Late"));
674  print "</td></tr>";
675 
676  print '</table>';
677  print '</div>';
678 
679  print '<br>';
680 
681  print '<div class="fichecenter">';
682  print '<div class="underbanner clearboth"></div>';
683  print '<table class="border" width="100%">';
684 
685  print '<tr><td class="titlefield">';
686  print $langs->trans('CronDtLastLaunch')."</td><td>";
687  if(!empty($object->datelastrun)) {print dol_print_date($object->datelastrun,'dayhoursec');} else {print $langs->trans('CronNone');}
688  print "</td></tr>";
689 
690  print '<tr><td>';
691  print $langs->trans('CronDtLastResult')."</td><td>";
692  if(!empty($object->datelastresult)) {print dol_print_date($object->datelastresult,'dayhoursec');} else {print $langs->trans('CronNone');}
693  print "</td></tr>";
694 
695  print '<tr><td>';
696  print $langs->trans('CronLastResult')."</td><td>";
697  print $object->lastresult;
698  print "</td></tr>";
699 
700  print '<tr><td>';
701  print $langs->trans('CronLastOutput')."</td><td>";
702  print nl2br($object->lastoutput);
703  print "</td></tr>";
704 
705  print '</table>';
706  print '</div>';
707 
708  dol_fiche_end();
709 
710 
711  print "\n\n<div class=\"tabsAction\">\n";
712  if (! $user->rights->cron->create) {
713  print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Edit").'</a>';
714  } else {
715  print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("Edit").'</a>';
716  }
717 
718  if ((empty($user->rights->cron->execute)))
719  {
720  print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronExecute").'</a>';
721  }
722  else if (empty($object->status))
723  {
724  print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("JobDisabled")).'">'.$langs->trans("CronExecute").'</a>';
725  }
726  else {
727  print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&id='.$object->id.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).'">'.$langs->trans("CronExecute").'</a>';
728  }
729 
730  if (! $user->rights->cron->create) {
731  print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").'</a>';
732  } else {
733  if (empty($object->status)) {
734  print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>';
735  } else {
736  print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=inactive&id='.$object->id.'">'.$langs->trans("CronStatusInactiveBtn").'</a>';
737  }
738  }
739 
740  if (! $user->rights->cron->delete) {
741  print '<a class="butActionDeleteRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</a>';
742  } else {
743  print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
744  }
745  print '</div>';
746 
747  print '<br>';
748 }
749 
750 
751 llxFooter();
752 
753 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
cron_prepare_head(Cronjob $object)
Return array of tabs to used on a cron job.
Definition: cron.lib.php:56
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Class to manage building of HTML components.
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
img_warning($titlealt= 'default', $moreatt= '')
Show warning logo.
dol_fiche_end($notab=0)
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
dol_now($mode='gmt')
Return date for now.
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print
Draft customers invoices.
Definition: index.php:91
Crob Job class.
Class to manage a WYSIWYG editor.