diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 8e540c799fe..8c97bc4e2c8 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -557,7 +557,7 @@ else dol_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron'); - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; $morehtmlref.='
'; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index a63982c5b12..46ad08f849b 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -805,6 +805,69 @@ class Cronjob extends CommonObject $this->libname = ''; } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("CronJob") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowCronJob"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + return $result; + } + + /** * Load object information * diff --git a/htdocs/cron/info.php b/htdocs/cron/info.php index d3365abb90b..18bfde73bde 100644 --- a/htdocs/cron/info.php +++ b/htdocs/cron/info.php @@ -50,7 +50,7 @@ $head = cron_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CronTask"), -1, 'cron'); -$linkback = '' . $langs->trans("BackToList") . ''; +$linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; $morehtmlref.='
'; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 3933a30a54b..ca21a40635a 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -38,6 +38,7 @@ if (!$user->rights->cron->read) accessforbidden(); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $id=GETPOST('id','int'); +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'cronjoblist'; // To manage different context of search $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -50,9 +51,6 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='t.status'; if (! $sortorder) $sortorder='ASC'; -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$contextpage='cronjoblist'; - $status=GETPOST('status','int'); if ($status == '') $status=-2; @@ -151,6 +149,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex */ $form = new Form($db); +$cronjob = new Cronjob($db); $pagetitle=$langs->trans("CronList"); @@ -280,6 +279,9 @@ if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) $text.=$langs->trans("Warn print info_admin($text); print '
'; +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +//$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; print ''; @@ -340,19 +342,22 @@ if ($num > 0) if (empty($obj)) break; if (! verifCond($obj->test)) continue; // Discard line with test = false + $object->id = $obj->rowid; + $object->ref = $obj->rowid; + $object->label = $obj->label; + print ''; print ''; print '
'; - print ''; - print img_picto('', 'object_cron').' '; - print $obj->rowid; - print ''; + print $object->getNomUrl(1); print ''; if (! empty($obj->label)) { - print ''.$langs->trans($obj->label).''; + $object->ref = $obj->label; + print $object->getNomUrl(0, '', 1); + $object->ref = $obj->rowid; } else { @@ -430,7 +435,7 @@ if ($num > 0) print ''; if ($user->rights->cron->create) { - print "rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"])."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."  "; + print "rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."  "; } if ($user->rights->cron->delete) {