mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-05 02:18:42 +02:00
block computer creation with empty name (for test)
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@189 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
0bbb3c1703
commit
dad2c49f9c
@ -127,7 +127,12 @@ class PluginExampleExample extends CommonDBTM {
|
|||||||
|
|
||||||
// Hook done on before add item case (data from form, not altered)
|
// Hook done on before add item case (data from form, not altered)
|
||||||
static function pre_item_add_computer(Computer $item) {
|
static function pre_item_add_computer(Computer $item) {
|
||||||
Session::addMessageAfterRedirect("Pre Add Computer Hook", true);
|
if (isset($item->input['name']) && empty($item->input['name'])) {
|
||||||
|
Session::addMessageAfterRedirect("Pre Add Computer Hook KO (name empty)", true);
|
||||||
|
return $item->input = false;
|
||||||
|
} else {
|
||||||
|
Session::addMessageAfterRedirect("Pre Add Computer Hook OK", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook done on before add item case (data altered by object prepareInputForAdd)
|
// Hook done on before add item case (data altered by object prepareInputForAdd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user