コード例 #1
0
 public function showReferenceManufacturers($ID)
 {
     global $DB, $CFG_GLPI;
     $ref = new PluginOrderReference();
     $ref->getFromDB($ID);
     $target = Toolbox::getItemTypeFormURL(__CLASS__);
     Session::initNavigateListItems($this->getType(), __("Product reference", "order") . " = " . $ref->fields["name"]);
     $candelete = $ref->can($ID, DELETE);
     $query = "SELECT * FROM `" . $this->getTable() . "` WHERE `plugin_order_references_id` = '{$ID}' ";
     $query .= getEntitiesRestrictRequest(" AND", $this->getTable(), "entities_id", $ref->fields['entities_id'], $ref->fields['is_recursive']);
     $result = $DB->query($query);
     $rand = mt_rand();
     echo "<div class='center'>";
     echo "<form method='post' name='show_supplierref{$rand}' id='show_supplierref{$rand}' action=\"{$target}\">";
     echo "<input type='hidden' name='plugin_order_references_id' value='" . $ID . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='5'>" . __("Supplier Detail", "order") . "</th></tr>";
     echo "<tr><th>&nbsp;</th>";
     echo "<th>" . __("Supplier") . "</th>";
     echo "<th>" . __("Product reference", "order") . "</th>";
     echo "<th>" . __("Unit price tax free", "order") . "</th>";
     echo "</tr>";
     if ($DB->numrows($result) > 0) {
         echo "<form method='post' name='show_ref_manu' action=\"{$target}\">";
         echo "<input type='hidden' name='plugin_order_references_id' value='" . $ID . "'>";
         while ($data = $DB->fetch_array($result)) {
             Session::addToNavigateListItems($this->getType(), $data['id']);
             echo "<input type='hidden' name='item[" . $data["id"] . "]' value='" . $ID . "'>";
             echo "<tr class='tab_bg_1 center'>";
             echo "<td>";
             if ($candelete) {
                 echo "<input type='checkbox' name='check[" . $data["id"] . "]'";
                 if (isset($_POST['check']) && $_POST['check'] == 'all') {
                     echo " checked ";
                 }
                 echo ">";
             }
             echo "</td>";
             $link = Toolbox::getItemTypeFormURL($this->getType());
             echo "<td><a href='" . $link . "?id=" . $data["id"] . "&plugin_order_references_id=" . $ID . "'>" . Dropdown::getDropdownName("glpi_suppliers", $data["suppliers_id"]) . "</a></td>";
             echo "<td>";
             echo $data["reference_code"];
             echo "</td>";
             echo "<td>";
             echo Html::formatNumber($data["price_taxfree"]);
             echo "</td>";
             echo "</tr>";
         }
         echo "</table>";
         if ($candelete) {
             echo "<div class='center'>";
             echo "<table width='900px' class='tab_glpi'>";
             echo "<tr><td><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png\" alt=''></td>";
             echo "<td class='center'><a onclick= \"if ( markCheckboxes('show_supplierref{$rand}') ) " . "return false;\" href='#'>" . __("Check all") . "</a></td>";
             echo "<td>/</td><td class='center'><a onclick= \"if ( unMarkCheckboxes('show_supplierref{$rand}') ) " . "return false;\" href='#'>" . __("Uncheck all") . "</a>";
             echo "</td><td align='left' width='80%'>";
             echo "<input type='submit' name='delete' value=\"" . __("Delete permanently") . "\" class='submit' >";
             echo "</td>";
             echo "</table>";
             echo "</div>";
         }
     } else {
         echo "</table>";
     }
     Html::closeForm();
     echo "</div>";
 }