function showBADetail($id)
 {
     global $CFG_GLPI;
     $pmParentSC = new PluginMonitoringServicescatalog();
     $pMonitoringBusinessrule = new PluginMonitoringBusinessrule();
     $pMonitoringBusinessrulegroup = new PluginMonitoringBusinessrulegroup();
     $pMonitoringService = new PluginMonitoringService();
     $this->getFromDB($id);
     $derivated = false;
     if ($this->getField('plugin_monitoring_servicescatalogs_id') > 0) {
         $derivated = true;
         $pmParentSC->getFromDB($this->getField('plugin_monitoring_servicescatalogs_id'));
     }
     // If SC is derivated from a template, get groups from its parent ...
     if ($derivated) {
         $a_groups = $pMonitoringBusinessrulegroup->find("`plugin_monitoring_servicescatalogs_id`='" . $pmParentSC->fields['id'] . "'");
     } else {
         $a_groups = $pMonitoringBusinessrulegroup->find("`plugin_monitoring_servicescatalogs_id`='" . $id . "'");
     }
     echo "<table class='tab_cadrehov'>";
     echo "<tr class='tab_bg_1'>";
     /*
           $color = $this->getShortState();
           // $color = PluginMonitoringHost::getState($this->fields['state'],
                                                      // $this->fields['state_type'],
                                                      // 'data',
                                                      // $this->fields['is_acknowledged']);
           $pic = $color;
           $color = str_replace("_soft", "", $color);
     */
     echo "<td rowspan='" . count($a_groups) . "' class='center service" . $this->getField('state') . "' width='200'>";
     echo "<strong style='font-size: 20px'>" . $this->getName() . "</strong><br/>";
     echo "<img src='" . $this->getShortState(array('image' => '40')) . "'/>";
     echo "</td>";
     $i = 0;
     foreach ($a_groups as $gdata) {
         $a_brulesg = $pMonitoringBusinessrule->find("`plugin_monitoring_businessrulegroups_id`='" . $gdata['id'] . "'");
         if ($i > 0) {
             echo "<tr>";
         }
         $state = array();
         $state['OK'] = 0;
         $state['WARNING'] = 0;
         $state['CRITICAL'] = 0;
         $state['UNKNOWN'] = 0;
         foreach ($a_brulesg as $brulesdata) {
             // If SC is derivated from a template, do not care about services not from the same entity  ...
             if (!$pMonitoringService->getFromDB($brulesdata['plugin_monitoring_services_id'])) {
                 continue;
             }
             if ($derivated && $pMonitoringService->getField('entities_id') != $this->getField('entities_id')) {
                 continue;
             }
             $state[$pMonitoringService->getState()]++;
         }
         $overall_state = "OK";
         if ($gdata['operator'] == 'and') {
             if ($state['UNKNOWN'] >= 1) {
                 $overall_state = "UNKNOWN";
             } else {
                 if ($state['CRITICAL'] >= 1) {
                     $overall_state = "CRITICAL";
                 } else {
                     if ($state['WARNING'] >= 1) {
                         $overall_state = "WARNING";
                     } else {
                         if ($state['OK'] >= 1) {
                             $overall_state = "OK";
                         }
                     }
                 }
             }
         } else {
             if ($gdata['operator'] == 'or') {
                 if ($state['OK'] >= 1) {
                     $overall_state = "OK";
                 } else {
                     if ($state['WARNING'] >= 1) {
                         $overall_state = "WARNING";
                     } else {
                         if ($state['CRITICAL'] >= 1) {
                             $overall_state = "CRITICAL";
                         } else {
                             if ($state['UNKNOWN'] >= 1) {
                                 $overall_state = "UNKNOWN";
                             }
                         }
                     }
                 }
             } else {
                 $num_min = str_replace(" of:", "", $gdata['operator']);
                 if ($state['OK'] >= $num_min) {
                     $overall_state = "OK";
                 } else {
                     if ($state['WARNING'] >= $num_min) {
                         $overall_state = "WARNING";
                     } else {
                         if ($state['CRITICAL'] >= $num_min) {
                             $overall_state = "CRITICAL";
                         } else {
                             if ($state['UNKNOWN'] >= $num_min) {
                                 $overall_state = "UNKNOWN";
                             }
                         }
                     }
                 }
             }
         }
         echo "<td class='center service" . $overall_state . "'>";
         echo $gdata['name'] . "<br/>[ " . $gdata['operator'] . " ]";
         echo "</td>";
         echo "<td class='service" . $overall_state . "'>";
         echo "<table>";
         foreach ($a_brulesg as $brulesdata) {
             // $pMonitoringService->getFromDB($brulesdata['plugin_monitoring_services_id']);
             // If SC is derivated from a template, do not care about services not from the same entity  ...
             if (!$pMonitoringService->getFromDB($brulesdata['plugin_monitoring_services_id'])) {
                 continue;
             }
             if ($derivated && $pMonitoringService->getField('entities_id') != $this->getField('entities_id')) {
                 continue;
             }
             // Last parameter is true to display counters/graphs, false if not needed
             echo "<tr class='tab_bg_1'>";
             // Display a line for the service including host information, no counters but graphs
             PluginMonitoringDisplay::displayLine($pMonitoringService->fields, true, false, true);
             echo "</tr>";
         }
         echo "</table>";
         echo "</th>";
         echo "</tr>";
         $i++;
     }
     echo "</tr>";
     echo "</table>";
 }