mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
new update hook
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@122 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
0ee472bd2a
commit
cc15e45076
32
hook.php
32
hook.php
@ -322,29 +322,29 @@ function plugin_example_MassiveActionsFieldsDisplay($type,$table,$field,$linkfie
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|
||||||
// Hook done on before update item case
|
// Hook done on before update item case
|
||||||
function plugin_pre_item_update_example($input) {
|
function plugin_pre_item_update_example($item) {
|
||||||
|
|
||||||
if (isset($input["_item_type_"])) {
|
switch (get_class($item)) {
|
||||||
switch ($input["_item_type_"]) {
|
case 'Computer' :
|
||||||
case 'Computer' :
|
/* Manipulate data if needed
|
||||||
// Manipulate data if needed
|
if (!isset($item->input['comment'])) {
|
||||||
addMessageAfterRedirect("Pre Update Computer Hook",true);
|
$item->input['comment'] = addslashes($item->fields['comment']);
|
||||||
break;
|
}
|
||||||
}
|
$item->input['comment'] .= addslashes("\nUpdate: ".date('r'));
|
||||||
|
*/
|
||||||
|
addMessageAfterRedirect("Pre Update Computer Hook",true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hook done on update item case
|
// Hook done on update item case
|
||||||
function plugin_item_update_example($parm) {
|
function plugin_item_update_example($item) {
|
||||||
|
|
||||||
if (isset($parm["type"])) {
|
switch (get_class($item)){
|
||||||
switch ($parm["type"]){
|
case 'Computer' :
|
||||||
case 'Computer' :
|
addMessageAfterRedirect("Update Computer Hook (".implode(',',$item->updates).")",true);
|
||||||
addMessageAfterRedirect("Update Computer Hook",true);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user