Example #1
0
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()) {
            $PLUGIN_HOOKS['add_css']['order'][] = 'order.css';
            /* 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 function getSpecificFieldValue($itemtype, $searchOption, $field, &$values)
 {
     global $DB;
     $value = $values[$itemtype][$field];
     switch ($searchOption['displaytype']) {
         case "reference_itemtype":
             unset($values[$itemtype]['itemtype']);
             $classes = PluginOrderOrder_Item::getClasses();
             if (in_array($value, $classes)) {
                 $value[$itemtype]['itemtype'] = $value;
             } else {
                 foreach ($classes as $class) {
                     if (call_user_func(array($class, 'getTypeName')) == $value) {
                         $values[$itemtype]['itemtype'] = $class;
                         break;
                     }
                 }
             }
             break;
         case "reference_model":
         case "reference_type":
             if ($searchOption['displaytype'] == 'reference_model') {
                 $type_prefix = 'Model';
             } else {
                 $type_prefix = 'Type';
             }
             if (isset($values[$itemtype]['itemtype']) && class_exists($values[$itemtype]['itemtype'])) {
                 $itemtype_formodel = $values[$itemtype]['itemtype'] . $type_prefix;
                 if (class_exists($itemtype_formodel)) {
                     $values[$itemtype][$field] = Dropdown::getDropdownName(getTableForItemType($itemtype_formodel), $value);
                 }
             }
             break;
     }
     return $value;
 }
Example #3
0
$bill = new PluginOrderBill();
if (isset($_REQUEST['add'])) {
    $bill->add($_REQUEST);
    Html::back();
}
if (isset($_REQUEST['update'])) {
    $bill->update($_REQUEST);
    Html::back();
}
if (isset($_REQUEST['purge'])) {
    $bill->delete($_REQUEST);
    $bill->redirectToList();
}
if (isset($_POST['action'])) {
    // Retrieve configuration for generate assets feature
    $order_item = new PluginOrderOrder_Item();
    switch ($_POST['chooseAction']) {
        case 'bill':
        case 'state':
            if (isset($_POST["item"])) {
                foreach ($_POST["item"] as $key => $val) {
                    if ($val == 1) {
                        $tmp = $_POST;
                        $tmp['id'] = $key;
                        $order_item->update($tmp);
                        // Update infocom
                        $ic = new Infocom();
                        $ic->getFromDBforDevice($order_item->fields['itemtype'], $order_item->fields['items_id']);
                        $config = PluginOrderConfig::getConfig();
                        if ($config->canAddBillDetails()) {
                            if ($bill->getFromDB($_POST["plugin_order_bills_id"])) {
Example #4
0
 public function isOverBudget($ID)
 {
     global $DB;
     //Do not check if it's a template
     if ($this->fields['is_template']) {
         return PluginOrderOrder::ORDER_IS_UNDER_BUDGET;
     }
     // Compute all prices for BUDGET
     $table = $this->getTable();
     $query = "SELECT *\n                FROM `{$table}`\n                WHERE `budgets_id` = '{$this->fields['budgets_id']}'";
     // Get BUDGET
     $budget = new Budget();
     if (!$budget->getFromDB($this->fields['budgets_id'])) {
         return false;
     }
     Toolbox::logDebug($budget);
     if ($budget->fields['value'] == 0) {
         return PluginOrderOrder::ORDER_IS_UNDER_BUDGET;
     }
     $total_HT = 0;
     foreach ($DB->request($query) as $data) {
         $item = new PluginOrderOrder_Item();
         $prices = $item->getAllPrices($data['id']);
         $total_HT += $prices["priceHT"] + $data['port_price'];
     }
     // Compare BUDGET value to TOTAL_HT value
     if ($total_HT > $budget->getField('value')) {
         return PluginOrderOrder::ORDER_IS_OVER_BUDGET;
     } elseif ($total_HT == $budget->getField('value')) {
         return PluginOrderOrder::ORDER_IS_EQUAL_BUDGET;
     } else {
         return PluginOrderOrder::ORDER_IS_UNDER_BUDGET;
     }
 }
Example #5
0
 public function updateReceptionStatus($params)
 {
     $detail = new PluginOrderOrder_Item();
     $plugin_order_orders_id = 0;
     if (isset($params["item"])) {
         foreach ($params["item"] as $key => $val) {
             if ($val == 1) {
                 if ($params["itemtype"][$key] == 'SoftwareLicense') {
                     $this->receptionAllItem($key, $params["plugin_order_references_id"][$key], $params["plugin_order_orders_id"], $params["delivery_date"], $params["delivery_number"], $params["plugin_order_deliverystates_id"]);
                     $plugin_order_orders_id = $params["plugin_order_orders_id"];
                 } else {
                     if ($detail->getFromDB($key)) {
                         if (!$plugin_order_orders_id) {
                             $plugin_order_orders_id = $detail->fields["plugin_order_orders_id"];
                         }
                         if ($detail->fields["states_id"] == PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED) {
                             $this->receptionOneItem($key, $plugin_order_orders_id, $params["delivery_date"], $params["delivery_number"], $params["plugin_order_deliverystates_id"]);
                         } else {
                             Session::addMessageAfterRedirect(__("Item already taken delivery", "order"), true, ERROR);
                         }
                         // Automatic generate asset
                         $options = array("itemtype" => $params["itemtype"][$key], "items_id" => $key, 'entities_id' => $detail->getEntityID(), "plugin_order_orders_id" => $detail->fields["plugin_order_orders_id"], "plugin_order_references_id" => $params["plugin_order_references_id"][$key]);
                         self::generateAsset($options);
                     }
                 }
             }
         }
         // $val == 1
         self::updateDelivryStatus($plugin_order_orders_id);
     } else {
         Session::addMessageAfterRedirect(__("No item selected", "order"), false, ERROR);
     }
 }
Example #6
0
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/order
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$pluginOrderOrder = new PluginOrderOrder();
$config = new PluginOrderConfig();
$pluginOrderOrder_Item = new PluginOrderOrder_Item();
$pluginOrderOrder_Supplier = new PluginOrderOrder_Supplier();
/* add order */
if (isset($_POST["add"])) {
    $pluginOrderOrder->check(-1, 'w', $_POST);
    /* FORCE Status */
    $_POST['plugin_order_orderstates_id'] = $config->getDraftState();
    $newID = $pluginOrderOrder->add($_POST);
    $url = Toolbox::getItemTypeFormURL('PluginOrderOrder') . "?id={$newID}";
    Html::redirect($url);
} else {
    if (isset($_POST["delete"])) {
        $pluginOrderOrder->check($_POST['id'], 'w');
        $pluginOrderOrder->delete($_POST);
        $pluginOrderOrder->redirectToList();
    } else {
Example #7
0
 public function transfer($ID, $entity)
 {
     global $DB;
     if ($ID <= 0 || !$this->getFromDB($ID)) {
         return 0;
     }
     //If reference is not visible in the target entity : transfer it!
     if (!countElementsInTableForEntity($this->getTable(), $entity, "`id`='" . $this->getID() . "'")) {
         $input = $this->fields;
         $input['entities_id'] = $entity;
         $oldref = $input['id'];
         unset($input['id']);
         $input['transfert'] = 1;
         $newid = $this->add($input);
         $reference_supplier = new PluginOrderReference_Supplier();
         $reference_supplier->getFromDBByReference($oldref);
         $input = $reference_supplier->fields;
         $input['entities_id'] = $entity;
         $input['plugin_order_references_id'] = $newid;
         unset($input['id']);
         $reference_supplier->add($input);
         $PluginOrderOrder_Item = new PluginOrderOrder_Item();
         $query = "SELECT `id`\n                   FROM `glpi_plugin_order_orders_items`\n                   WHERE `plugin_order_references_id` = '{$oldref}'";
         $result = $DB->query($query);
         $num = $DB->numrows($result);
         if ($num) {
             while ($dataref = $DB->fetch_array($result)) {
                 $values["id"] = $dataref['id'];
                 $values["plugin_order_references_id"] = $newid;
                 $PluginOrderOrder_Item->update($values);
             }
         }
     }
 }
Example #8
0
 @copyright Copyright (c) 2010-2015 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/order
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$link = new PluginOrderLink();
$order_item = new PluginOrderOrder_Item();
if (isset($_POST["generation"])) {
    if (isset($_POST["item"])) {
        foreach ($_POST["item"] as $key => $val) {
            if ($val == 1) {
                $order_item->getFromDB($_POST["id"][$key]);
                if ($order_item->fields["states_id"] == PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED) {
                    Session::addMessageAfterRedirect(__("Cannot generate items not delivered", "order"), true, ERROR);
                    Html::redirect($_SERVER["HTTP_REFERER"]);
                }
            }
        }
    }
    if (isset($_POST["item"])) {
        Html::header(__("Orders management", "order"), '', "plugins", "order", "order");
        $link->showItemGenerationForm($_POST);
Example #9
0
 public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'PluginOrderOrder') {
         $order_item = new PluginOrderOrder_Item();
         $order_item->showBillsItems($item);
     } elseif ($item->getType() == __CLASS__) {
         switch ($tabnum) {
             case 1:
                 self::showOrdersItems($item);
                 break;
             case 2:
                 self::showItems($item);
                 break;
         }
     }
     return true;
 }
Example #10
0
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Order plugin is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with GLPI; along with Order. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   order
 @author    the order plugin team
 @copyright Copyright (c) 2010-2015 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/order
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
$item = new PluginOrderOrder_Item();
if (isset($_POST['update'])) {
    $item->update($_POST);
    $item->updatePrices($_POST['id']);
    Html::redirect($_SERVER['HTTP_REFERER']);
}
Html::header(__("Orders management", "order"), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "order");
$item->display($_REQUEST);
Html::footer();
Example #11
0
 public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if (get_class($item) == 'PluginOrderOrder') {
         if (!$item->fields['is_template']) {
             $order_item = new self();
             $order_item->showItem($item->getID());
         }
     } else {
         if (in_array($item->getType(), PluginOrderOrder_Item::getClasses(true))) {
             $order_item = new self();
             $order_item->showPluginFromItems(get_class($item), $item->getField('id'));
         }
     }
     return true;
 }
Example #12
0
 public function deleteLinkWithItem($detailID, $itemtype, $plugin_order_orders_id)
 {
     global $DB;
     if ($itemtype == 'SoftWareLicense') {
         $detail = new PluginOrderOrder_Item();
         $detail->getFromDB($detailID);
         $license = $detail->fields["items_id"];
         $this->removeInfoComRelatedToOrder($itemtype, $license);
         $result = $PluginOrderOrder_Item->queryRef($detail->fields["plugin_order_orders_id"], $detail->fields["plugin_order_references_id"], $detail->fields["price_taxfree"], $detail->fields["discount"], PluginOrderOrder::ORDER_DEVICE_DELIVRED);
         $nb = $DB->numrows($result);
         if ($nb) {
             for ($i = 0; $i < $nb; $i++) {
                 $ID = $DB->result($result, $i, 'id');
                 $input["id"] = $ID;
                 $input["items_id"] = 0;
                 $detail->update($input);
                 $lic = new SoftwareLicense();
                 $lic->getFromDB($license);
                 $values["id"] = $lic->fields["id"];
                 $values["number"] = $lic->fields["number"] - 1;
                 $lic->update($values);
             }
             $order = new PluginOrderOrder();
             $order->getFromDB($detail->fields["plugin_order_orders_id"]);
             $new_value = __("Item unlink form order", "order") . ' : ' . $order->fields["name"];
             $order->addHistory($itemtype, '', $new_value, $license);
             $item = new $itemtype();
             $item->getFromDB($license);
             $new_value = __("Item unlink form order", "order") . ' : ' . $item->getField("name");
             $order->addHistory('PluginOrderOrder', '', $new_value, $order->fields["id"]);
         }
     } else {
         $order = new PluginOrderOrder();
         $order->getFromDB($plugin_order_orders_id);
         $detail = new PluginOrderOrder_Item();
         $detail->getFromDB($detailID);
         $items_id = $detail->fields["items_id"];
         $this->removeInfoComRelatedToOrder($itemtype, $items_id);
         if ($items_id != 0) {
             $input = $detail->fields;
             $input["items_id"] = 0;
             $detail->update($input);
         } else {
             Session::addMessageAfterRedirect(__("One or several selected rows haven't linked items", "order"), TRUE, ERROR);
         }
         $new_value = __("Item unlink form order", "order") . ' : ' . $order->fields["name"];
         $order->addHistory($itemtype, '', $new_value, $items_id);
         $item = new $itemtype();
         $item->getFromDB($items_id);
         $new_value = __("Item unlink form order", "order") . ' : ' . $item->getField("name");
         $order->addHistory('PluginOrderOrder', '', $new_value, $order->fields["id"]);
     }
 }
Example #13
0
function plugin_order_getAddSearchOptions($itemtype)
{
    $plugin = new Plugin();
    $sopt = array();
    if ($plugin->isInstalled('order') && $plugin->isActivated('order') && Session::haveRight("plugin_order_order", READ)) {
        if (in_array($itemtype, PluginOrderOrder_Item::getClasses(true))) {
            $sopt[3160]['table'] = 'glpi_plugin_order_orders';
            $sopt[3160]['field'] = 'name';
            $sopt[3160]['linkfield'] = '';
            $sopt[3160]['name'] = __("Order name", "order");
            $sopt[3160]['forcegroupby'] = true;
            $sopt[3160]['datatype'] = 'itemlink';
            $sopt[3160]['itemlink_type'] = 'PluginOrderOrder';
            $sopt[3161]['table'] = 'glpi_plugin_order_orders';
            $sopt[3161]['field'] = 'num_order';
            $sopt[3161]['linkfield'] = '';
            $sopt[3161]['name'] = __("Order number", "order");
            $sopt[3161]['forcegroupby'] = true;
            $sopt[3161]['datatype'] = 'itemlink';
            $sopt[3161]['itemlink_type'] = 'PluginOrderOrder';
        }
    }
    return $sopt;
}
Example #14
0
 @copyright Copyright (c) 2010-2015 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/order
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$reception = new PluginOrderReception();
$order_item = new PluginOrderOrder_Item();
if (isset($_POST["update"])) {
    if (PluginOrderReception::canCreate()) {
        $order_item->getFromDB($_POST["id"]);
        if ($order_item->fields["itemtype"] == 'SoftwareLicense') {
            $result = $order_item->queryRef($order_item->fields["plugin_order_orders_id"], $order_item->fields["plugin_order_references_id"], $order_item->fields["price_taxfree"], $order_item->fields["discount"], PluginOrderOrder::ORDER_DEVICE_DELIVRED);
            $nb = $DB->numrows($result);
            if ($nb) {
                for ($i = 0; $i < $nb; $i++) {
                    $ID = $DB->result($result, $i, 'id');
                    $input["id"] = $ID;
                    $input["delivery_date"] = $_POST["delivery_date"];
                    $input["delivery_number"] = $_POST["delivery_number"];
                    $input["plugin_order_deliverystates_id"] = $_POST["plugin_order_deliverystates_id"];
                    $input["delivery_comment"] = $_POST["delivery_comment"];
                    $reception->update($input);
Example #15
0
function plugin_init_order()
{
    global $PLUGIN_HOOKS, $CFG_GLPI, $ORDER_TYPES;
    Plugin::registerClass('PluginOrderProfile');
    $PLUGIN_HOOKS['csrf_compliant']['order'] = true;
    /* load changeprofile function */
    $PLUGIN_HOOKS['change_profile']['order'] = array('PluginOrderProfile', 'changeProfile');
    $plugin = new Plugin();
    if ($plugin->isInstalled('order')) {
        $PLUGIN_HOOKS['migratetypes']['order'] = 'plugin_order_migratetypes';
    }
    if ($plugin->isInstalled('order') && $plugin->isActivated('order')) {
        $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'));
        $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('PluginOrderOrder_Item', array('notificationtemplates_types' => true, 'addtabon' => PluginOrderOrder_Item::getClasses(true)));
        Plugin::registerClass('PluginOrderProfile', array('addtabon' => array('Profile')));
        if (plugin_order_haveRight('order', 'r')) {
            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", "w")) {
                $PLUGIN_HOOKS['config_page']['order'] = 'front/config.form.php';
            }
            if (plugin_order_haveRight("order", "r") || plugin_order_haveRight("reference", "r") || plugin_order_haveRight("bill", "r")) {
                $PLUGIN_HOOKS['menu_entry']['order'] = 'front/menu.php';
                // Manage redirects
                $PLUGIN_HOOKS['redirect_page']['order']['order'] = "front/order.form.php";
                $PLUGIN_HOOKS['redirect_page']['order']['reference'] = "front/reference.form.php";
                $PLUGIN_HOOKS['redirect_page']['order']['reception'] = "front/reception.form.php";
                //menu
                if (plugin_order_haveRight("order", "r")) {
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['menu']['title'] = __("Menu", "order");
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['menu']['page'] = '/plugins/order/front/menu.php';
                }
                //order
                if (plugin_order_haveRight("order", "r")) {
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['order']['title'] = __("Orders", "order");
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['order']['page'] = '/plugins/order/front/order.php';
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['order']['links']['search'] = '/plugins/order/front/order.php';
                }
                //references
                if (plugin_order_haveRight("reference", "r")) {
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['reference']['title'] = __("References", "order");
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['reference']['page'] = '/plugins/order/front/reference.php';
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['reference']['links']['search'] = '/plugins/order/front/reference.php';
                }
                //bill
                if (plugin_order_haveRight("bill", "r")) {
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['PluginOrderBill']['title'] = __("Bill", "order");
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['PluginOrderBill']['page'] = '/plugins/order/front/bill.php';
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['PluginOrderBill']['links']['search'] = '/plugins/order/front/bill.php';
                }
            }
            if (plugin_order_haveRight("order", "w")) {
                //order
                $PLUGIN_HOOKS['submenu_entry']['order']['options']['order']['links']['template'] = '/front/setup.templates.php?itemtype=PluginOrderOrder&add=0';
                $PLUGIN_HOOKS['submenu_entry']['order']['options']['order']['links']['add'] = '/front/setup.templates.php?itemtype=PluginOrderOrder&add=1';
                if (Session::haveRight('config', 'w')) {
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['order']['links']['config'] = '/plugins/order/front/config.form.php';
                }
            }
            if (plugin_order_haveRight("bill", "w")) {
                //order
                $PLUGIN_HOOKS['submenu_entry']['order']['options']['PluginOrderBill']['links']['add'] = '/plugins/order/front/bill.form.php';
            }
            if (plugin_order_haveRight("reference", "w")) {
                //references
                $PLUGIN_HOOKS['submenu_entry']['order']['options']['reference']['links']['add'] = '/plugins/order/front/reference.form.php';
                if (Session::haveRight('config', 'w')) {
                    $PLUGIN_HOOKS['submenu_entry']['order']['options']['reference']['links']['config'] = '/plugins/order/front/config.form.php';
                }
            }
            if (Session::haveRight("config", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['order']['options']['config']['title'] = __("Setup");
                $PLUGIN_HOOKS['submenu_entry']['order']['options']['config']['page'] = '/plugins/order/front/config.form.php';
                if (Session::haveRight('config', 'w')) {
                    $PLUGIN_HOOKS['submenu_entry']['order']['config'] = 'front/config.form.php';
                }
            }
            $PLUGIN_HOOKS['use_massive_action']['order'] = 1;
            $PLUGIN_HOOKS['plugin_datainjection_populate']['order'] = "plugin_datainjection_populate_order";
        }
    }
}
Example #16
0
 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";
$item = new PluginOrderOrder_Item();
$item->checkGlobal("r");
if (isset($_POST['update'])) {
    $item->update($_POST);
    $item->updatePrices($_POST['id']);
    Html::redirect($_SERVER['HTTP_REFERER']);
}
Html::header(__("Orders management", "order"), '', "plugins", "order", "order");
$item->showForm($_GET["id"]);
Html::footer();