Skip to content

Commit

Permalink
Merge pull request #47 from pluginsGLPI/Badoche1337-patch-itemtypes
Browse files Browse the repository at this point in the history
Fixing populate_fields method to handle multiple itemtypes
  • Loading branch information
orthagh authored Jul 20, 2016
2 parents f2d7480 + 8d489d3 commit e86651e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,13 @@ function plugin_datainjection_populate_fields() {
$found = $container->find("`is_active` = 1");

foreach ($found as $id => $values) {
$classname = "PluginFields"
. ucfirst($values['itemtype'] . preg_replace('/s$/', '', $values['name']))
$types = json_decode($values['itemtypes']);

foreach ($types as $type) {
$classname = "PluginFields"
. ucfirst($type. preg_replace('/s$/', '', $values['name']))
. 'Injection';
$INJECTABLE_TYPES[$classname] = 'fields';
$INJECTABLE_TYPES[$classname] = 'fields';
}
}
}

0 comments on commit e86651e

Please sign in to comment.