public function addDetails($ref_id, $itemtype, $orders_id, $quantity, $price, $discounted_price, $taxes_id) { $order = new PluginOrderOrder(); if ($quantity > 0 && $order->getFromDB($orders_id)) { for ($i = 0; $i < $quantity; $i++) { $input["plugin_order_orders_id"] = $orders_id; $input["plugin_order_references_id"] = $ref_id; $input["plugin_order_ordertaxes_id"] = $taxes_id; $input["itemtype"] = $itemtype; $input["entities_id"] = $order->getEntityID(); $input["is_recursive"] = $order->isRecursive(); $input["price_taxfree"] = $price; $input["price_discounted"] = $price - $price * ($discounted_price / 100); $input["states_id"] = PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED; $input["price_ati"] = $this->getPricesATI($input["price_discounted"], Dropdown::getDropdownName("glpi_plugin_order_ordertaxes", $taxes_id)); $input["discount"] = $discounted_price; $this->add($input); } } }
public function showForm($ID, $options = array()) { $plugin_order_orders_id = -1; if (isset($options['plugin_order_orders_id'])) { $plugin_order_orders_id = $options['plugin_order_orders_id']; } $this->initForm($ID, $options); if (strpos($_SERVER['PHP_SELF'], "order_supplier")) { echo "showTabs()"; $this->showTabs($options); } $this->showFormHeader($options); $PluginOrderOrder = new PluginOrderOrder(); $PluginOrderOrder->getFromDB($plugin_order_orders_id); echo "<input type='hidden' name='plugin_order_orders_id' value='{$plugin_order_orders_id}'>"; echo "<input type='hidden' name='entities_id' value='" . $PluginOrderOrder->getEntityID() . "'>"; echo "<input type='hidden' name='is_recursive' value='" . $PluginOrderOrder->isRecursive() . "'>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __("Supplier") . ": </td>"; $supplier = $PluginOrderOrder->fields["suppliers_id"]; if ($ID > 0) { $supplier = $this->fields["suppliers_id"]; } echo "<td>"; $link = Toolbox::getItemTypeFormURL('Supplier'); echo "<a href=\"" . $link . "?id=" . $supplier . "\">" . Dropdown::getDropdownName("glpi_suppliers", $supplier) . "</a></td>"; echo "<input type='hidden' name='suppliers_id' value='" . $supplier . "'>"; echo "</td>"; /* number of quote */ echo "<td>" . __("Quote number", "order") . ": </td><td>"; Html::autocompletionTextField($this, "num_quote"); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "</td><td colspan='2'></td>"; /* num order supplier */ echo "<td>" . __("Order number") . ": </td><td>"; Html::autocompletionTextField($this, "num_order"); echo "</tr>"; $options['candel'] = false; $this->showFormButtons($options); return true; }
public function showForm($ID, $options = array()) { if (!self::canView()) { return false; } $plugin_order_orders_id = -1; if (isset($options['plugin_order_orders_id'])) { $plugin_order_orders_id = $options['plugin_order_orders_id']; } if ($ID > 0) { $this->check($ID, READ); } else { // Create item $input = array('plugin_order_orders_id' => $options['plugin_order_orders_id']); $this->check(-1, UPDATE, $input); } $this->initForm($ID, $options); $options['colspan'] = 1; $this->showFormHeader($options); $order = new PluginOrderOrder(); $order->getFromDB($plugin_order_orders_id); echo "<input type='hidden' name='plugin_order_orders_id' value='{$plugin_order_orders_id}'>"; echo "<input type='hidden' name='entities_id' value='" . $order->getEntityID() . "'>"; echo "<input type='hidden' name='is_recursive' value='" . $order->isRecursive() . "'>"; echo "<tr class='tab_bg_1'><td>" . __("Supplier") . ": </td><td>"; $suppliers_id = $order->fields["suppliers_id"]; if ($ID > 0) { $suppliers_id = $this->fields["suppliers_id"]; } $link = Toolbox::getItemTypeFormURL('Supplier'); echo "<a href=\"" . $link . "?id=" . $suppliers_id . "\">" . Dropdown::getDropdownName("glpi_suppliers", $suppliers_id) . "</a>"; echo "<input type='hidden' name='suppliers_id' value='" . $suppliers_id . "'>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __("Administrative followup quality (contracts, bills, mail, etc.)", "order") . ": </td><td>"; $this->addNotation("answer1", $this->fields["answer1"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __("Commercial followup quality, visits, responseness", "order") . ": </td><td>"; $this->addNotation("answer2", $this->fields["answer2"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __("Contacts availability", "order") . ": </td><td>"; $this->addNotation("answer3", $this->fields["answer3"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __("Quality of supplier intervention", "order") . ": </td><td>"; $this->addNotation("answer4", $this->fields["answer4"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __("Reliability about annouced delays", "order") . ": </td><td>"; $this->addNotation("answer5", $this->fields["answer5"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>"; //comments of order echo __("Comments") . ": </td>"; echo "<td>"; echo "<textarea cols='80' rows='4' name='comment'>" . $this->fields["comment"] . "</textarea>"; echo "</td>"; echo "</tr>"; if ($ID > 0) { echo "<tr><th><div align='left'>" . __("Average mark up to 10 (X points / 5)", "order") . ": </div></th><th><div align='left'>"; $total = $this->getTotalNotation($this->fields["plugin_order_orders_id"]); echo Html::formatNumber($total) . " / 10"; echo "</div></th>"; echo "</tr>"; } $this->showFormButtons($options); return true; }