@@ -75,6 +75,7 @@ public static function getSpecificValueToDisplay($field, $values, array $options
7575 if (!is_array ($ values )) {
7676 $ values = [$ field => $ values ];
7777 }
78+
7879 switch ($ field ) {
7980 case 'search ' :
8081 $ count = 0 ;
@@ -91,7 +92,7 @@ public static function getSpecificValueToDisplay($field, $values, array $options
9192 global $ CFG_GLPI ;
9293 $ value = ' ' ;
9394 $ out = ' ' ;
94- if (!str_contains ($ values ['id ' ], Search::NULLVALUE )) {
95+ if (!str_contains (( string ) $ values ['id ' ], Search::NULLVALUE )) {
9596 $ search_params = Search::manageParams ('Computer ' , unserialize ($ values ['search ' ]));
9697 $ data = Search::prepareDatasForSearch ('Computer ' , $ search_params );
9798 Search::constructSQL ($ data );
@@ -120,6 +121,7 @@ public static function getSpecificValueToDisplay($field, $values, array $options
120121 foreach ($ values as $ v ) {
121122 $ value .= $ v . $ line_delimiter ;
122123 }
124+
123125 $ value = preg_replace ('/ ' . Search::LBBR . '/ ' , '<br> ' , $ value );
124126 $ value = preg_replace ('/ ' . Search::LBHR . '/ ' , '<hr> ' , $ value );
125127 $ value = '<div class="fup-popup"> ' . $ value . '</div> ' ;
@@ -147,12 +149,8 @@ public static function getSpecificValueToDisplay($field, $values, array $options
147149
148150 public static function displayTabContentForItem (CommonGLPI $ item , $ tabnum = 1 , $ withtemplate = 0 )
149151 {
150- if ($ item instanceof PluginDatabaseinventoryComputerGroup) {
151- switch ($ tabnum ) {
152- case 1 :
153- self ::showForItem ($ item );
154- break ;
155- }
152+ if ($ item instanceof PluginDatabaseinventoryComputerGroup && $ tabnum === 1 ) {
153+ self ::showForItem ($ item );
156154 }
157155
158156 return true ;
@@ -164,9 +162,8 @@ private function countDynamicItems()
164162 $ data = Search::prepareDatasForSearch ('Computer ' , $ search_params );
165163 Search::constructSQL ($ data );
166164 Search::constructData ($ data );
167- $ count = $ data ['data ' ]['totalcount ' ];
168165
169- return $ count ;
166+ return $ data [ ' data ' ][ ' totalcount ' ] ;
170167 }
171168
172169 public function isDynamicSearchMatchComputer (Computer $ computer )
@@ -183,13 +180,13 @@ public function isDynamicSearchMatchComputer(Computer $computer)
183180 if (!isset ($ _SESSION ['glpiname ' ])) {
184181 $ _SESSION ['glpiname ' ] = 'databaseinventory_plugin ' ;
185182 }
183+
186184 $ search_params = Search::manageParams ('Computer ' , $ search );
187185 $ data = Search::prepareDatasForSearch ('Computer ' , $ search_params );
188186 Search::constructSQL ($ data );
189187 Search::constructData ($ data );
190- $ count = $ data ['data ' ]['totalcount ' ];
191188
192- return $ count ;
189+ return $ data [ ' data ' ][ ' totalcount ' ] ;
193190 }
194191
195192 private static function showForItem (PluginDatabaseinventoryComputerGroup $ computergroup )
@@ -204,16 +201,16 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput
204201 $ firsttime = true ;
205202 // load dynamic search criteria from DB if exist
206203 $ computergroup_dynamic = new self ();
207- if (
208- $ computergroup_dynamic ->getFromDBByCrit ([
209- 'plugin_databaseinventory_computergroups_id ' => $ ID ,
210- ])
211- ) {
212- $ p = $ search_params = Search::manageParams ('Computer ' , unserialize ($ computergroup_dynamic ->fields ['search ' ]));
204+ if ($ computergroup_dynamic ->getFromDBByCrit ([
205+ 'plugin_databaseinventory_computergroups_id ' => $ ID ,
206+ ])) {
207+ $ p = Search::manageParams ('Computer ' , unserialize ($ computergroup_dynamic ->fields ['search ' ]));
208+ $ search_params = $ p ;
213209 $ firsttime = false ;
214210 } else {
215211 // retrieve filter value from search if exist and reset it
216- $ p = $ search_params = Search::manageParams ('Computer ' , $ _GET );
212+ $ p = Search::manageParams ('Computer ' , $ _GET );
213+ $ search_params = $ p ;
217214 if (isset ($ _SESSION ['glpisearch ' ]['Computer ' ])) {
218215 unset($ _SESSION ['glpisearch ' ]['Computer ' ]);
219216 }
@@ -268,9 +265,9 @@ public static function install(Migration $migration)
268265
269266 $ table = self ::getTable ();
270267 if (!$ DB ->tableExists ($ table )) {
271- $ migration ->displayMessage (" Installing $ table" );
268+ $ migration ->displayMessage (' Installing ' . $ table );
272269 $ query = <<<SQL
273- CREATE TABLE IF NOT EXISTS ` $ table` (
270+ CREATE TABLE IF NOT EXISTS ` { $ table} ` (
274271 `id` int {$ default_key_sign } NOT NULL AUTO_INCREMENT,
275272 `plugin_databaseinventory_computergroups_id` int {$ default_key_sign } NOT NULL DEFAULT '0',
276273 `search` text,
0 commit comments