Fix look and feel v7
This commit is contained in:
parent
efb0cbfd53
commit
c43bcd4d2a
@ -29,9 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
|||||||
require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php";
|
require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php";
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->loadLangs(array("admin","cron","bills"));
|
||||||
$langs->load("cron");
|
|
||||||
$langs->load("bills");
|
|
||||||
|
|
||||||
if (!$user->rights->cron->read) accessforbidden();
|
if (!$user->rights->cron->read) accessforbidden();
|
||||||
|
|
||||||
@ -51,8 +49,8 @@ $pagenext = $page + 1;
|
|||||||
if (! $sortfield) $sortfield='t.status,t.priority';
|
if (! $sortfield) $sortfield='t.status,t.priority';
|
||||||
if (! $sortorder) $sortorder='DESC,ASC';
|
if (! $sortorder) $sortorder='DESC,ASC';
|
||||||
|
|
||||||
$status=GETPOST('status','int');
|
$search_status=GETPOST('search_status','int')?GETPOST('search_status','int'):GETPOST('status','int');
|
||||||
if ($status == '') $status=-2;
|
if ($search_status == '') $search_status=-2;
|
||||||
|
|
||||||
//Search criteria
|
//Search criteria
|
||||||
$search_label=GETPOST("search_label",'alpha');
|
$search_label=GETPOST("search_label",'alpha');
|
||||||
@ -75,80 +73,93 @@ $object = new Cronjob($db);
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
{
|
|
||||||
$search_label='';
|
|
||||||
$status=-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$filter=array();
|
$parameters=array();
|
||||||
if (!empty($search_label))
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
{
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
$filter['t.label']=$search_label;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete jobs
|
if (empty($reshook))
|
||||||
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete)
|
|
||||||
{
|
{
|
||||||
//Delete cron task
|
// Selection of new fields
|
||||||
$object = new Cronjob($db);
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
$object->id=$id;
|
|
||||||
$result = $object->delete($user);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
// Purge search criteria
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$search_label='';
|
||||||
|
$search_status=-1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Execute jobs
|
$filter=array();
|
||||||
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute)
|
if (!empty($search_label))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
|
$filter['t.label']=$search_label;
|
||||||
{
|
}
|
||||||
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
|
|
||||||
$action='';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$object = new Cronjob($db);
|
|
||||||
$job = $object->fetch($id);
|
|
||||||
|
|
||||||
$now = dol_now(); // Date we start
|
// Delete jobs
|
||||||
|
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete)
|
||||||
|
{
|
||||||
|
//Delete cron task
|
||||||
|
$object = new Cronjob($db);
|
||||||
|
$object->id=$id;
|
||||||
|
$result = $object->delete($user);
|
||||||
|
|
||||||
$resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK
|
if ($result < 0) {
|
||||||
if ($resrunjob < 0) {
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Programm next run
|
// Execute jobs
|
||||||
$res = $object->reprogram_jobs($user->login, $now);
|
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute)
|
||||||
if ($res > 0)
|
{
|
||||||
{
|
if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
|
||||||
if ($resrunjob >= 0) // We show the result of reprogram only if no error message already reported
|
{
|
||||||
{
|
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
|
||||||
if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
|
$action='';
|
||||||
else setEventMessages($langs->trans("JobFinished"), null, 'errors');
|
}
|
||||||
}
|
else
|
||||||
$action='';
|
{
|
||||||
}
|
$object = new Cronjob($db);
|
||||||
else
|
$job = $object->fetch($id);
|
||||||
{
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
$action='';
|
|
||||||
}
|
|
||||||
|
|
||||||
$param='&status='.$status;
|
$now = dol_now(); // Date we start
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
|
||||||
if ($search_label) $param.='&search_label='.$search_label;
|
|
||||||
if ($optioncss != '') $param.='&optioncss='.$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
|
$resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK
|
||||||
exit;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,8 +207,8 @@ $sql.= " t.libname,";
|
|||||||
$sql.= " t.test";
|
$sql.= " t.test";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
|
||||||
$sql.= " WHERE 1 = 1";
|
$sql.= " WHERE 1 = 1";
|
||||||
if ($status >= 0 && $status < 2) $sql.= " AND t.status = ".(empty($status)?'0':'1');
|
if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1');
|
||||||
if ($status == 2) $sql.= " AND t.status = 2";
|
if ($search_status == 2) $sql.= " AND t.status = 2";
|
||||||
//Manage filter
|
//Manage filter
|
||||||
if (is_array($filter) && count($filter)>0) {
|
if (is_array($filter) && count($filter)>0) {
|
||||||
foreach($filter as $key => $value) {
|
foreach($filter as $key => $value) {
|
||||||
@ -235,7 +246,7 @@ if (! $result) dol_print_error($db);
|
|||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$param='&status='.$status;
|
$param='&search_status='.$search_status;
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($search_label) $param.='&search_label='.$search_label;
|
if ($search_label) $param.='&search_label='.$search_label;
|
||||||
@ -256,15 +267,28 @@ if ($action == 'execute')
|
|||||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List of mass actions available
|
||||||
|
$arrayofmassactions = array(
|
||||||
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
|
'enable'=>$langs->trans("Enable"),
|
||||||
|
'disable'=>$langs->trans("Disable"),
|
||||||
|
);
|
||||||
|
if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="GET" action="'.$url_form.'" name="search_form">'."\n";
|
|
||||||
print '<input type="hidden" name="status" value="'.$status.'" >';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="action" value="list">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
print '<input type="hidden" name="search_status" value="'.$search_status.'" >';
|
||||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||||
|
|
||||||
// Line with explanation and button new job
|
// Line with explanation and button new job
|
||||||
@ -311,7 +335,7 @@ print '<td class="liste_titre"> </td>';
|
|||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
print $form->selectarray('status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Enabled"), '-2'=>$langs->trans("EnabledAndDisabled"), '2'=>$langs->trans("Archived")), $status, 1);
|
print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Enabled"), '-2'=>$langs->trans("EnabledAndDisabled"), '2'=>$langs->trans("Archived")), $search_status, 1);
|
||||||
print '</td><td class="liste_titre" align="right">';
|
print '</td><td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user