New: Use ajax confirm on purge for audit events

This commit is contained in:
Laurent Destailleur 2009-07-06 09:05:16 +00:00
parent e0f2e3b37d
commit ecf9630ec3
2 changed files with 10 additions and 5 deletions

View File

@ -638,8 +638,12 @@ if ($_GET["id"])
$valuetoshow=$langs->trans('All');
}
else if ($fieldlist[$field]=='pays') {
$key=$langs->trans("Country".strtoupper($obj->pays_code));
$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->pays;
if (empty($obj->pays_code)) print '-';
else
{
$key=$langs->trans("Country".strtoupper($obj->pays_code));
$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->pays;
}
}
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm') {
$valuetoshow=yn($valuetoshow);

View File

@ -57,7 +57,7 @@ $pagenext = $page + 1;
*/
// Purge audit events
if ($_POST['action'] == 'confirm_purge' && $_POST['confirm'] == 'yes' && $user->admin)
if ($_REQUEST['action'] == 'confirm_purge' && $_REQUEST['confirm'] == 'yes' && $user->admin)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
$sql.= " WHERE entity = ".$conf->entity;
@ -104,7 +104,8 @@ if ($result)
if ($_GET["action"] == 'purge')
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"], $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge');
$formquestion=array();
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1);
if ($ret == 'html') print '<br>';
}
@ -203,7 +204,7 @@ if ($result)
print "</table>";
$db->free();
if ($num && $_GET["action"] != 'purge')
if ($num)
{
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';