CVE-2023-29006 (published 2023-04-05T18:15Z)

The Order GLPI plugin allows users to manage order management within GLPI. Starting with version 1.8.0 and prior to versions 2.7.7 and 2.10.1, an authenticated user that has access to standard interface can craft an URL that can be used to execute a system command. Versions 2.7.7 and 2.10.1 contain a patch for this issue. As a workaround, delete the `ajax/dropdownContact.php` file from the plugin.

CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-502
cwe_name: Deserialization of Untrusted Data
description: The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
extended_description: 
            It is often convenient to serialize objects for communication or to save them for later use. However, deserialized data or code can often be modified without using the provided accessor functions if it does not use cryptography to protect itself. Furthermore, any cryptography would still be client-side security -- which is a dangerous security assumption.
            Data that is untrusted can not be trusted to be well-formed.
            When developers place no restrictions on "gadget chains," or series of instances and method invocations that can self-execute during the deserialization process (i.e., before the object is returned to the caller), it is sometimes possible for attackers to leverage them to perform unauthorized actions, like generating a shell.
         
         

Fix information:
repo_url: https://github.com/pluginsGLPI/order
commit_details: repo_url: https://github.com/pluginsGLPI/order
author: Cédric Anne
author_date: 2023-02-02 12:04:37+01:00
msg: Clean-up code
repository: repo_url: https://github.com/pluginsGLPI/order
repo_name: pluginsGLPI/order
description: Order plugin for GLPI
repo_language: PHP
owner: pluginsGLPI
file_changes: filename: detail.php
change_type: ModificationType.DELETE
diff: @@ -1,69 +0,0 @@
-<?php
-
-/**
- * -------------------------------------------------------------------------
- * Order plugin for GLPI
- * -------------------------------------------------------------------------
- *
- * LICENSE
- *
- * This file is part of Order.
- *
- * Order 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 3 of the License, or
- * (at your option) any later version.
- *
- * Order 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 Order. If not, see <http://www.gnu.org/licenses/>.
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2009-2022 by Order plugin team.
- * @license   GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
- * @link      https://github.com/pluginsGLPI/order
- * -------------------------------------------------------------------------
- */
-
-include ("../../../inc/includes.php");
-
-header("Content-Type: text/html; charset=UTF-8");
-
-Html::header_nocache();
-
-if (!defined('GLPI_ROOT')) {
-   die("Can not acces directly to this file");
-}
-
-Session::checkCentralAccess();
-
-$rand         = $_POST["rand"];
-$paramsaction = [
-   'plugin_order_references_id' => '__VALUE__',
-   'entity_restrict'            => $_POST["entity_restrict"],
-   'suppliers_id'               => $_POST["suppliers_id"],
-   'itemtype'                   => $_POST['itemtype'],
-];
-$fields = [
-   "quantity",
-   "priceht",
-   "pricediscounted",
-   "taxe",
-   "validate",
-];
-
-$order_url = Plugin::getWebDir('order');
-
-foreach ($fields as $field) {
-   $paramsaction['update'] = $field;
-   Ajax::updateItem("show_$field",
-                    "$order_url/ajax/referencedetail.php",
-                    $paramsaction, "dropdown_reference$rand");
-   Ajax::updateItemOnSelectEvent("dropdown_reference$rand",
-                                 "show_$field",
-                                 "$order_url/ajax/referencedetail.php",
-                                 $paramsaction);
-}

programming_language: unknown
filename: dropdownContact.php
change_type: ModificationType.DELETE
diff: @@ -1,101 +0,0 @@
-<?php
-
-/**
- * -------------------------------------------------------------------------
- * Order plugin for GLPI
- * -------------------------------------------------------------------------
- *
- * LICENSE
- *
- * This file is part of Order.
- *
- * Order 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 3 of the License, or
- * (at your option) any later version.
- *
- * Order 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 Order. If not, see <http://www.gnu.org/licenses/>.
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2009-2022 by Order plugin team.
- * @license   GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
- * @link      https://github.com/pluginsGLPI/order
- * -------------------------------------------------------------------------
- */
-
-if (strpos($_SERVER['PHP_SELF'], "dropdownContact.php")) {
-   include ("../../../inc/includes.php");
-   header("Content-Type: text/html; charset=UTF-8");
-   Html::header_nocache();
-}
-
-if (!defined('GLPI_ROOT')) {
-   die("Can not acces directly to this file");
-}
-
-Session::checkCentralAccess();
-
-// Make a select box with all glpi users
-$where = " WHERE `glpi_contacts_suppliers`.`contacts_id` = `glpi_contacts`.`id`
-           AND (`glpi_contacts_suppliers`.`suppliers_id` = '".$_POST['suppliers_id']."'
-           AND `glpi_contacts`.`is_deleted` = '0' ) ";
-
-
-if (isset($_POST["entity_restrict"])) {
-   if (!is_numeric($_POST["entity_restrict"]) && !is_array($_POST["entity_restrict"])) {
-      $_POST["entity_restrict"] = unserialize(Toolbox::stripslashes_deep($_POST["entity_restrict"]));
-   }
-   $where .= getEntitiesRestrictRequest("AND", "glpi_contacts", '', $_POST["entity_restrict"], true);
-} else {
-   $where .= getEntitiesRestrictRequest("AND", "glpi_contacts", '', '', true);
-}
-
-if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
-   $where .= " AND `glpi_contacts`.`name` ".makeTextSearch($_POST['searchText']);
-}
-
-$LIMIT = "LIMIT 0, ".$CFG_GLPI["dropdown_max"];
-if ($_POST['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
-   $LIMIT = "";
-}
-
-
-$query = "SELECT `glpi_contacts`.*
-          FROM `glpi_contacts`,`glpi_contacts_suppliers`
-          $where
-          ORDER BY `entities_id`, `name` $LIMIT";
-//error_log($query);
-$result = $DB->query($query);
-
-echo "<select name='contacts_id'>";
-
-echo "<option value='0'>".Dropdown::EMPTY_VALUE."</option>";
-
-if ($DB->numrows($result)) {
-   $prev = -1;
-   while ($data = $DB->fetchArray($result)) {
-      if ($data["entities_id"] != $prev) {
-         if ($prev > 0) {
-            echo "</optgroup>";
-         }
-         $prev = $data["entities_id"];
-         echo "<optgroup label=\"".Dropdown::getDropdownName("glpi_entities", $prev)."\">";
-      }
-      $output = formatUserName($data["id"], "", $data["name"], $data["firstname"]);
-      if ($_SESSION["glpiis_ids_visible"] || empty($output)) {
-         $output .= " (".$data["id"].")";
-      }
-      echo "<option value=\"".$data["id"]."\" title=\"$output\">"
-        .substr($output, 0, $CFG_GLPI["dropdown_chars_limit"])."</option>";
-   }
-   if ($prev >= 0) {
-      echo "</optgroup>";
-   }
-}
-
-echo "</select>";

programming_language: unknown
filename: referencedetail.php
change_type: ModificationType.DELETE
diff: @@ -1,77 +0,0 @@
-<?php
-
-/**
- * -------------------------------------------------------------------------
- * Order plugin for GLPI
- * -------------------------------------------------------------------------
- *
- * LICENSE
- *
- * This file is part of Order.
- *
- * Order 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 3 of the License, or
- * (at your option) any later version.
- *
- * Order 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 Order. If not, see <http://www.gnu.org/licenses/>.
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2009-2022 by Order plugin team.
- * @license   GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
- * @link      https://github.com/pluginsGLPI/order
- * -------------------------------------------------------------------------
- */
-
-include ("../../../inc/includes.php");
-
-header("Content-Type: text/html; charset=UTF-8");
-
-Html::header_nocache();
-
-if (!defined('GLPI_ROOT')) {
-   die("Can not acces directly to this file");
-}
-
-Session::checkCentralAccess();
-
-if ($_POST["plugin_order_references_id"] > 0) {
-   $reference_supplier = new PluginOrderReference_Supplier();
-   $price = $reference_supplier->getPriceByReferenceAndSupplier($_POST["plugin_order_references_id"],
-                                                                $_POST["suppliers_id"]);
-   switch ($_POST["update"]) {
-      case 'quantity':
-         echo "<input type='number' class='form-control' min='0' name='quantity' class='quantity'>";
-         break;
-      case 'priceht':
-         echo "<input type='number' class='form-control' min='0' step='".PLUGIN_ORDER_NUMBER_STEP."'
-                      name='price' value='".Html::formatNumber($price, true)."' class='decimal'>";
-         break;
-      case 'pricediscounted':
-         echo "<input type='number' class='form-control' min='0' step='".PLUGIN_ORDER_NUMBER_STEP."'
-                      name='discount' class='smalldecimal' value='0'>";
-         break;
-      case 'taxe':
-         $config = PluginOrderConfig::getConfig();
-         PluginOrderOrderTax::Dropdown([
-            'name'                => "plugin_order_ordertaxes_id",
-            'value'               => $config->getDefaultTaxes(),
-            'display_emptychoice' => true,
-            'emptylabel'          => __("No VAT", "order"),
-         ]);
-         break;
-      case 'validate':
-         echo Html::hidden('itemtype', ['value' => $_POST["itemtype"]]);
-         echo Html::hidden('plugin_order_references_id',
-                           ['value' => $_POST["plugin_order_references_id"]]);
-         echo "<input type='submit' name='add_item' value=\"". __("Add")."\" class='submit' >";
-         break;
-   }
-} else {
-   return "";
-}

programming_language: unknown
filename: referencespecifications.php
change_type: ModificationType.MODIFY
diff: @@ -45,11 +45,6 @@ $PluginOrderReference = new PluginOrderReference();
 if ($_POST["itemtype"]) {
    switch ($_POST["field"]) {
       case "types_id":
-         if ($_POST["itemtype"] == 'PluginOrderOther') {
-            $file = 'other';
-         } else {
-            $file = $_POST["itemtype"];
-         }
          if (class_exists($_POST["itemtype"].'Type')) {
             Dropdown::show($_POST["itemtype"]."Type", ['name' => "types_id"]);
          }

programming_language: PHP
filename: referencetree.php
change_type: ModificationType.DELETE
diff: @@ -1,47 +0,0 @@
-<?php
-
-/**
- * -------------------------------------------------------------------------
- * Order plugin for GLPI
- * -------------------------------------------------------------------------
- *
- * LICENSE
- *
- * This file is part of Order.
- *
- * Order 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 3 of the License, or
- * (at your option) any later version.
- *
- * Order 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 Order. If not, see <http://www.gnu.org/licenses/>.
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2009-2022 by Order plugin team.
- * @license   GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
- * @link      https://github.com/pluginsGLPI/order
- * -------------------------------------------------------------------------
- */
-
-$AJAX_INCLUDE = 1;
-
-include ("../../../inc/includes.php");
-
-header("Content-Type: text/html; charset=UTF-8");
-
-Html::header_nocache();
-
-Session::checkLoginUser();
-
-if (!isset($_GET['target'])) {
-   $_GET['target'] = Plugin::getWebDir('order')."/front/reference.php";
-}
-
-PluginOrderReference::showSelector($_GET['target']);
-
-Html::ajaxFooter();

programming_language: unknown
filename: referencetreetypes.php
change_type: ModificationType.DELETE
diff: @@ -1,91 +0,0 @@
-<?php
-
-/**
- * -------------------------------------------------------------------------
- * Order plugin for GLPI
- * -------------------------------------------------------------------------
- *
- * LICENSE
- *
- * This file is part of Order.
- *
- * Order 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 3 of the License, or
- * (at your option) any later version.
- *
- * Order 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 Order. If not, see <http://www.gnu.org/licenses/>.
- * -------------------------------------------------------------------------
- * @copyright Copyright (C) 2009-2022 by Order plugin team.
- * @license   GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
- * @link      https://github.com/pluginsGLPI/order
- * -------------------------------------------------------------------------
- */
-
-$AJAX_INCLUDE = 1;
-
-include ("../../../inc/includes.php");
-
-header("Content-Type: text/html; charset=UTF-8");
-
-Html::header_nocache();
-
-Session::checkLoginUser();
-
-if (isset($_REQUEST['node'])) {
-   $target = "reference.php";
-   $nodes  = [];
-
-   // Root node
-   if ($_REQUEST['node'] == -1) {
-      $pos      = 0;
-      $entity   = $_SESSION['glpiactive_entity'];
-      $entities = getEntitiesRestrictRequest("AND", "glpi_plugin_order_references");
-
-      $query = "SELECT DISTINCT `itemtype`
-                FROM `glpi_plugin_order_references`
-                WHERE `glpi_plugin_order_references`.`is_deleted` = '0'
-                $entities
-                GROUP BY `itemtype`
-                ORDER BY `itemtype`";
-
-      if ($result = $DB->query($query)) {
-         if ($DB->numrows($result)) {
-            $pos = 0;
-
-            while ($row = $DB->fetchArray($result)) {
-               $class             = $row['itemtype'];
-               $item              = new $class();
-               $path['text']      = $item->getTypeName();
-               $path['position']  = $pos;
-               $pos++;
-               $path['draggable'] = false;
-
-               if ($entity == 0) {
-                  $link = "&link[1]=AND&searchtype[1]=contains&contains[1]=NULL&field[1]=80";
-               } else {
-                  $link = "&link[1]=AND&searchtype[1]=contains&contains[1]=".
-                          Dropdown::getDropdownName("glpi_entities", $entity)."&field[1]=80";
-               }
-
-               $path['href'] = Plugin::getWebDir('order').
-                  "/front/$target?is_deleted=0&field[0]=3&searchtype[0]=equals&contains[0]=".
-                  rawurlencode($class)."&$link&itemtype=PluginOrderReference&start=0";
-
-               // Check if node is a leaf or a folder.
-               $path['leaf'] = true;
-               $path['cls']  = 'file';
-               $nodes[]      = $path;
-            }
-         }
-      }
-   }
-
-   print json_encode($nodes);
-}

programming_language: unknown
filename: bill.form.php
change_type: ModificationType.MODIFY
diff: @@ -83,7 +83,6 @@ if (isset($_POST['action'])) {
    PluginOrderOrder::updateBillState($order_item->fields['plugin_order_orders_id']);
    Html::back();
 }
-$dropdown = new PluginOrderBill();
 
 Session::checkRight("plugin_order_bill", READ);
 

programming_language: PHP
filename: menu.php
change_type: ModificationType.MODIFY
diff: @@ -37,10 +37,6 @@ Html::header(
    "PluginOrderMenu"
 );
 
-$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'));

programming_language: PHP
filename: order.form.php
change_type: ModificationType.MODIFY
diff: @@ -40,7 +40,6 @@ if (!isset ($_GET["withtemplate"])) {
 $pluginOrderOrder          = new PluginOrderOrder();
 $config                    = new PluginOrderConfig();
 $pluginOrderOrder_Item     = new PluginOrderOrder_Item();
-$pluginOrderOrder_Supplier = new PluginOrderOrder_Supplier();
 
 /* add order */
 if (isset ($_POST["add"])) {

programming_language: PHP
filename: order.php
change_type: ModificationType.MODIFY
diff: @@ -38,8 +38,6 @@ Html::header(
    "order"
 );
 
-$order = new PluginOrderOrder();
-
 if (PluginOrderOrder::canView() || Session::haveRight("config", UPDATE)) {
    Search::show("PluginOrderOrder");
 } else {

programming_language: PHP
filename: reference.php
change_type: ModificationType.MODIFY
diff: @@ -38,8 +38,6 @@ Html::header(
    "references"
 );
 
-$reference = new PluginOrderReference();
-
 if (PluginOrderReference::canView()) {
    Search::show("PluginOrderReference");
 } else {

programming_language: PHP
filename: reference_supplier.form.php
change_type: ModificationType.MODIFY
diff: @@ -45,7 +45,7 @@ $PluginOrderReference_Supplier = new PluginOrderReference_Supplier();
 if (isset($_POST["add"])) {
    if (PluginOrderReference_Supplier::canCreate()) {
       if (isset($_POST["suppliers_id"]) && $_POST["suppliers_id"] > 0) {
-         $newID = $PluginOrderReference_Supplier->add($_POST);
+         $PluginOrderReference_Supplier->add($_POST);
       }
    }
    Html::redirect($_SERVER['HTTP_REFERER']);

programming_language: PHP
filename: surveysupplier.form.php
change_type: ModificationType.MODIFY
diff: @@ -45,7 +45,7 @@ $PluginOrderSurveySupplier = new PluginOrderSurveySupplier();
 if (isset($_POST["add"])) {
    if (PluginOrderSurveySupplier::canCreate()) {
       if (isset($_POST["plugin_order_orders_id"]) && $_POST["plugin_order_orders_id"] > 0) {
-         $newID = $PluginOrderSurveySupplier->add($_POST);
+         $PluginOrderSurveySupplier->add($_POST);
       }
    }
    Html::redirect($_SERVER['HTTP_REFERER']);

programming_language: PHP
filename: hook.php
change_type: ModificationType.MODIFY
diff: @@ -326,8 +326,6 @@ function plugin_order_giveItem($type, $ID, $data, $num) {
 
 
 function plugin_order_displayConfigItem($type, $ID, $data, $num) {
-   global $CFG_GLPI;
-
    $searchopt = &Search::getOptions($type);
    $table = $searchopt[$ID]["table"];
    $field = $searchopt[$ID]["field"];

programming_language: PHP
filename: bill.class.php
change_type: ModificationType.MODIFY
diff: @@ -276,27 +276,14 @@ class PluginOrderBill extends CommonDropdown
          echo "<th>".__("Status")."</th>";
          echo "</tr>";
 
-         $old_itemtype = '';
-         $num          = 0;
-
          while ($data = $DB->fetchArray($result)) {
             if (!class_exists($data['itemtype'])) {
                continue;
             }
             $item = new $data['itemtype']();
-            if ($data['itemtype']::canView()) {
+            if ($data['itemtype']::canView() && $item->getFromDB($data["id"])) {
                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>";

programming_language: PHP
filename: config.class.php
change_type: ModificationType.MODIFY
diff: @@ -79,8 +79,6 @@ class PluginOrderConfig extends CommonDBTM {
 
 
    public static function getMenuContent() {
-      global $CFG_GLPI;
-
       $menu  = parent::getMenuContent();
       $menu['page']   = PluginOrderMenu::getSearchURL(false);
       $menu['links']['add']    = null;
@@ -768,7 +766,7 @@ class PluginOrderConfig extends CommonDBTM {
          //version 2.0.1
          $migration->addField($table, "use_free_reference", "bool");
 
-   
+
       }
 
       $migration->displayMessage("Add default order state workflow");

programming_language: PHP
filename: link.class.php
change_type: ModificationType.MODIFY
diff: @@ -116,7 +116,6 @@ class PluginOrderLink extends CommonDBChild {
                $item->getFromDB($templateID);
 
                $name         = $item->fields["name"] ?? "";
-               $serial       = $item->fields["serial"] ?? "";
                $otherserial  = $item->fields["otherserial"] ?? "";
                $states_id    = $item->fields["states_id"] ?? "";
                $locations_id = $item->fields["locations_id"] ?? "";
@@ -124,7 +123,6 @@ class PluginOrderLink extends CommonDBChild {
                $immo_number  = $item->fields["immo_number"] ?? "";
             } else {
                $name         = false;
-               $serial       = false;
                $otherserial  = false;
                $states_id    = false;
                $locations_id = false;
@@ -147,7 +145,7 @@ class PluginOrderLink extends CommonDBChild {
             } else {
                echo "<td><input type='text' size='20' name='id[$i][otherserial]'></td>";
             }
-			
+
             if ($config->canAddImmobilizationNumber()) {
                 if ($immo_number) {
                    echo "<td align='center'>".Dropdown::EMPTY_VALUE."</td>";
@@ -519,7 +517,6 @@ class PluginOrderLink extends CommonDBChild {
 
 
    function getSpecificMassiveActions($checkitem = null) {
-      $isadmin = static::canUpdate();
       $actions = parent::getSpecificMassiveActions($checkitem);
       $sep     = __CLASS__.MassiveAction::CLASS_ACTION_SEPARATOR;
 
@@ -637,91 +634,6 @@ class PluginOrderLink extends CommonDBChild {
    }
 
 
-   public function getLinkedItemDetails($itemtype, $items_id) {
-      $comments = "";
-
-      switch ($itemtype) {
-         case 'ConsumableItem' :
-            $ci = new Consumable();
-            if ($ci->getFromDB($items_id)) {
-               $ct = new ConsumableItem();
-               $ct->getFromDB($ci->fields['consumableitems_id']);
-
-               $comments .= "<strong>".__("Entity").":</strong> ";
-               $comments .= Dropdown::getDropdownName("glpi_entities", $ct->fields["entities_id"]);
-               $comments .= '<br><strong>'.__("Consumable").' : </strong> #'.$items_id;
-               $comments .= '<br><strong>'.__("Consumable type").' : </strong>';
-               $comments .= $ct->fields['name'];
-               $comments .= '<br><strong>'.__("Manufacturer").' : </strong>';
-               $comments .= Dropdown::getDropdownName('glpi_manufacturers', $ct->fields['manufacturers_id']);
-               $comments .= '<br><strong>'.__("State").' : </strong>';
-               $comments .= (!$ci->fields['users_id'] ? __("In stock") : __("Used"));
-               if ($ci->fields['users_id']) {
-                  $comments .= '<br><strong>'.__("User").' : </strong>';
-                  $comments .= Dropdown::getDropdownName('glpi_users', $ci->fields['users_id']);
-               }
-            }
-            break;
-         case 'CartridgeItem' :
-            $ci = new Cartridge();
-            if ($ci->getFromDB($items_id)) {
-               $ct = new CartridgeItem();
-               $ct->getFromDB($ci->fields['cartridgeitems_id']);
-
-               $comments .= "<strong>".__("Entity").":</strong> ";
-               $comments .= Dropdown::getDropdownName("glpi_entities", $ct->fields["entities_id"]);
-               $comments .= '<br><strong>'.__("Cartridge").' : </strong> #'.$items_id;
-               $comments .= '<br><strong>'._n("New", "New", 2).' : </strong>';
-               $comments .= $ct->fields['name'];
-               $comments .= '<br><strong>'.__("Manufacturer").' : </strong>';
-               $comments .= Dropdown::getDropdownName('glpi_manufacturers', $ct->fields['manufacturers_id']);
-            }
-            break;
-         // case 'Computer' :
-         // case 'Monitor' :
-         // case 'NetworkEquipment' :
-         // case 'Peripheral' :
-         // case 'Phone' :
-         // case 'Printer' :
-         default :
-            $item = new $itemtype();
-            $item->getFromDB($items_id);
-
-            if ($item->getField("name")) {
-               $comments .= "<strong>".__("Name").":</strong> ";
-               $comments .= $item->getField("name");
-            }
-
-            if ($item->getField("entities_id")) {
-               $comments .= "<strong>".__("Entity").":</strong> ";
-               $comments .= Dropdown::getDropdownName("glpi_entities", $item->getField("entities_id"));
-            }
-
-            if ($item->getField("serial") != '') {
-               $comments .= "<br><strong>".__("Serial number").":</strong> ";
-               $comments .= $item->getField("serial");
-            }
-
-            if ($item->getField("otherserial") != '') {
-               $comments .= "<br><strong>".__("Inventory number").":</strong> ";
-               $comments .= $item->getField("otherserial");
-            }
-            if ($item->getField("locations_id")) {
-               $comments .= "<br><strong>".__("Location").":</strong> ";
-               $comments .= Dropdown::getDropdownName('glpi_locations', $item->getField("locations_id"));
-            }
-
-            if ($item->getField("users_id")) {
-               $comments .= "<br><strong>".__("User").":</strong> ";
-               $comments .= Dropdown::getDropdownName('glpi_users', $item->getField("users_id"));
-            }
-            break;
-      }
-
-      return ($comments);
-   }
-
-
    public function getReceptionItemName($items_id, $itemtype) {
       if ($items_id == 0) {
          return (__("No associated item", "order"));
@@ -747,35 +659,6 @@ class PluginOrderLink extends CommonDBChild {
       }
    }
 
-
-   /*public function dropdownLinkActions($itemtype, $plugin_order_references_id,
-                                       $plugin_order_orders_id, $entities_id) {
-      global $CFG_GLPI;
-
-      $rand       = mt_rand();
-      $reception  = new PluginOrderReception();
-      $actions[0] = Dropdown::EMPTY_VALUE;
-      if ($reception->checkItemStatus($plugin_order_orders_id, $plugin_order_references_id,
-                                      PluginOrderOrder::ORDER_DEVICE_DELIVRED)) {
-         if (!in_array($itemtype, self::getTypesThanCannotBeGenerared())) {
-            $actions['generation'] = __("Generate item", "order");
-         }
-         if ($itemtype::canView()) {
-            $actions['createLink'] = __("Link to an existing item", "order");
-            $actions['deleteLink'] = __("Delete item link", "order");
-         }
-      }
-      $rand   = Dropdown::showFromArray('generationActions', $actions);
-      Ajax::updateItemOnSelectEvent("dropdown_generationActions$rand", "show_generationActions$rand",
-                                  Plugin::getWebDir('order')."/ajax/linkactions.php",
-                                  ['action'                     => '__VALUE__',
-                                   'itemtype'                   => $itemtype,
-                                   'plugin_order_references_id' => $plugin_order_references_id,
-                                   'plugin_order_orders_id'     => $plugin_order_orders_id,
-                                   'entities_id'                => $entities_id]);
-      echo "<span id='show_generationActions$rand'>&nbsp;</span>";
-   }*/
-
    public function itemAlreadyLinkedToAnOrder($itemtype, $items_id, $plugin_order_orders_id,
                                               $detailID = 0) {
       global $DB;
@@ -1067,7 +950,7 @@ class PluginOrderLink extends CommonDBChild {
          $license = $detail->fields["items_id"];
 
          $this->removeInfoComRelatedToOrder($itemtype, $license);
-         $result = $PluginOrderOrder_Item->queryRef($detail->fields["plugin_order_orders_id"],
+         $result = $detail->queryRef($detail->fields["plugin_order_orders_id"],
                                                     $detail->fields["plugin_order_references_id"],
                                                     $detail->fields["price_taxfree"],
                                                     $detail->fields["discount"],
@@ -1160,10 +1043,10 @@ class PluginOrderLink extends CommonDBChild {
          if ($add_item['itemtype']) {
             $order = new PluginOrderOrder();
          }
-   
+
          $order->getFromDB($params["plugin_order_orders_id"]);
          $reference->getFromDB($add_item["plugin_order_references_id"]);
-   
+
 		 //Update immo_number in details to fill Infocom later
          if ($config->canAddImmobilizationNumber()) {
     		 $detail = new PluginOrderOrder_Item();
@@ -1287,12 +1170,12 @@ class PluginOrderLink extends CommonDBChild {
                $input['itemtype']            = $add_item["itemtype"];
 
                $ticket = new Ticket();
-               $ticketID = $ticket->add($input);
+               $ticket->add($input);
             }
          }
 
          //-------------- End template management ---------------------------------//
-         $result = $this->createLinkWithItem($values["id"], $newID, $add_item["itemtype"],
+         $this->createLinkWithItem($values["id"], $newID, $add_item["itemtype"],
                                              $params["plugin_order_orders_id"], $entity, $templateID,
                                              false, false);
 
@@ -1348,10 +1231,10 @@ class PluginOrderLink extends CommonDBChild {
    /**
     * Copy order documents into the newly generated item
     * @since 1.5.3
-    * @param unknown_type $itemtype
-    * @param unknown_type $items_id
-    * @param unknown_type $orders_id
-    * @param unknown_type $entity
+    * @param $itemtype
+    * @param $items_id
+    * @param $orders_id
+    * @param $entity
     */
    public static function copyDocuments($itemtype, $items_id, $orders_id, $entity) {
       global $CFG_GLPI;

programming_language: PHP
filename: order.class.php
change_type: ModificationType.MODIFY
diff: @@ -1363,103 +1363,6 @@ class PluginOrderOrder extends CommonDBTM {
    }
 
 
-   public function dropdownSuppliers($myname, $value = 0, $entity_restrict = '') {
-      global $DB, $CFG_GLPI;
-
-      $rand     = mt_rand();
-      $entities = getEntitiesRestrictRequest("AND", "glpi_suppliers", '', $entity_restrict, true);
-
-      $query = "SELECT `glpi_suppliers`.*
-                FROM `glpi_suppliers`
-                LEFT JOIN `glpi_contacts_suppliers`
-                   ON (`glpi_contacts_suppliers`.`suppliers_id` = `glpi_suppliers`.`id`)
-                WHERE `glpi_suppliers`.`is_deleted` = '0'
-                $entities
-                GROUP BY `glpi_suppliers`.`id`
-                ORDER BY `entities_id`, `name`";
-      $result = $DB->query($query);
-
-      echo "<select name='suppliers_id' id='suppliers_id'>\n";
-      echo "<option value='0'>".Dropdown::EMPTY_VALUE."</option>\n";
-
-      $prev = -1;
-      while ($data = $DB->fetchArray($result)) {
-         if ($data["entities_id"] != $prev) {
-            if ($prev >= 0) {
-               echo "</optgroup>";
-            }
-            $prev = $data["entities_id"];
-            echo "<optgroup label=\"".Dropdown::getDropdownName("glpi_entities", $prev)."\">";
-         }
-         $output = $data["name"];
-         if ($_SESSION["glpiis_ids_visible"] || empty($output)) {
-            $output .= " (".$data["id"].")";
-         }
-         echo "<option value='".$data["id"]."' ".($value == $data["id"] ? " selected " : "").
-               " title=\"".Html::cleanInputText($output)."\">".
-               substr($output, 0, $CFG_GLPI["dropdown_chars_limit"])."</option>";
-      }
-      if ($prev >= 0) {
-         echo "</optgroup>";
-      }
-      echo "</select>";
-      Ajax::updateItemOnSelectEvent("suppliers_id", "show_contacts_id",
-                                    Plugin::getWebDir('order')."/ajax/dropdownSupplier.php",
-                                    [
-                                       'suppliers_id'    => '__VALUE__',
-                                       'entity_restrict' => $entity_restrict,
-                                       'rand'            => $rand,
-                                       'myname'          => $myname,
-                                    ]);
-
-      return $rand;
-   }
-
-
-   public function dropdownContacts($suppliers_id, $value = 0, $entity_restrict = '') {
-      global $DB, $CFG_GLPI;
-
-      $rand     = mt_rand();
-      $entities = getEntitiesRestrictRequest("AND", "glpi_contacts", '', $entity_restrict, true);
-
-      $query = "SELECT `glpi_contacts`.*
-                FROM `glpi_contacts`,`glpi_contacts_suppliers`
-                WHERE `glpi_contacts_suppliers`.`contacts_id` = `glpi_contacts`.`id`
-                AND `glpi_contacts_suppliers`.`suppliers_id` = '$suppliers_id'
-                AND `glpi_contacts`.`is_deleted` = '0'
-                $entities
-                ORDER BY `entities_id`, `name`";
-      $result = $DB->query($query);
-
-      echo "<select name='contacts_id'>";
-      echo "<option value='0'>".Dropdown::EMPTY_VALUE."</option>";
-
-      if ($DB->numrows($result)) {
-         $prev = -1;
-         while ($data = $DB->fetchArray($result)) {
-            if ($data["entities_id"] != $prev) {
-               if ($prev >= 0) {
-                  echo "</optgroup>";
-               }
-               $prev = $data["entities_id"];
-               echo "<optgroup label=\"".Dropdown::getDropdownName("glpi_entities", $prev)."\">";
-            }
-            $output = formatUserName($data["id"], "", $data["name"], $data["firstname"]);
-            if ($_SESSION["glpiis_ids_visible"] || empty($output)) {
-               $output .= " (".$data["id"].")";
-            }
-            echo "<option value='".$data["id"]."' ".($value == $data["id"] ? " selected " : "")
-              ." title=\"".Html::cleanInputText($output)."\">"
-              .substr($output, 0, $CFG_GLPI["dropdown_chars_limit"])."</option>";
-         }
-         if ($prev >= 0) {
-            echo "</optgroup>";
-         }
-      }
-      echo "</select>";
-   }
-
-
    public function addStatusLog($orders_id, $status, $comments = '') {
       $changes = Dropdown::getDropdownName("glpi_plugin_order_orderstates", $status);
 
@@ -1530,15 +1433,6 @@ class PluginOrderOrder extends CommonDBTM {
    }
 
 
-   public function needValidation($ID) {
-      if ($ID > 0 && $this->getFromDB($ID)) {
-         return $this->isDraft() || $this->isWaitingForApproval();
-      } else {
-         return false;
-      }
-   }
-
-
    public function deleteAllLinkWithItem($orders_id) {
       $detail  = new PluginOrderOrder_Item();
       $detail->deleteByCriteria([
@@ -1549,7 +1443,6 @@ class PluginOrderOrder extends CommonDBTM {
 
    public function checkIfDetailExists($orders_id, $only_delivered = false) {
       if ($orders_id) {
-         $detail = new PluginOrderOrder_Item();
          $where  = ['plugin_order_orders_id' => $orders_id];
          if ($only_delivered) {
             $where['states_id'] = ['>', 0];
@@ -1793,7 +1686,6 @@ class PluginOrderOrder extends CommonDBTM {
             $listeArticles = [];
 
             $result = $PluginOrderOrder_Item->queryDetail($ID, 'glpi_plugin_order_references');
-            $num    = $DB->numrows($result);
 
             while ($data = $DB->fetchArray($result)) {
                $quantity = $PluginOrderOrder_Item->getTotalQuantityByRefAndDiscount($ID, $data["id"],
@@ -1818,7 +1710,6 @@ class PluginOrderOrder extends CommonDBTM {
             }
 
             $result = $PluginOrderOrder_Item->queryDetail($ID, 'glpi_plugin_order_referencefrees');
-            $num    = $DB->numrows($result);
 
             while ($data = $DB->fetchArray($result)) {
                $quantity = $PluginOrderOrder_Item->getTotalQuantityByRefAndDiscount($ID, $data["id"],
@@ -1971,7 +1862,7 @@ class PluginOrderOrder extends CommonDBTM {
       $result = $DB->query($query);
       if ($DB->numrows($result)) {
          while ($detail = $DB->fetchArray($result)) {
-            $ref = $reference->transfer($detail["plugin_order_references_id"], $entity);
+            $reference->transfer($detail["plugin_order_references_id"], $entity);
          }
       }
    }
@@ -2219,7 +2110,6 @@ class PluginOrderOrder extends CommonDBTM {
       }
       $task->addVolume($nblate);
 
-      $cron_status = 1;
       if ($CFG_GLPI["use_notifications"]) {
          $message = __("Order is late", "order");
          $alert   = new Alert();
@@ -2336,13 +2226,6 @@ class PluginOrderOrder extends CommonDBTM {
    }
 
 
-   /**
-    * Get the standard massive actions which are forbidden
-    *
-    * @since version 0.84
-    *
-    * @return an array of massive actions
-    **/
    public function getForbiddenStandardMassiveAction() {
 
       $forbidden = parent::getForbiddenStandardMassiveAction();
@@ -2357,8 +2240,6 @@ class PluginOrderOrder extends CommonDBTM {
     * @see CommonDBTM::showMassiveActionsSubForm()
     **/
    static function showMassiveActionsSubForm(MassiveAction $ma) {
-      global $UNINSTALL_TYPES;
-
       switch ($ma->getAction()) {
          case 'transfert':
             Entity::dropdown();
@@ -2392,8 +2273,6 @@ class PluginOrderOrder extends CommonDBTM {
     * @see CommonDBTM::processMassiveActionsForOneItemtype()
     **/
    static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids) {
-      global $CFG_GLPI;
-
       switch ($ma->getAction()) {
          case "transfert":
             $input = $ma->getInput();
@@ -2607,7 +2486,6 @@ class PluginOrderOrder extends CommonDBTM {
             ];
             foreach (getAllDataFromTable("glpi_plugin_order_budgets") as $data) {
                $tmp    = [];
-               $id     = false;
                foreach ($matchings as $old => $new) {
                   if (!is_null($data[$old])) {
                      $tmp[$new] = $data[$old];
@@ -2619,11 +2497,10 @@ class PluginOrderOrder extends CommonDBTM {
                //Budget already exists in the core: update it
                if ($budget->getFromDB($data['budgets_id'])) {
                   $budget->update($tmp);
-                  $id = $tmp['id'];
                } else {
                   //Budget doesn't exists in the core: create it
                   unset($tmp['id']);
-                  $id = $budget->add($tmp);
+                  $budget->add($tmp);
                }
             }
 

programming_language: PHP
filename: order_item.class.php
change_type: ModificationType.MODIFY
diff: @@ -294,17 +294,6 @@ class PluginOrderOrder_Item extends CommonDBRelation {
    }
 
 
-   public function checkIFReferenceExistsInOrder($orders_id, $ref_id) {
-      return (countElementsInTable(
-         $this->getTable(),
-         [
-            'plugin_order_orders_id' => $orders_id,
-            'plugin_order_references_id' => $ref_id,
-         ]
-      ));
-   }
-
-
    public function addDetails($ref_id, $itemtype, $orders_id, $quantity, $price, $discounted_price, $taxes_id, $analytic_nature_id) {
 
       $order = new PluginOrderOrder();
@@ -1052,7 +1041,6 @@ class PluginOrderOrder_Item extends CommonDBRelation {
          $query .= " ORDER BY `$table_ref`.`name` ";
 
          $result = $DB->query($query);
-         $num    = $DB->numrows($result);
 
          // Initialize for detail_hideForm javascript function
          $hideForm = "";
@@ -1231,18 +1219,6 @@ class PluginOrderOrder_Item extends CommonDBRelation {
    }
 
 
-   public function getTotalQuantityByRef($orders_id, $references_id) {
-      global $DB;
-
-      $query = "SELECT COUNT(*) AS quantity
-                FROM `".self::getTable()."`
-                WHERE `plugin_order_orders_id` = '$orders_id'
-                   AND `plugin_order_references_id` = '$references_id' ";
-      $result = $DB->query($query);
-      return ($DB->result($result, 0, 'quantity'));
-   }
-
-
    public function getDeliveredQuantity($orders_id, $references_id, $price_taxfree, $discount) {
       return countElementsInTable(
          self::getTable(),
@@ -1718,8 +1694,6 @@ class PluginOrderOrder_Item extends CommonDBRelation {
    }
 
    public function updateAnalyticNature($post) {
-      global $DB;
-
       $this->getFromDB($post['item_id']);
 
       $input = $this->fields;
@@ -1728,8 +1702,6 @@ class PluginOrderOrder_Item extends CommonDBRelation {
    }
 
    public function updatePrice_taxfree($post) {
-      global $DB;
-
       $this->getFromDB($post['item_id']);
 
       $input = $this->fields;
@@ -1862,7 +1834,7 @@ class PluginOrderOrder_Item extends CommonDBRelation {
             $query  = "UPDATE `glpi_plugin_order_orders_items`
                        SET `plugin_order_ordertaxes_id` = '".$data["plugin_order_ordertaxes_id"]."'
                        WHERE `plugin_order_orders_id` = '".$data["id"]."'";
-            $result = $DB->query($query) or die($DB->error());
+            $DB->query($query) or die($DB->error());
          }
           //1.5.0
          $migration->addField($table, "entities_id", "INT {$default_key_sign} NOT NULL DEFAULT '0'");

programming_language: PHP
filename: order_supplier.class.php
change_type: ModificationType.MODIFY
diff: @@ -278,20 +278,6 @@ class PluginOrderOrder_Supplier extends CommonDBChild {
    }
 
 
-   public function checkIfSupplierInfosExists($plugin_order_orders_id) {
-
-      if ($plugin_order_orders_id) {
-         $devices = getAllDataFromTable(self::getTable(),
-                                         ['plugin_order_orders_id' => $plugin_order_orders_id]);
-         if (!empty($devices)) {
-            return true;
-         } else {
-            return false;
-         }
-      }
-   }
-
-
    public static function showDeliveries($suppliers_id) {
       global $DB;
 

programming_language: PHP
filename: orderinjection.class.php
change_type: ModificationType.MODIFY
diff: @@ -61,15 +61,6 @@ class PluginOrderOrderInjection extends PluginOrderOrder implements PluginDatain
       return [];
    }
 
-
-   /**
-    * Standard method to add an object into glpi
-    *
-    * @param values fields to add into glpi
-    * @param options options used during creation
-    * @return an array of IDs of newly created objects : for example array(Computer=>1, Networkport=>10)
-    *
-   **/
    public function addOrUpdateObject($values = [], $options = []) {
       $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options);
       $lib->processAddOrUpdate();

programming_language: PHP
filename: preference.class.php
change_type: ModificationType.MODIFY
diff: @@ -85,7 +85,7 @@ class PluginOrderPreference extends CommonDBTM {
     *
     * Display a dropdown of all ODT template files available
     * @since 1.5.3
-    * @param $value default value
+    * @param $value
     */
    public static function dropdownFileTemplates($value = '') {
       return self::dropdownListFiles('template', PLUGIN_ORDER_TEMPLATE_EXTENSION,
@@ -97,7 +97,7 @@ class PluginOrderPreference extends CommonDBTM {
     *
     * Display a dropdown of all PNG signatures files available
     * @since 1.5.3
-    * @param $value default value
+    * @param $value
     */
    public static function dropdownFileSignatures($value = '', $empy_value = true) {
       return self::dropdownListFiles('sign', PLUGIN_ORDER_SIGNATURE_EXTENSION,
@@ -110,9 +110,9 @@ class PluginOrderPreference extends CommonDBTM {
     * Display a dropdown which contains all files of a certain type in a directory
     * @since 1.5.3
     * @param $name dropdown name
-    * @param $extension list files of this extension only
+    * @param array $extension list files of this extension only
     * @param $directory directory in which to look for files
-    * @param $value default value
+    * @param $value
     */
    public static function dropdownListFiles($name, $extension, $directory, $value = '') {
       $files  = self::getFiles($directory, $extension);
@@ -187,7 +187,6 @@ class PluginOrderPreference extends CommonDBTM {
 
 
    public static function getFiles($directory, $ext) {
-      $array_dir  = [];
       $array_file = [];
 
       if (is_dir($directory)) {
@@ -210,9 +209,6 @@ class PluginOrderPreference extends CommonDBTM {
                      } else {
                         $array_file[] = [$filename, $filedate, $extension];
                      }
-
-                  } else if ($filetype == "dir") {
-                     $array_dir[] = $filename;
                   }
                }
             }

programming_language: PHP
filename: reception.class.php
change_type: ModificationType.MODIFY
diff: @@ -126,7 +126,7 @@ class PluginOrderReception extends CommonDBChild {
 
       if ($detail->fields["itemtype"] == 'SoftwareLicense') {
 
-         $result = $PluginOrderOrder_Item->queryRef($_POST["plugin_order_orders_id"],
+         $result = $detail->queryRef($_POST["plugin_order_orders_id"],
                                                     $detail->fields["plugin_order_references_id"],
                                                     $detail->fields["price_taxfree"],
                                                     $detail->fields["discount"],
@@ -544,7 +544,6 @@ class PluginOrderReception extends CommonDBChild {
 
 
    function getSpecificMassiveActions($checkitem = null) {
-      $isadmin = static::canUpdate();
       $actions = parent::getSpecificMassiveActions($checkitem);
 
       //remove native transfer action
@@ -665,29 +664,6 @@ class PluginOrderReception extends CommonDBChild {
       }
    }
 
-
-   public function dropdownReceptionActions($itemtype, $plugin_order_references_id, $plugin_order_orders_id) {
-      global $CFG_GLPI;
-
-      $rand = mt_rand();
-
-      echo "<select name='receptionActions$rand' id='receptionActions$rand'>";
-      echo "<option value='0' selected>".Dropdown::EMPTY_VALUE."</option>";
-      echo "<option value='reception'>".__("Take item delivery", "order")."</option>";
-      echo "</select>";
-      $params = [
-         'action'                     => '__VALUE__',
-         'itemtype'                   => $itemtype,
-         'plugin_order_references_id' => $plugin_order_references_id,
-         'plugin_order_orders_id'     => $plugin_order_orders_id,
-      ];
-      Ajax::updateItemOnSelectEvent("receptionActions$rand", "show_receptionActions$rand",
-                                    Plugin::getWebDir('order')."/ajax/receptionactions.php",
-                                    $params);
-      echo "<span id='show_receptionActions$rand'>&nbsp;</span>";
-   }
-
-
    public function getReceptionStatus($ID) {
       $detail = new PluginOrderOrder_Item();
       $detail->getFromDB($ID);
@@ -964,7 +940,7 @@ class PluginOrderReception extends CommonDBChild {
    *
    * @param $options
    *
-   * return nothing
+   * @return void
    */
    public static function generateAsset($options = []) {
       // No asset should be generated for PluginOrderOther and PluginOrderReferenceFree items.

programming_language: PHP
filename: reference.class.php
change_type: ModificationType.MODIFY
diff: @@ -279,7 +279,7 @@ class PluginOrderReference extends CommonDBTM {
          case 'itemtype':
             $types    = PluginOrderOrder_Item::getClasses();
             $itemtype = [];
-            foreach ($types as $key => $type) {
+            foreach ($types as $type) {
                $item            = new $type();
                $itemtype[$type] = $item->getTypeName();
             }
@@ -850,101 +850,6 @@ class PluginOrderReference extends CommonDBTM {
       return true;
    }
 
-
-   /**
-    * Display entities of the loaded profile
-    *
-   * @param $myname select name
-    * @param $target target for entity change action
-    */
-   public static function showSelector($target) {
-      $rand = mt_rand();
-      Plugin::loadLang('order');
-      echo "<div class='center' ><span class='b'>".__("Select the wanted item type", "order")
-        ."</span><br>";
-      echo "<a style='font-size:14px;' href='".$target."?reset=reset' title=\""
-        .__("Show all")."\">".str_replace(" ", "&nbsp;", __("Show all"))."</a></div>";
-
-      echo "<div class='left' style='width:100%'>";
-
-      echo "<script type='javascript'>";
-      echo "var Tree_Category_Loader$rand = new Ext.tree.TreeLoader({
-         dataUrl:'".Plugin::getWebDir('order')."/ajax/referencetreetypes.php'
-      });";
-
-      echo "var Tree_Category$rand = new Ext.tree.TreePanel({
-         collapsible      : false,
-         animCollapse     : false,
-         border           : false,
-         id               : 'tree_projectcategory$rand',
-         el               : 'tree_projectcategory$rand',
-         autoScroll       : true,
-         animate          : false,
-         enableDD         : true,
-         containerScroll  : true,
-         height           : 320,
-         width            : 770,
-         loader           : Tree_Category_Loader$rand,
-         rootVisible     : false
-      });";
-
-      // SET the root node.
-      echo "var Tree_Category_Root$rand = new Ext.tree.AsyncTreeNode({
-         text     : '',
-         draggable   : false,
-         id    : '-1'                  // this IS the id of the startnode
-      });
-      Tree_Category$rand.setRootNode(Tree_Category_Root$rand);";
-
-      // Render the tree.
-      echo "Tree_Category$rand.render();
-            Tree_Category_Root$rand.expand();";
-
-      echo "</script>";
-
-      echo "<div id='tree_projectcategory$rand' ></div>";
-      echo "</div>";
-   }
-
-
-   public function title() {
-      echo "<div align='center'>";
-      echo self::getPerTypeJavascriptCode();
-      echo "<a onclick='order_window.show();' href='#modal_reference_content' title='"
-           .__("View by item type", "order")."'>"
-           .__("View by item type", "order")."</a>";
-      echo "</div>";
-
-   }
-
-
-   public static function getPerTypeJavascriptCode() {
-      global $CFG_GLPI;
-
-      $out  = "<script type='text/javascript'>";
-      $out .= "cleanhide('modal_reference_content');";
-      $out .= "var order_window=new Ext.Window({
-         layout:'fit',
-         width:800,
-         height:400,
-         closeAction:'hide',
-         modal: true,
-         autoScroll: true,
-         title: \"".__("View by item type", "order")."\",
-         autoLoad: '".Plugin::getWebDir('order')."/ajax/referencetree.php'
-      });";
-      $out .= "</script>";
-      return $out;
-   }
-
-
-   /**
-    * Get the standard massive actions which are forbidden
-    *
-    * @since version 0.84
-    *
-    * @return an array of massive actions
-    **/
    public function getForbiddenStandardMassiveAction() {
 
       $forbidden = parent::getForbiddenStandardMassiveAction();
@@ -1028,17 +933,6 @@ class PluginOrderReference extends CommonDBTM {
       return;
    }
 
-
-   /*   function getValueToSelect($field_id_or_search_options, $name = '', $values = '', $options = []) {
-      if (isset($field_id_or_search_options['displaytype'])
-         && $field_id_or_search_options['displaytype'] == 'reference_type') {
-            Toolbox::logDebug($field_id_or_search_options['displaytype'],
-                              $field_id_or_search_options, $name, $values, $options);
-
-      }
-      return false;
-   }*/
-
    public static function install(Migration $migration) {
       global $DB;
 

programming_language: PHP
filename: reference_supplier.class.php
change_type: ModificationType.MODIFY
diff: @@ -247,7 +247,7 @@ class PluginOrderReference_Supplier extends CommonDBChild {
 
 
    public function showReferenceManufacturers($ID) {
-      global $DB, $CFG_GLPI;
+      global $DB;
 
       $ref = new PluginOrderReference();
       $ref->getFromDB($ID);
@@ -331,24 +331,6 @@ class PluginOrderReference_Supplier extends CommonDBChild {
    }
 
 
-   public function getPriceByReferenceAndSupplier($plugin_order_references_id, $suppliers_id) {
-      global $DB;
-
-      $table = self::getTable();
-      $query = "SELECT `price_taxfree`
-                FROM `$table`
-                WHERE `plugin_order_references_id` = '$plugin_order_references_id'
-                AND `suppliers_id` = '$suppliers_id' ";
-      $result = $DB->query($query);
-
-      if ($DB->numrows($result) > 0) {
-         return $DB->result($result, 0, "price_taxfree");
-      } else {
-         return 0;
-      }
-   }
-
-
    public function getReferenceCodeByReferenceAndSupplier($plugin_order_references_id, $suppliers_id) {
       global $DB;
 

programming_language: PHP
filename: referencefree.class.php
change_type: ModificationType.MODIFY
diff: @@ -40,27 +40,6 @@ class PluginOrderReferenceFree extends CommonDBTM {
       return __("Reference free", "order");
    }
 
-   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_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 static function install(Migration $migration) {
       global $DB;
 

programming_language: PHP
filename: referenceinjection.class.php
change_type: ModificationType.MODIFY
diff: @@ -63,14 +63,6 @@ class PluginOrderReferenceInjection extends PluginOrderReference
    }
 
 
-   /**
-    * Standard method to add an object into glpi
-    *
-    * @param values fields to add into glpi
-    * @param options options used during creation
-    * @return an array of IDs of newly created objects : for example [Computer => 1, Networkport => 10]
-    *
-   **/
    public function addOrUpdateObject($values = [], $options = []) {
       $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options);
       $lib->processAddOrUpdate();

programming_language: PHP
filename: setup.php
change_type: ModificationType.MODIFY
diff: @@ -194,7 +194,6 @@ function plugin_version_order() {
          'glpi' => [
             'min' => PLUGIN_ORDER_MIN_GLPI,
             'max' => PLUGIN_ORDER_MAX_GLPI,
-            'dev' => true, //Required to allow 9.2-dev
          ]
       ]
    ];

programming_language: PHP