static function getMenuContent() { global $CFG_GLPI; $menu = array(); $menu['title'] = self::getTypeName(2); $menu['page'] = self::getSearchURL(false); if (PluginOrderConfig::canView()) { $menu['links']['config'] = PluginOrderConfig::getFormURL(false); } if (PluginOrderOrder::canView()) { $menu['options']['order']['title'] = PluginOrderOrder::getTypeName(2); $menu['options']['order']['page'] = PluginOrderOrder::getSearchURL(false); $menu['options']['order']['links']['add'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=1"; if (PluginOrderOrder::canCreate()) { $menu['options']['order']['links']['search'] = PluginOrderOrder::getSearchURL(false); } $menu['options']['order']['links']['template'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=0"; if (PluginOrderConfig::canView()) { $menu['options']['order']['links']['config'] = PluginOrderConfig::getFormURL(false); } } if (PluginOrderBill::canView()) { $menu['options']['bill']['title'] = PluginOrderBill::getTypeName(2); $menu['options']['bill']['page'] = PluginOrderBill::getSearchURL(false); $menu['options']['bill']['links']['search'] = PluginOrderBill::getSearchURL(false); if (PluginOrderBill::canCreate()) { $menu['options']['bill']['links']['add'] = PluginOrderBill::getFormURL(false); } if (PluginOrderConfig::canView()) { $menu['options']['bill']['links']['config'] = PluginOrderConfig::getFormURL(false); } } if (PluginOrderReference::canView()) { $menu['options']['references']['title'] = PluginOrderReference::getTypeName(2); $menu['options']['references']['page'] = PluginOrderReference::getSearchURL(false); $menu['options']['references']['links']['search'] = PluginOrderReference::getSearchURL(false); if (PluginOrderReference::canCreate()) { $menu['options']['references']['links']['add'] = PluginOrderReference::getFormURL(false); } if (PluginOrderConfig::canView()) { $menu['options']['references']['links']['config'] = PluginOrderConfig::getFormURL(false); } } return $menu; }
function plugin_init_order() { global $PLUGIN_HOOKS, $CFG_GLPI, $ORDER_TYPES; Plugin::registerClass('PluginOrderProfile'); $PLUGIN_HOOKS['csrf_compliant']['order'] = true; /* Init current profile */ $PLUGIN_HOOKS['change_profile']['order'] = array('PluginOrderProfile', 'initProfile'); $plugin = new Plugin(); if ($plugin->isActivated('order')) { $PLUGIN_HOOKS['migratetypes']['order'] = 'plugin_order_migratetypes'; $PLUGIN_HOOKS['assign_to_ticket']['order'] = true; //Itemtypes in use for an order $ORDER_TYPES = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Printer', 'Phone', 'ConsumableItem', 'CartridgeItem', 'Contract', 'PluginOrderOther', 'SoftwareLicense'); $PLUGIN_HOOKS['pre_item_purge']['order'] = array('Profile' => array('PluginOrderProfile', 'purgeProfiles'), 'DocumentCategory' => array('PluginOrderDocumentCategory', 'purgeItem')); $PLUGIN_HOOKS['pre_item_update']['order'] = array('Infocom' => array('PluginOrderOrder_Item', 'updateItem'), 'Contract' => array('PluginOrderOrder_Item', 'updateItem')); $PLUGIN_HOOKS['item_add']['order'] = array('Document' => array('PluginOrderOrder', 'addDocumentCategory')); include_once GLPI_ROOT . "/plugins/order/inc/order_item.class.php"; foreach (PluginOrderOrder_Item::getClasses(true) as $type) { $PLUGIN_HOOKS['item_purge']['order'][$type] = 'plugin_item_purge_order'; } Plugin::registerClass('PluginOrderOrder', array('document_types' => true, 'unicity_types' => true, 'notificationtemplates_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'contract_types' => true, 'linkuser_types' => true, 'addtabon' => array('Budget'))); Plugin::registerClass('PluginOrderReference', array('document_types' => true)); Plugin::registerClass('PluginOrderProfile', array('addtabon' => array('Profile'))); Plugin::registerClass('PluginOrderOrder_Item', array('notificationtemplates_types' => true, 'addtabon' => PluginOrderOrder_Item::getClasses(true))); if (PluginOrderOrder::canView()) { Plugin::registerClass('PluginOrderDocumentCategory', array('addtabon' => array('DocumentCategory'))); Plugin::registerClass('PluginOrderOrder_Supplier', array('addtabon' => array('Supplier'))); Plugin::registerClass('PluginOrderPreference', array('addtabon' => array('Preference'))); } /*if glpi is loaded */ if (Session::getLoginUserID()) { /* link to the config page in plugins menu */ if (Session::haveRight("config", UPDATE)) { $PLUGIN_HOOKS['config_page']['order'] = 'front/config.form.php'; } if (PluginOrderOrder::canView() || PluginOrderReference::canView() || PluginOrderBill::canView()) { $PLUGIN_HOOKS['menu_toadd']['order']['management'] = 'PluginOrderMenu'; } $PLUGIN_HOOKS['assign_to_ticket']['order'] = true; $PLUGIN_HOOKS['use_massive_action']['order'] = 1; $PLUGIN_HOOKS['plugin_datainjection_populate']['order'] = "plugin_datainjection_populate_order"; } } }
public static function showItems(PluginOrderBill $bill) { global $DB; echo "<div class='spaced'><table class='tab_cadre_fixehov'>"; echo "<tr><th>"; Html::printPagerForm(); echo "</th><th colspan='5'>"; echo _n("Item", "Items", 2); echo "</th></tr>"; $bills_id = $bill->getID(); $table = getTableForItemType("PluginOrderOrder_Item"); $query = "SELECT * FROM `" . $table . "`"; $query .= " WHERE `plugin_order_bills_id` = '{$bills_id}'"; $query .= getEntitiesRestrictRequest(" AND", $table, "entities_id", $bill->getEntityID(), true); $query .= "GROUP BY `itemtype`"; $result = $DB->query($query); $number = $DB->numrows($result); if (!$number) { echo "</th><td>"; echo _n("Item", "Items", 2); echo "</td></tr>"; } else { echo "<tr>"; echo "<th>" . __("Type") . "</th>"; echo "<th>" . __("Entity") . "</th>"; echo "<th>" . __("Reference") . "</th>"; echo "<th>" . __("Status") . "</th>"; echo "</tr>"; $old_itemtype = ''; $num = 0; while ($data = $DB->fetch_array($result)) { if (!class_exists($data['itemtype'])) { continue; } $item = new $data['itemtype'](); if ($data['itemtype']::canView()) { 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>"; $reference = new PluginOrderReference(); $reference->getFromDB($data["plugin_order_references_id"]); echo "<td class='center'>"; if (PluginOrderReference::canView()) { echo $reference->getLink(); } else { echo $reference->getName(true); } echo "</td>"; echo "<td class='center'>"; Dropdown::getDropdownName("glpi_plugin_order_deliverystates", $data["plugin_order_deliverystates_id"]); echo "</td>"; echo "</tr>"; } } } echo "</table></div>"; }
public function showPluginFromItems($itemtype, $ID) { global $CFG_GLPI; $infos = $this->getOrderInfosByItem($itemtype, $ID); if ($infos) { echo "<div class='center'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr align='center'><th colspan='2'>" . __("Order informations", "order") . "</th></tr>"; echo "<tr align='center'><td class='tab_bg_2'>" . __("Order name", "order") . "</td>"; echo "<td class='tab_bg_2'>"; $order = new PluginOrderOrder(); $order->getFromDB($infos['id']); echo $order->getLink(PluginOrderOrder::canView()); $result = getAllDatasFromTable($this->getTable(), "`plugin_order_orders_id`='" . $infos['id'] . "'\n AND `itemtype`='{$itemtype}'\n AND `items_id`='{$ID}'"); if (!empty($result)) { $link = array_shift($result); $reference = new PluginOrderReference(); $reference->getFromDB($link['plugin_order_references_id']); if (Session::haveRight('plugin_order_reference', READ)) { echo "<tr align='center'><td class='tab_bg_2'>" . __("Reference") . "</td>"; echo "<td class='tab_bg_2'>" . $reference->getLink(PluginOrderReference::canView()) . "</td></tr>"; } echo "<tr align='center'><td class='tab_bg_2'>" . __("Delivery date") . "</td>"; echo "<td class='tab_bg_2'>" . Html::convDate($link["delivery_date"]) . "</td></tr>"; } echo "</table></div>"; } }
it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Order plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; along with Order. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package order @author the order plugin team @copyright Copyright (c) 2010-2011 Order plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/order @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; Html::header(PluginOrderReference::getTypeName(), '', "plugins", "order", "reference"); $reference = new PluginOrderReference(); if (PluginOrderReference::canView()) { Search::show("PluginOrderReference"); } else { echo "<div align='center'><br><br><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/warning.png\" alt=\"warning\"><br><br>"; echo "<b>" . __("Access denied") . "</b></div>"; } Html::footer();