Beispiel #1
0
 static function showItems(PluginOrderBill $bill)
 {
     global $DB;
     echo "<div class='spaced'><table class='tab_cadre_fixehov'>";
     echo "<tr><th>";
     Html::printPagerForm();
     echo "</th><th colspan='5'>";
     echo _n("Item", "Items", 2);
     echo "</th></tr>";
     $bills_id = $bill->getID();
     $query = "SELECT * FROM `" . getTableForItemType("PluginOrderOrder_Item");
     $query .= "` WHERE `plugin_order_bills_id` = '{$bills_id}'";
     $query .= getEntitiesRestrictRequest(" AND", getTableForItemType("PluginOrderOrder_Item"), "entities_id", $bill->getEntityID(), true);
     $query .= "GROUP BY `itemtype`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (!$number) {
         echo "</th><td>";
         echo _n("Item", "Items", 2);
         echo "</td></tr>";
     } else {
         echo "<tr><th>" . __("Type") . "</th>";
         echo "<th>" . __("Entity") . "</th>";
         echo "<th>" . __("Reference") . "</th>";
         echo "<th>" . __("Status") . "</th>";
         //echo "<th>".__("Sum tax free", "order")."</th>";
         echo "</tr>";
         $old_itemtype = '';
         $num = 0;
         while ($data = $DB->fetch_array($result)) {
             if (!class_exists($data['itemtype'])) {
                 continue;
             }
             $item = new $data['itemtype']();
             if ($data['itemtype']::canView()) {
                 echo "<tr class='tab_bg_1'>";
                 $ID = "";
                 if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
                     $ID = " (" . $data["id"] . ")";
                 }
                 $name = NOT_AVAILABLE;
                 if ($item->getFromDB($data["id"])) {
                     $name = $item->getLink();
                 }
                 echo "<td class='center top'>" . $item->getTypeName() . "</td>";
                 echo "<td class='center top'>";
                 echo Dropdown::getDropdownName('glpi_entities', $item->getEntityID()) . "</td>";
                 $reference = new PluginOrderReference();
                 $reference->getFromDB($data["plugin_order_references_id"]);
                 if (PluginOrderReference::canView()) {
                     echo "<td class='center'><a href='" . $reference->getLinkURL() . "'>";
                     echo $reference->getName() . "</a></td>";
                 } else {
                     echo "<td class='center'>" . $reference->getName(true) . "</td>";
                 }
                 echo "</td>";
                 echo "<td class='center'>" . Dropdown::getDropdownName("glpi_plugin_order_deliverystates", $data["plugin_order_deliverystates_id"]);
                 echo "</tr>";
             }
         }
     }
     echo "</table></div>";
 }