mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-06-28 06:58:43 +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:
@ -127,7 +127,12 @@ class PluginExampleExample extends CommonDBTM {
|
||||
|
||||
// Hook done on before add item case (data from form, not altered)
|
||||
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)
|
||||
|
Reference in New Issue
Block a user