diff --git a/hook.php b/hook.php
index a459328..da87c0e 100644
--- a/hook.php
+++ b/hook.php
@@ -290,7 +290,7 @@ function plugin_example_MassiveActionsDisplay($options=array()) {
case "plugin_example_DoIt" :
echo " ".
" ".__('but do nothing :)');
+ __s('Post')."'> ".__('Write in item history');
break;
}
break;
@@ -322,11 +322,13 @@ function plugin_example_MassiveActionsProcess($data) {
if ($data['itemtype'] == 'Computer') {
$comp = new Computer();
Session::addMessageAfterRedirect(__("Right it is the type I want..."));
- Session::addMessageAfterRedirect(__("But... I say I will do nothing for:"));
+ Session::addMessageAfterRedirect(__('Write in item history'));
+ $changes = array(0, 'old value', 'new value');
foreach ($data['item'] as $key => $val) {
if ($val == 1) {
if ($comp->getFromDB($key)) {
Session::addMessageAfterRedirect("- ".$comp->getField("name"));
+ Log::history($key, 'Computer', $changes, 'PluginExampleExample', Log::HISTORY_PLUGIN);
$ok++;
} else {
// Example of ko count
diff --git a/inc/example.class.php b/inc/example.class.php
index 69fbbeb..ad97128 100644
--- a/inc/example.class.php
+++ b/inc/example.class.php
@@ -305,5 +305,24 @@ class PluginExampleExample extends CommonDBTM {
break;
}
}
+
+ /**
+ * Get an history entry message
+ *
+ * @param $data Array from glpi_logs table
+ *
+ * @since GLPI version 0.84
+ *
+ * @return string
+ **/
+ static function getHistoryEntry($data) {
+
+ switch($data['linked_action'] - Log::HISTORY_PLUGIN) {
+ case 0:
+ return _('History from plugin example');
+ }
+
+ return '';
+ }
}
?>
\ No newline at end of file