diff --git a/ajax/detail.php b/ajax/detail.php
deleted file mode 100644
index fcc962e52c..0000000000
--- a/ajax/detail.php
+++ /dev/null
@@ -1,69 +0,0 @@
-.
- * -------------------------------------------------------------------------
- * @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);
-}
diff --git a/ajax/dropdownContact.php b/ajax/dropdownContact.php
deleted file mode 100644
index b6f6a2f0e9..0000000000
--- a/ajax/dropdownContact.php
+++ /dev/null
@@ -1,101 +0,0 @@
-.
- * -------------------------------------------------------------------------
- * @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 "";
diff --git a/ajax/referencedetail.php b/ajax/referencedetail.php
deleted file mode 100644
index 0b34226124..0000000000
--- a/ajax/referencedetail.php
+++ /dev/null
@@ -1,77 +0,0 @@
-.
- * -------------------------------------------------------------------------
- * @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 "";
- break;
- case 'priceht':
- echo "";
- break;
- case 'pricediscounted':
- echo "";
- 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 "";
- break;
- }
-} else {
- return "";
-}
diff --git a/ajax/referencespecifications.php b/ajax/referencespecifications.php
index c303d62616..3e529288df 100644
--- a/ajax/referencespecifications.php
+++ b/ajax/referencespecifications.php
@@ -45,11 +45,6 @@
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"]);
}
diff --git a/ajax/referencetree.php b/ajax/referencetree.php
deleted file mode 100644
index 26577e9407..0000000000
--- a/ajax/referencetree.php
+++ /dev/null
@@ -1,47 +0,0 @@
-.
- * -------------------------------------------------------------------------
- * @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();
diff --git a/ajax/referencetreetypes.php b/ajax/referencetreetypes.php
deleted file mode 100644
index 083809ebfc..0000000000
--- a/ajax/referencetreetypes.php
+++ /dev/null
@@ -1,91 +0,0 @@
-.
- * -------------------------------------------------------------------------
- * @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);
-}
diff --git a/front/bill.form.php b/front/bill.form.php
index 68c1a96cfb..116fe758f0 100644
--- a/front/bill.form.php
+++ b/front/bill.form.php
@@ -83,7 +83,6 @@
PluginOrderOrder::updateBillState($order_item->fields['plugin_order_orders_id']);
Html::back();
}
-$dropdown = new PluginOrderBill();
Session::checkRight("plugin_order_bill", READ);
diff --git a/front/menu.php b/front/menu.php
index bbcad13242..a35e5e8384 100644
--- a/front/menu.php
+++ b/front/menu.php
@@ -37,10 +37,6 @@
"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'));
diff --git a/front/order.form.php b/front/order.form.php
index b65ec7b012..d4db8cfb00 100644
--- a/front/order.form.php
+++ b/front/order.form.php
@@ -40,7 +40,6 @@
$pluginOrderOrder = new PluginOrderOrder();
$config = new PluginOrderConfig();
$pluginOrderOrder_Item = new PluginOrderOrder_Item();
-$pluginOrderOrder_Supplier = new PluginOrderOrder_Supplier();
/* add order */
if (isset ($_POST["add"])) {
diff --git a/front/order.php b/front/order.php
index 9b56d07da4..3a3e8ebffa 100644
--- a/front/order.php
+++ b/front/order.php
@@ -38,8 +38,6 @@
"order"
);
-$order = new PluginOrderOrder();
-
if (PluginOrderOrder::canView() || Session::haveRight("config", UPDATE)) {
Search::show("PluginOrderOrder");
} else {
diff --git a/front/reference.php b/front/reference.php
index 3813d97441..39d429cd5d 100644
--- a/front/reference.php
+++ b/front/reference.php
@@ -38,8 +38,6 @@
"references"
);
-$reference = new PluginOrderReference();
-
if (PluginOrderReference::canView()) {
Search::show("PluginOrderReference");
} else {
diff --git a/front/reference_supplier.form.php b/front/reference_supplier.form.php
index bcbcd09abc..d2b0033a1f 100644
--- a/front/reference_supplier.form.php
+++ b/front/reference_supplier.form.php
@@ -45,7 +45,7 @@
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']);
diff --git a/front/surveysupplier.form.php b/front/surveysupplier.form.php
index af1aec44bf..475b323fc2 100644
--- a/front/surveysupplier.form.php
+++ b/front/surveysupplier.form.php
@@ -45,7 +45,7 @@
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']);
diff --git a/hook.php b/hook.php
index 9ec8fc42e7..52c646a97f 100644
--- a/hook.php
+++ b/hook.php
@@ -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"];
diff --git a/inc/bill.class.php b/inc/bill.class.php
index f0c992c5e1..f64204a313 100644
--- a/inc/bill.class.php
+++ b/inc/bill.class.php
@@ -276,27 +276,14 @@ public static function showItems(PluginOrderBill $bill) {
echo "
".__("Status")." | ";
echo "";
- $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 "";
- $ID = "";
- if ($_SESSION["glpiis_ids_visible"]
- || empty($data["name"])) {
- $ID = " (".$data["id"].")";
- }
- $name = NOT_AVAILABLE;
- if ($item->getFromDB($data["id"])) {
- $name = $item->getLink();
- }
-
echo "".$item->getTypeName()." | ";
echo "";
echo Dropdown::getDropdownName('glpi_entities', $item->getEntityID())." | ";
diff --git a/inc/config.class.php b/inc/config.class.php
index 3d54bd78e5..9c823696a9 100644
--- a/inc/config.class.php
+++ b/inc/config.class.php
@@ -79,8 +79,6 @@ public static function getTypeName($nb = 0) {
public static function getMenuContent() {
- global $CFG_GLPI;
-
$menu = parent::getMenuContent();
$menu['page'] = PluginOrderMenu::getSearchURL(false);
$menu['links']['add'] = null;
@@ -768,7 +766,7 @@ public static function install(Migration $migration) {
//version 2.0.1
$migration->addField($table, "use_free_reference", "bool");
-
+
}
$migration->displayMessage("Add default order state workflow");
diff --git a/inc/link.class.php b/inc/link.class.php
index e4b9de50d8..4b16b9c98a 100644
--- a/inc/link.class.php
+++ b/inc/link.class.php
@@ -116,7 +116,6 @@ public function showItemGenerationForm($params) {
$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 @@ public function showItemGenerationForm($params) {
$immo_number = $item->fields["immo_number"] ?? "";
} else {
$name = false;
- $serial = false;
$otherserial = false;
$states_id = false;
$locations_id = false;
@@ -147,7 +145,7 @@ public function showItemGenerationForm($params) {
} else {
echo " | ";
}
-
+
if ($config->canAddImmobilizationNumber()) {
if ($immo_number) {
echo "".Dropdown::EMPTY_VALUE." | ";
@@ -519,7 +517,6 @@ function getForbiddenStandardMassiveAction() {
function getSpecificMassiveActions($checkitem = null) {
- $isadmin = static::canUpdate();
$actions = parent::getSpecificMassiveActions($checkitem);
$sep = __CLASS__.MassiveAction::CLASS_ACTION_SEPARATOR;
@@ -637,91 +634,6 @@ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBT
}
- 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 .= "".__("Entity").": ";
- $comments .= Dropdown::getDropdownName("glpi_entities", $ct->fields["entities_id"]);
- $comments .= '
'.__("Consumable").' : #'.$items_id;
- $comments .= '
'.__("Consumable type").' : ';
- $comments .= $ct->fields['name'];
- $comments .= '
'.__("Manufacturer").' : ';
- $comments .= Dropdown::getDropdownName('glpi_manufacturers', $ct->fields['manufacturers_id']);
- $comments .= '
'.__("State").' : ';
- $comments .= (!$ci->fields['users_id'] ? __("In stock") : __("Used"));
- if ($ci->fields['users_id']) {
- $comments .= '
'.__("User").' : ';
- $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 .= "".__("Entity").": ";
- $comments .= Dropdown::getDropdownName("glpi_entities", $ct->fields["entities_id"]);
- $comments .= '
'.__("Cartridge").' : #'.$items_id;
- $comments .= '
'._n("New", "New", 2).' : ';
- $comments .= $ct->fields['name'];
- $comments .= '
'.__("Manufacturer").' : ';
- $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 .= "".__("Name").": ";
- $comments .= $item->getField("name");
- }
-
- if ($item->getField("entities_id")) {
- $comments .= "".__("Entity").": ";
- $comments .= Dropdown::getDropdownName("glpi_entities", $item->getField("entities_id"));
- }
-
- if ($item->getField("serial") != '') {
- $comments .= "
".__("Serial number").": ";
- $comments .= $item->getField("serial");
- }
-
- if ($item->getField("otherserial") != '') {
- $comments .= "
".__("Inventory number").": ";
- $comments .= $item->getField("otherserial");
- }
- if ($item->getField("locations_id")) {
- $comments .= "
".__("Location").": ";
- $comments .= Dropdown::getDropdownName('glpi_locations', $item->getField("locations_id"));
- }
-
- if ($item->getField("users_id")) {
- $comments .= "
".__("User").": ";
- $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 @@ public function getReceptionItemName($items_id, $itemtype) {
}
}
-
- /*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 " ";
- }*/
-
public function itemAlreadyLinkedToAnOrder($itemtype, $items_id, $plugin_order_orders_id,
$detailID = 0) {
global $DB;
@@ -1067,7 +950,7 @@ public function deleteLinkWithItem($detailID, $itemtype, $plugin_order_orders_id
$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 @@ public function generateNewItem($params) {
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 @@ public function generateNewItem($params) {
$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 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $
/**
* 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;
diff --git a/inc/order.class.php b/inc/order.class.php
index fe044eacf6..923fcb17a3 100644
--- a/inc/order.class.php
+++ b/inc/order.class.php
@@ -1363,103 +1363,6 @@ public function showForm ($ID, $options = []) {
}
- 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 "";
- 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 "";
- }
-
-
public function addStatusLog($orders_id, $status, $comments = '') {
$changes = Dropdown::getDropdownName("glpi_plugin_order_orderstates", $status);
@@ -1530,15 +1433,6 @@ public function addHistory($type, $old_value, $new_value, $ID) {
}
- 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 @@ public function deleteAllLinkWithItem($orders_id) {
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 @@ public function generateOrder($params) {
$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 @@ public function generateOrder($params) {
}
$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 @@ public function transfer($ID, $entity) {
$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 @@ public static function cronComputeLateOrders($task) {
}
$task->addVolume($nblate);
- $cron_status = 1;
if ($CFG_GLPI["use_notifications"]) {
$message = __("Order is late", "order");
$alert = new Alert();
@@ -2336,13 +2226,6 @@ public static function addDocumentCategory(Document $document) {
}
- /**
- * 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 @@ public function getForbiddenStandardMassiveAction() {
* @see CommonDBTM::showMassiveActionsSubForm()
**/
static function showMassiveActionsSubForm(MassiveAction $ma) {
- global $UNINSTALL_TYPES;
-
switch ($ma->getAction()) {
case 'transfert':
Entity::dropdown();
@@ -2392,8 +2273,6 @@ function getSpecificMassiveActions($checkitem = null) {
* @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 @@ public static function install(Migration $migration) {
];
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 @@ public static function install(Migration $migration) {
//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);
}
}
diff --git a/inc/order_item.class.php b/inc/order_item.class.php
index 601f85837d..cf476fd7a1 100644
--- a/inc/order_item.class.php
+++ b/inc/order_item.class.php
@@ -294,17 +294,6 @@ public function getPricesATI($priceHT, $taxes) {
}
- 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 @@ public function getItems($rand, $data_ref, $plugin_order_orders_id, $numref, $ca
$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 @@ public function getTotalQuantityByRefAndDiscount($orders_id, $references_id, $pr
}
- 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 @@ public function updateQuantity($post) {
}
public function updateAnalyticNature($post) {
- global $DB;
-
$this->getFromDB($post['item_id']);
$input = $this->fields;
@@ -1728,8 +1702,6 @@ public function updateAnalyticNature($post) {
}
public function updatePrice_taxfree($post) {
- global $DB;
-
$this->getFromDB($post['item_id']);
$input = $this->fields;
@@ -1862,7 +1834,7 @@ public static function install(Migration $migration) {
$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'");
diff --git a/inc/order_supplier.class.php b/inc/order_supplier.class.php
index 02a3e08373..51bbf1561c 100644
--- a/inc/order_supplier.class.php
+++ b/inc/order_supplier.class.php
@@ -278,20 +278,6 @@ public static function showOrderSupplierInfos($ID) {
}
- 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;
diff --git a/inc/orderinjection.class.php b/inc/orderinjection.class.php
index fc47bba6b4..7af003e1c0 100644
--- a/inc/orderinjection.class.php
+++ b/inc/orderinjection.class.php
@@ -61,15 +61,6 @@ public function connectedTo() {
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();
diff --git a/inc/preference.class.php b/inc/preference.class.php
index 7845446382..94cf302550 100644
--- a/inc/preference.class.php
+++ b/inc/preference.class.php
@@ -85,7 +85,7 @@ public static function checkPreferenceTemplateValue($users_id) {
*
* 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 @@ public static function dropdownFileTemplates($value = '') {
*
* 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 @@ public static function dropdownFileSignatures($value = '', $empy_value = true) {
* 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 @@ public function showForm($ID, array $options = []) {
public static function getFiles($directory, $ext) {
- $array_dir = [];
$array_file = [];
if (is_dir($directory)) {
@@ -210,9 +209,6 @@ public static function getFiles($directory, $ext) {
} else {
$array_file[] = [$filename, $filedate, $extension];
}
-
- } else if ($filetype == "dir") {
- $array_dir[] = $filename;
}
}
}
diff --git a/inc/reception.class.php b/inc/reception.class.php
index 321fd263da..c312e9d2aa 100644
--- a/inc/reception.class.php
+++ b/inc/reception.class.php
@@ -126,7 +126,7 @@ public function deleteDelivery($detailID) {
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 @@ function getForbiddenStandardMassiveAction() {
function getSpecificMassiveActions($checkitem = null) {
- $isadmin = static::canUpdate();
$actions = parent::getSpecificMassiveActions($checkitem);
//remove native transfer action
@@ -665,29 +664,6 @@ public function showReceptionForm($params = []) {
}
}
-
- public function dropdownReceptionActions($itemtype, $plugin_order_references_id, $plugin_order_orders_id) {
- global $CFG_GLPI;
-
- $rand = mt_rand();
-
- echo "";
- $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 " ";
- }
-
-
public function getReceptionStatus($ID) {
$detail = new PluginOrderOrder_Item();
$detail->getFromDB($ID);
@@ -964,7 +940,7 @@ public function post_purgeItem() {
*
* @param $options
*
- * return nothing
+ * @return void
*/
public static function generateAsset($options = []) {
// No asset should be generated for PluginOrderOther and PluginOrderReferenceFree items.
diff --git a/inc/reference.class.php b/inc/reference.class.php
index 3a5c67d4c4..260e34d3c0 100644
--- a/inc/reference.class.php
+++ b/inc/reference.class.php
@@ -279,7 +279,7 @@ static function getSpecificValueToSelect($field, $name = '', $values = '', array
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 @@ public function copy($ID) {
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 "";
-
- echo "";
-
- echo "";
-
- echo "
";
- echo "
";
- }
-
-
- public function title() {
- echo "";
-
- }
-
-
- public static function getPerTypeJavascriptCode() {
- global $CFG_GLPI;
-
- $out = "";
- 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 @@ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBT
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;
diff --git a/inc/reference_supplier.class.php b/inc/reference_supplier.class.php
index 038dc89212..bd2999485b 100644
--- a/inc/reference_supplier.class.php
+++ b/inc/reference_supplier.class.php
@@ -247,7 +247,7 @@ public function showForm ($ID, $options = []) {
public function showReferenceManufacturers($ID) {
- global $DB, $CFG_GLPI;
+ global $DB;
$ref = new PluginOrderReference();
$ref->getFromDB($ID);
@@ -331,24 +331,6 @@ public function showReferenceManufacturers($ID) {
}
- 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;
diff --git a/inc/referencefree.class.php b/inc/referencefree.class.php
index f9fb643bd3..8a8c57e0a0 100644
--- a/inc/referencefree.class.php
+++ b/inc/referencefree.class.php
@@ -40,27 +40,6 @@ public static function getTypeName($nb = 0) {
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;
diff --git a/inc/referenceinjection.class.php b/inc/referenceinjection.class.php
index 9e1fdaba89..f0b965f7e5 100644
--- a/inc/referenceinjection.class.php
+++ b/inc/referenceinjection.class.php
@@ -63,14 +63,6 @@ public function connectedTo() {
}
- /**
- * 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();
diff --git a/setup.php b/setup.php
index de2b60329a..bce025c857 100644
--- a/setup.php
+++ b/setup.php
@@ -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
]
]
];