static function getMenuContent() { global $CFG_GLPI; $menu = array(); $menu['title'] = self::getTypeName(2); $menu['page'] = self::getSearchURL(false); if (PluginOrderConfig::canView()) { $menu['links']['config'] = PluginOrderConfig::getFormURL(false); } if (PluginOrderOrder::canView()) { $menu['options']['order']['title'] = PluginOrderOrder::getTypeName(2); $menu['options']['order']['page'] = PluginOrderOrder::getSearchURL(false); $menu['options']['order']['links']['add'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=1"; if (PluginOrderOrder::canCreate()) { $menu['options']['order']['links']['search'] = PluginOrderOrder::getSearchURL(false); } $menu['options']['order']['links']['template'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=0"; if (PluginOrderConfig::canView()) { $menu['options']['order']['links']['config'] = PluginOrderConfig::getFormURL(false); } } $menu['options']['bill']['title'] = PluginOrderBill::getTypeName(2); $menu['options']['bill']['page'] = PluginOrderBill::getSearchURL(false); $menu['options']['bill']['links']['search'] = PluginOrderBill::getSearchURL(false); $menu['options']['bill']['links']['add'] = PluginOrderBill::getFormURL(false); $menu['options']['bill']['links']['config'] = PluginOrderConfig::getFormURL(false); $menu['options']['references']['title'] = PluginOrderReference::getTypeName(2); $menu['options']['references']['page'] = PluginOrderReference::getSearchURL(false); $menu['options']['references']['links']['search'] = PluginOrderReference::getSearchURL(false); $menu['options']['references']['links']['add'] = PluginOrderReference::getFormURL(false); $menu['options']['references']['links']['config'] = PluginOrderConfig::getFormURL(false); return $menu; }
function plugin_init_order() { global $PLUGIN_HOOKS, $CFG_GLPI, $ORDER_TYPES; Plugin::registerClass('PluginOrderProfile'); $PLUGIN_HOOKS['csrf_compliant']['order'] = true; /* Init current profile */ $PLUGIN_HOOKS['change_profile']['order'] = array('PluginOrderProfile', 'initProfile'); $plugin = new Plugin(); if ($plugin->isActivated('order')) { $PLUGIN_HOOKS['migratetypes']['order'] = 'plugin_order_migratetypes'; $PLUGIN_HOOKS['assign_to_ticket']['order'] = true; //Itemtypes in use for an order $ORDER_TYPES = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Printer', 'Phone', 'ConsumableItem', 'CartridgeItem', 'Contract', 'PluginOrderOther', 'SoftwareLicense'); $PLUGIN_HOOKS['pre_item_purge']['order'] = array('Profile' => array('PluginOrderProfile', 'purgeProfiles'), 'DocumentCategory' => array('PluginOrderDocumentCategory', 'purgeItem')); $PLUGIN_HOOKS['pre_item_update']['order'] = array('Infocom' => array('PluginOrderOrder_Item', 'updateItem'), 'Contract' => array('PluginOrderOrder_Item', 'updateItem')); $PLUGIN_HOOKS['item_add']['order'] = array('Document' => array('PluginOrderOrder', 'addDocumentCategory')); include_once GLPI_ROOT . "/plugins/order/inc/order_item.class.php"; foreach (PluginOrderOrder_Item::getClasses(true) as $type) { $PLUGIN_HOOKS['item_purge']['order'][$type] = 'plugin_item_purge_order'; } Plugin::registerClass('PluginOrderOrder', array('document_types' => true, 'unicity_types' => true, 'notificationtemplates_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'contract_types' => true, 'linkuser_types' => true, 'addtabon' => array('Budget'))); Plugin::registerClass('PluginOrderReference', array('document_types' => true)); Plugin::registerClass('PluginOrderProfile', array('addtabon' => array('Profile'))); Plugin::registerClass('PluginOrderOrder_Item', array('notificationtemplates_types' => true, 'addtabon' => PluginOrderOrder_Item::getClasses(true))); if (PluginOrderOrder::canView()) { Plugin::registerClass('PluginOrderDocumentCategory', array('addtabon' => array('DocumentCategory'))); Plugin::registerClass('PluginOrderOrder_Supplier', array('addtabon' => array('Supplier'))); Plugin::registerClass('PluginOrderPreference', array('addtabon' => array('Preference'))); } /*if glpi is loaded */ if (Session::getLoginUserID()) { /* link to the config page in plugins menu */ if (Session::haveRight("config", UPDATE)) { $PLUGIN_HOOKS['config_page']['order'] = 'front/config.form.php'; } if (PluginOrderOrder::canView() || PluginOrderReference::canView() || PluginOrderBill::canView()) { $PLUGIN_HOOKS['menu_toadd']['order']['management'] = 'PluginOrderMenu'; } $PLUGIN_HOOKS['assign_to_ticket']['order'] = true; $PLUGIN_HOOKS['use_massive_action']['order'] = 1; $PLUGIN_HOOKS['plugin_datainjection_populate']['order'] = "plugin_datainjection_populate_order"; } } }
/* LICENSE This file is part of the order plugin. Order plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Order plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; along with Order. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package order @author the order plugin team @copyright Copyright (c) 2010-2015 Order plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/order @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; $PluginOrderOrder = new PluginOrderOrder(); $PluginOrderOrder->generateOrder($_GET);
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item->getType() == 'PluginOrderOrder') { if (Session::haveRight('plugin_order_order', PluginOrderOrder::canView()) && $item->getState() > PluginOrderOrderState::DRAFT) { return self::createTabEntry(__("Item delivered", "order"), self::countForOrder($item)); } } }
public static function showOrderSupplierInfos($ID) { //TODO : en cours global $DB; $order = new PluginOrderOrder(); $order->getFromDB($ID); $suppliers_id = $order->fields["suppliers_id"]; Session::initNavigateListItems(__CLASS__, __("Order", "order") . " = " . $order->fields["name"]); $candelete = $order->can($ID, UPDATE); $rand = mt_rand(); $link = Toolbox::getItemTypeFormURL(__CLASS__); echo "<form method='post' name='show_supplierinfos{$rand}' id='show_supplierinfos{$rand}' " . "action=\"" . $link . "\">"; echo "<div class='center'>"; echo "<input type='hidden' name='plugin_order_orders_id' value='" . $ID . "'>"; $table = getTableForItemType(__CLASS__); $nb_elements = countElementsInTable($table, "`plugin_order_orders_id` = '{$ID}'"); if ($nb_elements > 0) { echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='4'>" . __("Supplier Detail", "order") . "</th></tr>"; echo "<tr>"; echo "<th> </th>"; echo "<th>" . __("Supplier") . "</th>"; echo "<th>" . __("Quote number", "order") . "</th>"; echo "<th>" . __("Order number") . "</th>"; echo "</tr>"; $datas = getAllDatasFromTable($table, "`plugin_order_orders_id` = '{$ID}'"); foreach ($datas as $data) { Session::addToNavigateListItems(__CLASS__, $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>"; echo "<td><a href='" . $link . "?id=" . $data["id"] . "&plugin_order_orders_id=" . $ID . "'>" . Dropdown::getDropdownName("glpi_suppliers", $data["suppliers_id"]) . "</a></td>"; echo "<td>" . $data["num_quote"] . "</td>"; echo "<td>" . $data["num_order"] . "</td>"; echo "</tr>"; } echo "</table></div>"; if ($candelete) { Html::openArrowMassives("show_supplierinfos{$rand}", true); Html::closeArrowMassives(array('delete' => __("Delete permanently"))); } } Html::closeForm(); }
@author the order plugin team @copyright Copyright (c) 2010-2011 Order plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/order @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; if (!isset($_GET["id"])) { $_GET["id"] = ""; } if (!isset($_GET["withtemplate"])) { $_GET["withtemplate"] = ""; } $pluginOrderOrder = new PluginOrderOrder(); $config = new PluginOrderConfig(); $pluginOrderOrder_Item = new PluginOrderOrder_Item(); $pluginOrderOrder_Supplier = new PluginOrderOrder_Supplier(); /* add order */ if (isset($_POST["add"])) { $pluginOrderOrder->check(-1, 'w', $_POST); /* FORCE Status */ $_POST['plugin_order_orderstates_id'] = $config->getDraftState(); $newID = $pluginOrderOrder->add($_POST); $url = Toolbox::getItemTypeFormURL('PluginOrderOrder') . "?id={$newID}"; Html::redirect($url); } else { if (isset($_POST["delete"])) { $pluginOrderOrder->check($_POST['id'], 'w'); $pluginOrderOrder->delete($_POST);
public function showOrders($ref) { global $DB; $order = new PluginOrderOrder(); $query = "SELECT `glpi_plugin_order_orders_items`.*\n FROM `glpi_plugin_order_orders_items`\n LEFT JOIN `glpi_plugin_order_references`\n ON (`glpi_plugin_order_references`.`id` = `glpi_plugin_order_orders_items`.`plugin_order_references_id`)\n WHERE `plugin_order_references_id` = '" . $ref->getID() . "'"; $query .= getEntitiesRestrictRequest(" AND ", "glpi_plugin_order_references", "entities_id", $ref->fields["entities_id"], true); $query .= " GROUP BY `glpi_plugin_order_orders_items`.`plugin_order_orders_id`\n ORDER BY `entities_id`, `name` "; $result = $DB->query($query); $nb = $DB->numrows($result); echo "<div class='center'>"; if ($nb) { if (isset($_REQUEST["start"])) { $start = $_REQUEST["start"]; } else { $start = 0; } $query_limit = $query . " LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']); Html::printAjaxPager(__("Linked orders", "order"), $start, $nb); echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; echo "<th>" . __("Name") . "</a></th>"; echo "<th>" . __("Entity") . "</th>"; echo "</tr>"; foreach ($DB->request($query_limit) as $data) { echo "<tr class='tab_bg_1' align='center'>"; echo "<td>"; $order->getFromDB($data['plugin_order_orders_id']); echo $order->getLink(PluginOrderOrder::canView()); echo "</td>"; echo "<td>"; echo Dropdown::getDropdownName("glpi_entities", $order->fields["entities_id"]); echo "</td>"; echo "</tr>"; } echo "</table>"; } else { echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><td class='center'>" . __("No item to display") . "</td></tr>"; echo "</table>"; } echo "</div>"; }
public static function showOrdersItems(PluginOrderBill $bill) { global $DB, $CFG_GLPI; $reference = new PluginOrderReference(); $order = new PluginOrderOrder(); $order->getFromDB($bill->fields['plugin_order_orders_id']); //Can write orders, and order is not already paid $canedit = $order->can($order->getID(), UPDATE) && !$order->isPaid() && !$order->isCanceled(); $query_ref = "SELECT `glpi_plugin_order_orders_items`.`id` AS IDD, " . "`glpi_plugin_order_orders_items`.`plugin_order_references_id` AS id, " . "`glpi_plugin_order_references`.`name`, " . "`glpi_plugin_order_references`.`itemtype`, " . "`glpi_plugin_order_references`.`manufacturers_id` " . "FROM `glpi_plugin_order_orders_items`, `glpi_plugin_order_references` " . "WHERE `plugin_order_orders_id` = '" . $order->getID() . "' " . "AND `glpi_plugin_order_orders_items`.`plugin_order_references_id` = `glpi_plugin_order_references`.`id` " . "GROUP BY `glpi_plugin_order_orders_items`.`plugin_order_references_id` " . "ORDER BY `glpi_plugin_order_references`.`name`"; $result_ref = $DB->query($query_ref); while ($data_ref = $DB->fetch_array($result_ref)) { echo "<div class='center'><table class='tab_cadre_fixe'>"; if (!$DB->numrows($result_ref)) { echo "<tr><th>" . __("No item to take delivery of", "order") . "</th></tr></table></div>"; } else { $order_item = new PluginOrderOrder_Item(); $rand = mt_rand(); $itemtype = $data_ref["itemtype"]; $item = new $itemtype(); echo "<tr><th><ul><li>"; echo "<a href=\"javascript:showHideDiv('generation{$rand}','generation_img{$rand}', '" . $CFG_GLPI['root_doc'] . "/pics/plus.png','" . $CFG_GLPI['root_doc'] . "/pics/moins.png');\">"; echo "<img alt='' name='generation_img{$rand}' src=\"" . $CFG_GLPI['root_doc'] . "/pics/plus.png\">"; echo "</a>"; echo "</li></ul></th>"; echo "<th>" . __("Type") . "</th>"; echo "<th>" . __("Manufacturer") . "</th>"; echo "<th>" . __("Product reference", "order") . "</th>"; echo "</tr>"; echo "<tr class='tab_bg_1 center'>"; echo "<td></td>"; echo "<td align='center'>" . $item->getTypeName() . "</td>"; //Entity echo "<td align='center'>"; echo Dropdown::getDropdownName('glpi_entities', $order->getEntityID()); echo "</td>"; echo "<td>" . $reference->getReceptionReferenceLink($data_ref) . "</td>"; echo "</tr></table>"; echo "<div class='center' id='generation{$rand}' style='display:none'>"; echo "<form method='post' name='bills_form{$rand}' id='bills_form{$rand}'\n action='" . Toolbox::getItemTypeFormURL('PluginOrderBill') . "'>"; echo "<input type='hidden' name='plugin_order_orders_id' value='" . $order->getID() . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<th></th>"; echo "<th>" . __("Reference") . "</th>"; echo "<th>" . __("Type") . "</th>"; echo "<th>" . __("Model") . "</th>"; echo "<th>" . __("Bill", "order") . "</th>"; echo "<th>" . __("Bill status", "order") . "</th>"; echo "</tr>"; $results = $order_item->queryBills($order->getID(), $data_ref['id']); while ($data = $DB->fetch_array($results)) { echo "<tr class='tab_bg_1'>"; if ($canedit) { echo "<td width='10'>"; $sel = ""; if (isset($_GET["select"]) && $_GET["select"] == "all") { $sel = "checked"; } echo "<input type='checkbox' name='item[" . $data["IDD"] . "]' value='1' {$sel}>"; echo "<input type='hidden' name='plugin_order_orders_id' value='" . $order->getID() . "'>"; echo "</td>"; } //Reference echo "<td align='center'>"; echo $reference->getReceptionReferenceLink($data); echo "</td>"; //Type echo "<td align='center'>"; if (file_exists($CFG_GLPI['root_doc'] . "/inc/" . strtolower($data["itemtype"]) . "type.class.php")) { echo Dropdown::getDropdownName(getTableForItemType($data["itemtype"] . "Type"), $data["types_id"]); } echo "</td>"; //Model echo "<td align='center'>"; if (file_exists($CFG_GLPI['root_doc'] . "/inc/" . strtolower($data["itemtype"]) . "model.class.php")) { echo Dropdown::getDropdownName(getTableForItemType($data["itemtype"] . "Model"), $data["models_id"]); } $bill = new PluginOrderBill(); echo "<td align='center'>"; if ($data["plugin_order_bills_id"] > 0) { if ($bill->can($data['plugin_order_bills_id'], READ)) { echo "<a href='" . $bill->getLinkURL() . "'>" . $bill->getName(true) . "</a>"; } else { echo $bill->getName(); } } echo "</td>"; echo "<td align='center'>"; echo Dropdown::getDropdownName(getTableForItemType('PluginOrderBillState'), $data['plugin_order_billstates_id']); echo "</td>"; echo "</tr>"; } } echo "</table>"; if ($canedit) { echo "<div class='center'>"; echo "<table width='950px' class='tab_glpi'>"; echo "<tr><td><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png\" alt=''></td><td class='center'>"; echo "<a onclick= \"if ( markCheckboxes('bills_form{$rand}') ) " . "return false;\" href='#'>" . __("Check all") . "</a></td>"; echo "<td>/</td><td class='center'>"; echo "<a onclick= \"if ( unMarkCheckboxes('bills_form{$rand}') ) " . "return false;\" href='#'>" . __("Uncheck all") . "</a>"; echo "</td><td align='left' width='80%'>"; echo "<input type='hidden' name='plugin_order_orders_id' value='" . $order->getID() . "'>"; $order_item->dropdownBillItemsActions($order->getID()); echo "</td>"; echo "</table>"; echo "</div>"; } Html::closeForm(); echo "</div>"; } echo "<br>"; }
public static function showOrderSupplierSurvey($ID) { global $DB, $CFG_GLPI; $order = new PluginOrderOrder(); $order->getFromDB($ID); $survey = new self(); $table = getTableForItemType(__CLASS__); Session::initNavigateListItems(__CLASS__, __("Order", "order") . " = " . $order->fields["name"]); $candelete = $order->can($ID, DELETE); $query = "SELECT * FROM `{$table}` WHERE `plugin_order_orders_id` = '{$ID}' "; $result = $DB->query($query); $rand = mt_rand(); echo "<div class='center'>"; echo "<form method='post' name='show_suppliersurvey{$rand}' id='show_suppliersurvey{$rand}' " . " action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\">"; echo "<input type='hidden' name='plugin_order_orders_id' value='" . $ID . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='5'>" . __("Supplier quality", "order") . "</th></tr>"; echo "<tr><th> </th>"; echo "<th>" . __("Supplier") . "</th>"; echo "<th>" . __("Note", "order") . "</th>"; echo "<th>" . __("Comment on survey", "order") . "</th>"; echo "</tr>"; if ($DB->numrows($result) > 0) { while ($data = $DB->fetch_array($result)) { Session::addToNavigateListItems(__CLASS__, $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(__CLASS__); echo "<td><a href='" . $link . "?id=" . $data["id"] . "&plugin_order_orders_id=" . $ID . "'>" . Dropdown::getDropdownName("glpi_suppliers", $data["suppliers_id"]) . "</a></td>"; echo "<td>"; $total = $survey->getTotalNotation($ID); echo $total . " / 10"; echo "</td>"; echo "<td>"; echo $data["comment"]; echo "</td>"; echo "</tr>"; } echo "</table>"; if ($candelete) { echo "<div class='center'>"; Html::openArrowMassives("show_suppliersurvey{$rand}", true); Html::closeArrowMassives(array("delete" => __("Delete permanently"))); echo "</div>"; } } else { echo "</table>"; } Html::closeForm(); echo "</div>"; }
public static function countForOrder(PluginOrderOrder $item) { return countElementsInTable('glpi_plugin_order_orders_items', "`plugin_order_orders_id` = '" . $item->getID() . "' " . "AND `states_id` = '" . PluginOrderOrder::ORDER_DEVICE_DELIVRED . "'"); }
@link https://forge.indepnet.net/projects/order @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; if (!isset($_GET["id"])) { $_GET["id"] = ""; } if (!isset($_GET["withtemplate"])) { $_GET["withtemplate"] = ""; } if (!isset($_GET["plugin_order_orders_id"])) { $_GET["plugin_order_orders_id"] = ""; } $supplier = new PluginOrderOrder_Supplier(); $order = new PluginOrderOrder(); if (isset($_POST["add"])) { if (PluginOrderOrder_Supplier::canCreate()) { if (isset($_POST["plugin_order_orders_id"]) && $_POST["plugin_order_orders_id"] > 0) { if ($supplier->add($_POST)) { $new_value = __("Add") . " "; if ($_POST["num_quote"]) { $new_value .= __("Quote number", "order") . " " . $_POST["num_quote"]; } if ($_POST["num_order"]) { $new_value .= " - " . __("Order number") . " : " . $_POST["num_order"]; } $order->addHistory('PluginOrderOrder', "", $new_value, $_POST["plugin_order_orders_id"]); } } }
/* LICENSE This file is part of the order plugin. Order plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Order plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; along with Order. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package order @author the order plugin team @copyright Copyright (c) 2010-2015 Order plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/order @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; require_once '../lib/odtphp/odf.php'; $PluginOrderOrder = new PluginOrderOrder(); $PluginOrderOrder->generateOrder($_POST);
it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Order plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; along with Order. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package order @author the order plugin team @copyright Copyright (c) 2010-2015 Order plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/order @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; Html::header(__("Orders", "order"), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "order"); $order = new PluginOrderOrder(); if (PluginOrderOrder::canView() || Session::haveRight("config", UPDATE)) { Search::show("PluginOrderOrder"); } else { echo "<div align='center'><br><br><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/warning.png\" alt=\"warning\"><br><br>"; echo "<b>" . __("Access denied") . "</b></div>"; } Html::footer();
$PluginOrderOrder = new PluginOrderOrder(); $PluginOrderReference = new PluginOrderReference(); $PluginOrderBill = new PluginOrderBill(); //If there's only one possibility, do not display menu! if (PluginOrderOrder::canView() && !PluginOrderReference::canView() && !PluginOrderBill::canView()) { Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderOrder')); } elseif (!PluginOrderOrder::canView() && PluginOrderReference::canView() && !PluginOrderBill::canView()) { Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderReference')); } elseif (!PluginOrderOrder::canView() && !PluginOrderReference::canView() && PluginOrderBill::canView()) { Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderBill')); } if (PluginOrderOrder::canView() || PluginOrderReference::canView()) { echo "<div class='center'>"; echo "<table class='tab_cadre'>"; echo "<tr><th colspan='2'>" . __("Orders management", "order") . "</th></tr>"; if (PluginOrderOrder::canView()) { echo "<tr class='tab_bg_1' align='center'>"; echo "<td><img src='../pics/order-icon.png'></td>"; echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginOrderOrder') . "'>" . __("Orders", "order") . "</a></td></tr>"; } if (PluginOrderReference::canView()) { echo "<tr class='tab_bg_1' align='center'>"; echo "<td><img src='../pics/reference-icon.png'></td>"; echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginOrderReference') . "'>" . __("Products references", "order") . "</a></td></tr>"; } if (PluginOrderBill::canView()) { echo "<tr class='tab_bg_1' align='center'>"; echo "<td><img src='../pics/bill-icon.png'></td>"; echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginOrderBill') . "'>" . __("Bills", "order") . "</a></td></tr>"; } echo "</table></div>";
function plugin_order_MassiveActionsProcess($data) { global $DB; switch ($data['action']) { case "plugin_order_transfert": if ($data['itemtype'] == 'PluginOrderOrder') { $order = new PluginOrderOrder(); foreach ($data["item"] as $key => $val) { if ($val == 1) { $order->transfer($key, $data['entities_id']); } } } break; case "plugin_order_copy_reference": if ($data['itemtype'] == 'PluginOrderReference') { $reference = new PluginOrderReference(); foreach ($data["item"] as $key => $val) { if ($val == 1) { $reference->copy($key); } } } break; case "plugin_order_transfer_reference": if ($data['itemtype'] == 'PluginOrderReference') { $reference = new PluginOrderReference(); foreach ($data["item"] as $key => $val) { if ($val == 1) { $reference->transfer($key, $data['entities_id']); } } } break; } }
$tmp['id'] = $key; $order_item->update($tmp); // Update infocom $ic = new Infocom(); $ic->getFromDBforDevice($order_item->fields['itemtype'], $order_item->fields['items_id']); $config = PluginOrderConfig::getConfig(); if ($config->canAddBillDetails()) { if ($bill->getFromDB($_POST["plugin_order_bills_id"])) { $fields['id'] = $ic->fields['id']; $fields['bill'] = $bill->fields['number']; $fields['warranty_date'] = $bill->fields['billdate']; } } $ic->update($fields); } } } break; } PluginOrderOrder::updateBillState($order_item->fields['plugin_order_orders_id']); Html::back(); } $dropdown = new PluginOrderBill(); Session::checkRight("plugin_order_bill", READ); Html::header(PluginOrderBill::getTypeName(1), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "bill"); if (isset($_REQUEST['id'])) { $bill->display($_REQUEST); } else { $bill->show(); } Html::footer();
public static function countForOrder(PluginOrderOrder $item) { return countElementsInTable('glpi_plugin_order_orders_items', "`plugin_order_orders_id` = '" . $item->getID() . "'"); }