public static function showGlobalNotation($suppliers_id) { global $DB; $config = PluginOrderConfig::getConfig(); if (!$config->canUseSupplierSatisfaction()) { return; } $survey = new self(); $survey_table = $survey->getTable(); $restrict = getEntitiesRestrictRequest(" AND ", "orders", "entities_id", '', true); $query = "SELECT orders.`id`, orders.`entities_id`, orders.`name`, survey.`comment`\n FROM `glpi_plugin_order_orders` orders, `{$survey_table}` survey\n WHERE survey.`suppliers_id` = orders.`suppliers_id`\n AND survey.`plugin_order_orders_id` = orders.`id`\n AND orders.`suppliers_id` = '{$suppliers_id}'\n {$restrict}"; $query .= "GROUP BY `survey`.id"; $result = $DB->query($query); $nb = $DB->numrows($result); $total = 0; $nb_order = 0; echo "<br>"; echo "<div class='center'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; echo "<th colspan='4'>" . __("Supplier quality", "order") . "</th>"; echo "</tr>"; echo "<tr>"; echo "<th>" . __("Entity") . "</th>"; echo "<th>" . __("Order name", "order") . "</th>"; echo "<th>" . __("Note", "order") . "</th>"; echo "<th>" . __("Comment on survey", "order") . "</th>"; echo "</tr>"; if ($nb) { for ($i = 0; $i < $nb; $i++) { $name = $DB->result($result, $i, "name"); $ID = $DB->result($result, $i, "id"); $comment = $DB->result($result, $i, "comment"); $entities_id = $DB->result($result, $i, "entities_id"); $note = $survey->getTotalNotation($ID); echo "<tr class='tab_bg_1'>"; echo "<td>"; echo Dropdown::getDropdownName("glpi_entities", $entities_id); echo "</td>"; $link = Toolbox::getItemTypeFormURL('PluginOrderOrder'); echo "<td><a href=\"" . $link . "?id=" . $ID . "\">" . $name . "</a></td>"; echo "<td>" . $note . " / 10</td>"; echo "<td>" . nl2br($comment) . "</td>"; echo "</tr>"; $total += $survey->getTotalNotation($ID); $nb_order++; } echo "<tr>"; echo "<th colspan='4'> </th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td><div align='left'>" . __("Administrative followup quality (contracts, bills, mail, etc.)", "order") . "</div></td>"; echo "<td><div align='left'>" . Html::formatNumber($survey->getNotation($suppliers_id, "answer1")) . " / 10</div></td>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td><div align='left'>" . __("Commercial followup quality, visits, responseness", "order") . "</div></td>"; echo "<td><div align='left'>" . Html::formatNumber($survey->getNotation($suppliers_id, "answer2")) . " / 10</div></td>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td><div align='left'>" . __("Contacts availability", "order") . "</div></td>"; echo "<td><div align='left'>" . Html::formatNumber($survey->getNotation($suppliers_id, "answer3")) . " / 10</div></td>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td><div align='left'>" . __("Quality of supplier intervention", "order") . "</div></td>"; echo "<td><div align='left'>" . Html::formatNumber($survey->getNotation($suppliers_id, "answer4")) . " / 10</div></td>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td><div align='left'>" . __("Reliability about annouced delays", "order") . "</div></td>"; echo "<td><div align='left'>" . Html::formatNumber($survey->getNotation($suppliers_id, "answer5")) . " / 10</div></td>"; echo "<tr>"; echo "<th colspan='4'> </th>"; echo "</tr>"; echo "<tr class='tab_bg_1 b'>"; echo "<td colspan='2'></td>"; echo "<td><div align='left'>" . __("Final supplier note", "order") . "</div></td>"; echo "<td><div align='left'>" . Html::formatNumber($total / $nb_order) . " / 10</div></td>"; echo "</tr>"; } echo "</table>"; echo "</div>"; }