File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,17 @@ public static function registerType()
170170 $ fields = PluginGenericobjectSingletonObjectField::getInstance ($ class );
171171 $ plugin = new Plugin ();
172172
173+ if (isset ($ _SESSION ['glpi_plugin ' ]['genericobject ' ]['registeredtype ' ][$ class ])) {
174+ // register the itemtype in the reservation types if needed
175+ // because $CFG_GLPI['reservation_types'] is reset
176+ if ($ item ->canBeReserved ()) {
177+ $ CFG_GLPI ['reservation_types ' ][$ class ] = $ class ;
178+ }
179+ return ;
180+ } else {
181+ $ _SESSION ['glpi_plugin ' ]['genericobject ' ]['registeredtype ' ][$ class ] = $ class ;
182+ }
183+
173184 PluginGenericobjectType::includeLocales ($ item ->getObjectTypeName ());
174185 PluginGenericobjectType::includeConstants ($ item ->getObjectTypeName ());
175186
Original file line number Diff line number Diff line change @@ -222,10 +222,7 @@ function plugin_post_init_genericobject()
222222 foreach (PluginGenericobjectType::getTypes () as $ id => $ objecttype ) {
223223 $ itemtype = $ objecttype ['itemtype ' ];
224224 if (class_exists ($ itemtype )) {
225- if (!isset ($ _SESSION ['glpi_plugin ' ]['genericobject ' ]['registeredtype ' ][$ itemtype ])) {
226- $ _SESSION ['glpi_plugin ' ]['genericobject ' ]['registeredtype ' ][$ itemtype ] = $ itemtype ;
227- $ itemtype ::registerType ();
228- }
225+ $ itemtype ::registerType ();
229226 }
230227 }
231228}
You can’t perform that action at this time.
0 commit comments