Skip to content

Commit 3624562

Browse files
MyvTsvstonebuzz
andauthored
Update inc/field.class.php
Co-authored-by: Stanislas <skita@teclib.com>
1 parent 4c191f5 commit 3624562

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

inc/field.class.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,14 @@ public static function installBaseData(Migration $migration, $version)
154154
}
155155

156156
// Update old genericobject_itemtype dropdown fields to customasset_itemtype dropdown fields
157-
if ($DB->tableExists('glpi_plugin_genericobject_types')) {
157+
// Update old genericobject_itemtype dropdown fields to customasset_itemtype dropdown fields
158+
$has_genericobject_fields = $DB->tableExists('glpi_plugin_genericobject_types')
159+
&& $DB->request([
160+
'COUNT' => 'id',
161+
'FROM' => self::getTable(),
162+
'WHERE' => ['type' => ['LIKE', 'dropdown-PluginGenericobject%']],
163+
])->current()['COUNT(id)'] > 0;
164+
if ($has_genericobject_fields) {
158165
// Get all types from PluginGenericobject
159166
$migration_genericobject_itemtypes = PluginFieldsMigration::getGenericObjectTypes();
160167

0 commit comments

Comments
 (0)