// Add a buton to erase all log
This commit is contained in:
@@ -149,6 +149,11 @@ class LoggerCore extends ObjectModel
|
||||
|
||||
return $this->hash;
|
||||
}
|
||||
|
||||
public static function eraseAllLogs()
|
||||
{
|
||||
return Db::getInstance()->execute('TRUNCATE TABLE '._DB_PREFIX_.'log');
|
||||
}
|
||||
|
||||
/**
|
||||
* check if this log message already exists in database.
|
||||
|
||||
@@ -64,10 +64,20 @@ class AdminLogsControllerCore extends AdminController
|
||||
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'employee e ON (a.id_employee = e.id_employee)';
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function processDelete()
|
||||
{
|
||||
return Logger::eraseAllLogs();
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
$this->toolbar_btn['delete'] = array(
|
||||
'short' => 'Erase',
|
||||
'desc' => $this->l('Erase all'),
|
||||
'js' => 'if (confirm(\''.$this->l('Are you sure?').'\')) document.location = \''.$this->context->link->getAdminLink('AdminLogs').'&token='.$this->token.'&deletelog=1\';'
|
||||
);
|
||||
unset($this->toolbar_btn['new']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user