Example #1
0
 static function getMenuContent()
 {
     global $CFG_GLPI;
     $menu = array();
     $menu['title'] = self::getTypeName(2);
     $menu['page'] = self::getSearchURL(false);
     if (PluginOrderConfig::canView()) {
         $menu['links']['config'] = PluginOrderConfig::getFormURL(false);
     }
     if (PluginOrderOrder::canView()) {
         $menu['options']['order']['title'] = PluginOrderOrder::getTypeName(2);
         $menu['options']['order']['page'] = PluginOrderOrder::getSearchURL(false);
         $menu['options']['order']['links']['add'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=1";
         if (PluginOrderOrder::canCreate()) {
             $menu['options']['order']['links']['search'] = PluginOrderOrder::getSearchURL(false);
         }
         $menu['options']['order']['links']['template'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=0";
         if (PluginOrderConfig::canView()) {
             $menu['options']['order']['links']['config'] = PluginOrderConfig::getFormURL(false);
         }
     }
     $menu['options']['bill']['title'] = PluginOrderBill::getTypeName(2);
     $menu['options']['bill']['page'] = PluginOrderBill::getSearchURL(false);
     $menu['options']['bill']['links']['search'] = PluginOrderBill::getSearchURL(false);
     $menu['options']['bill']['links']['add'] = PluginOrderBill::getFormURL(false);
     $menu['options']['bill']['links']['config'] = PluginOrderConfig::getFormURL(false);
     $menu['options']['references']['title'] = PluginOrderReference::getTypeName(2);
     $menu['options']['references']['page'] = PluginOrderReference::getSearchURL(false);
     $menu['options']['references']['links']['search'] = PluginOrderReference::getSearchURL(false);
     $menu['options']['references']['links']['add'] = PluginOrderReference::getFormURL(false);
     $menu['options']['references']['links']['config'] = PluginOrderConfig::getFormURL(false);
     return $menu;
 }
Example #2
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()) {
            /* 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";
        }
    }
}
Example #3
0
 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";
$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();
Example #4
0
 public function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     $order_order = new PluginOrderOrder();
     $order_order->getFromDB($this->getOrdersID());
     $order_reference = new PluginOrderReference();
     $order_reference->getFromDB($this->fields["plugin_order_references_id"]);
     $canedit = $order_order->can($this->getOrdersID(), UPDATE) && !$order_order->canUpdateOrder() && !$order_order->isCanceled();
     echo "<input type='hidden' name='plugin_order_orders_id' value='" . $this->getOrdersID() . "'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __("Reference") . ": </td>";
     echo "<td>";
     $data = array();
     $data["id"] = $this->fields["plugin_order_references_id"];
     $data["name"] = $order_reference->fields["name"];
     echo $order_reference->getReceptionReferenceLink($data);
     echo "</td>";
     echo "<td>" . __("Taken delivery", "order") . "</td>";
     echo "<td>";
     Dropdown::showYesNo('states_id', $this->fields['states_id']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __("Delivery form") . ": </td>";
     echo "<td>";
     if ($canedit) {
         Html::autocompletionTextField($this, "delivery_number");
     } else {
         echo $this->fields["delivery_number"];
     }
     echo "</td>";
     echo "<td>" . __("Delivery date") . ": </td>";
     echo "<td>";
     if ($canedit) {
         Html::showDateFormItem("delivery_date", $this->fields["delivery_date"], true, 1);
     } else {
         echo Html::convDate($this->fields["delivery_date"]);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __("Delivery status", "order") . ": </td>";
     echo "<td>";
     if ($canedit) {
         PluginOrderDeliveryState::Dropdown(array('name' => "plugin_order_deliverystates_id", 'value' => $this->fields["plugin_order_deliverystates_id"]));
     } else {
         echo Dropdown::getDropdownName("glpi_plugin_order_deliverystates", $this->fields["plugin_order_deliverystates_id"]);
     }
     echo "</td>";
     echo "<td>" . __("Bill", "order") . "</td>";
     echo "<td>";
     if (Session::haveRight("plugin_order_bill", UPDATE)) {
         PluginOrderBill::Dropdown(array('name' => "plugin_order_bills_id", 'value' => $this->fields["plugin_order_bills_id"]));
     } elseif (Session::haveRight("plugin_order_bill", UPDATE)) {
         echo Dropdown::getDropdownName("glpi_plugin_order_bills", $this->fields["plugin_order_bills_id"]);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td>";
     //comments of order
     echo __("Comments") . ": </td>";
     echo "<td colspan='3'>";
     if ($canedit) {
         echo "<textarea cols='100' rows='4' name='delivery_comment'>" . $this->fields["delivery_comment"] . "</textarea>";
     } else {
         echo $this->fields["delivery_comment"];
     }
     echo "</td>";
     echo "</tr>";
     $options['candel'] = false;
     $this->showFormButtons($options);
     return true;
 }
Example #5
0
 public static function install(Migration $migration)
 {
     global $DB;
     $table = getTableForItemType(__CLASS__);
     if (!TableExists($table)) {
         $migration->displayMessage("Installing {$table}");
         $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_bills` (\n                    `id` int(11) NOT NULL AUTO_INCREMENT,\n                    `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT '',\n                    `number` varchar(255) COLLATE utf8_unicode_ci DEFAULT '',\n                    `billdate` datetime DEFAULT NULL,\n                    `validationdate` datetime DEFAULT NULL,\n                    `comment` text COLLATE utf8_unicode_ci,\n                    `plugin_order_billstates_id` int(11) NOT NULL DEFAULT '0',\n                    `value` decimal(20,4) NOT NULL DEFAULT '0.0000',\n                    `plugin_order_billtypes_id` int(11) NOT NULL DEFAULT '0',\n                    `suppliers_id` int(11) NOT NULL DEFAULT '0',\n                    `plugin_order_orders_id` int(11) NOT NULL DEFAULT '0',\n                    `users_id_validation` int(11) NOT NULL DEFAULT '0',\n                    `entities_id` int(11) NOT NULL DEFAULT '0',\n                    `is_recursive` int(11) NOT NULL DEFAULT '0',\n                    `notepad` text COLLATE utf8_unicode_ci,\n                    PRIMARY KEY (`id`)\n                  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;";
         $DB->query($query) or die($DB->error());
     } else {
         if (FieldExists("glpi_plugin_order_orders_suppliers", "num_bill")) {
             //Migrate bills
             $bill = new PluginOrderBill();
             $query = "SELECT * FROM `glpi_plugin_order_orders_suppliers`";
             foreach (getAllDatasFromTable('glpi_plugin_order_orders_suppliers') as $data) {
                 if (!is_null($data['num_bill']) && $data['num_bill'] != '' && !countElementsInTable('glpi_plugin_order_bills', "`number`='" . $data['num_bill'] . "'")) {
                     //create new bill and link it to the order
                     $tmp['name'] = $tmp['number'] = $data['num_bill'];
                     //Get supplier from the order
                     $tmp['suppliers_id'] = $data['suppliers_id'];
                     //Bill has the same entities_id and is_recrusive
                     $tmp['entities_id'] = $data['entities_id'];
                     $tmp['is_recursive'] = $data['is_recursive'];
                     //Link bill to order
                     $tmp['plugin_order_orders_id'] = $data['plugin_order_orders_id'];
                     //Create bill
                     $bills_id = $bill->add($tmp);
                     //All order items are now linked to this bill
                     $query = "UPDATE `glpi_plugin_order_orders_items`\n                            SET `plugin_order_bills_id` = '{$bills_id}'\n                            WHERE `plugin_order_orders_id` = '" . $data['plugin_order_orders_id'] . "'";
                     $DB->query($query);
                 }
             }
         }
         $migration->changeField($table, "value", "value", "decimal(20,4) NOT NULL DEFAULT '0.0000'");
         $migration->migrationOneTable($table);
     }
     $migration->dropField("glpi_plugin_order_orders_suppliers", "num_bill");
     $migration->migrationOneTable("glpi_plugin_order_orders_suppliers");
 }
Example #6
0
 LICENSE

 This file is part of the order plugin.

 Order plugin is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

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

 You should have received a copy of the GNU General Public License
 along with GLPI; along with Order. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   order
 @author    the order plugin team
 @copyright Copyright (c) 2010-2015 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/order
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include "../../../inc/includes.php";
Session::checkRight("plugin_order_bill", READ);
Html::header(PluginOrderBill::getTypeName(1), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "bill");
Search::show('PluginOrderBill');
Html::footer();
Example #7
0
 public function showBillsItems(PluginOrderOrder $order)
 {
     global $DB, $CFG_GLPI;
     $reference = new PluginOrderReference();
     echo "<div class='center'><table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><th colspan='2'>" . __("Bills", "order") . "</th></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>" . __("Payment status", "order") . ": </td>";
     echo "<td>";
     echo PluginOrderBillState::getState($order->fields['plugin_order_billstates_id']);
     echo "</td></tr></table>";
     if (countElementsInTable(getTableForItemType(__CLASS__), "`plugin_order_orders_id`='" . $order->getID() . "' GROUP BY `plugin_order_bills_id`")) {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th>" . __("Name") . "</th>";
         echo "<th>" . __("Status") . "</th>";
         echo "<th>" . __("Value") . "</th>";
         echo "<th>" . __("Paid value", "order") . "</th></tr>";
         $bill = new PluginOrderBill();
         foreach ($DB->request(getTableForItemType(__CLASS__), "`plugin_order_orders_id`='" . $order->getID() . "' GROUP BY `plugin_order_bills_id`") as $item) {
             if (isset($item->fields['plugin_order_bills_id']) && $item->fields['plugin_order_bills_id']) {
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 if ($bill->can($item->fields['plugin_order_bills_id'], READ)) {
                     echo "<td><a href='" . $item->getURL() . "'>" . $bill->getName() . "</a></td>";
                 } else {
                     echo "<td>" . $bill->getName() . "</td>";
                 }
                 echo "</td>";
                 echo "<td>";
                 echo Dropdown::getDropdownName(getTableForItemType('PluginOrderBillState'), $bill->fields['plugin_order_billstates_id']);
                 echo "</td></tr>";
             }
         }
         echo "</tr></table>";
     }
     echo "</div>";
     //Can write orders, and order is not already paid
     $canedit = $order->can($order->getID(), UPDATE) && !$order->isPaid() && !$order->isCanceled();
     $query_ref = "SELECT `glpi_plugin_order_orders_items`.`id` AS IDD, " . "`glpi_plugin_order_orders_items`.`plugin_order_references_id` AS id, " . "`glpi_plugin_order_references`.`name`, " . "`glpi_plugin_order_references`.`itemtype`, " . "`glpi_plugin_order_references`.`manufacturers_id` " . "FROM `glpi_plugin_order_orders_items`, `glpi_plugin_order_references` " . "WHERE `plugin_order_orders_id` = '" . $order->getID() . "' " . "AND `glpi_plugin_order_orders_items`.`plugin_order_references_id` = `glpi_plugin_order_references`.`id` " . "GROUP BY `glpi_plugin_order_orders_items`.`plugin_order_references_id` " . "ORDER BY `glpi_plugin_order_references`.`name`";
     $result_ref = $DB->query($query_ref);
     while ($data_ref = $DB->fetch_array($result_ref)) {
         echo "<div class='center'><table class='tab_cadre_fixe'>";
         if (!$DB->numrows($result_ref)) {
             echo "<tr><th>" . __("No item to take delivery of", "order") . "</th></tr></table></div>";
         } else {
             $rand = mt_rand();
             $itemtype = $data_ref["itemtype"];
             $item = new $itemtype();
             echo "<tr><th><ul><li>";
             echo "<a href=\"javascript:showHideDiv('generation{$rand}','generation_img{$rand}', '" . $CFG_GLPI['root_doc'] . "/pics/plus.png','" . $CFG_GLPI['root_doc'] . "/pics/moins.png');\">";
             echo "<img alt='' name='generation_img{$rand}' src=\"" . $CFG_GLPI['root_doc'] . "/pics/plus.png\">";
             echo "</a>";
             echo "</li></ul></th>";
             echo "<th>" . __("Type") . "</th>";
             echo "<th>" . __("Manufacturer") . "</th>";
             echo "<th>" . __("Product reference", "order") . "</th>";
             echo "</tr>";
             echo "<tr class='tab_bg_1 center'>";
             echo "<td></td>";
             echo "<td align='center'>" . $item->getTypeName() . "</td>";
             //Entity
             echo "<td align='center'>";
             echo Dropdown::getDropdownName('glpi_entities', $this->getEntityID());
             echo "</td>";
             echo "<td>" . $reference->getReceptionReferenceLink($data_ref) . "</td>";
             echo "</tr></table>";
             echo "<div class='center' id='generation{$rand}' style='display:none'>";
             echo "<form method='post' name='bills_form{$rand}' id='bills_form{$rand}'  " . "action='" . Toolbox::getItemTypeFormURL('PluginOrderBill') . "'>";
             echo "<input type='hidden' name='plugin_order_orders_id'\n                     value='" . $order->getID() . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<th></th>";
             echo "<th>" . __("Reference") . "</th>";
             echo "<th>" . __("Type") . "</th>";
             echo "<th>" . __("Model") . "</th>";
             echo "<th>" . __("Bill", "order") . "</th>";
             echo "<th>" . __("Bill status", "order") . "</th>";
             echo "</tr>";
             $results = $this->queryBills($order->getID(), $data_ref['id']);
             while ($data = $DB->fetch_array($results)) {
                 echo "<tr class='tab_bg_1'>";
                 if ($canedit) {
                     echo "<td width='10'>";
                     $sel = "";
                     if (isset($_GET["select"]) && $_GET["select"] == "all") {
                         $sel = "checked";
                     }
                     echo "<input type='checkbox' name='item[" . $data["IDD"] . "]' value='1' {$sel}>";
                     echo "<input type='hidden' name='plugin_order_orders_id' value='" . $order->getID() . "'>";
                     echo "</td>";
                 }
                 //Reference
                 echo "<td align='center'>";
                 echo $reference->getReceptionReferenceLink($data);
                 echo "</td>";
                 //Type
                 echo "<td align='center'>";
                 if (file_exists(GLPI_ROOT . "/inc/" . strtolower($data["itemtype"]) . "type.class.php")) {
                     echo Dropdown::getDropdownName(getTableForItemType($data["itemtype"] . "Type"), $data["types_id"]);
                 }
                 echo "</td>";
                 //Model
                 echo "<td align='center'>";
                 if (file_exists(GLPI_ROOT . "/inc/" . strtolower($data["itemtype"]) . "model.class.php")) {
                     echo Dropdown::getDropdownName(getTableForItemType($data["itemtype"] . "Model"), $data["models_id"]);
                 }
                 $bill = new PluginOrderBill();
                 echo "<td align='center'>";
                 if ($data["plugin_order_bills_id"] > 0) {
                     if ($bill->can($data['plugin_order_bills_id'], READ)) {
                         echo "<a href='" . $bill->getLinkURL() . "'>" . $bill->getName(true) . "</a>";
                     } else {
                         echo $bill->getName();
                     }
                 }
                 echo "</td>";
                 echo "<td align='center'>";
                 echo Dropdown::getDropdownName(getTableForItemType('PluginOrderBillState'), $data['plugin_order_billstates_id']);
                 echo "</td>";
                 echo "</tr>";
             }
         }
         echo "</table>";
         if ($canedit) {
             echo "<div class='center'>";
             echo "<table width='950px' class='tab_glpi'>";
             echo "<tr><td><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png\" alt=''></td><td class='center'>";
             echo "<a onclick= \"if ( markCheckboxes('bills_form{$rand}') ) " . "return false;\" href='#'>" . __("Check all") . "</a></td>";
             echo "<td>/</td><td class='center'>";
             echo "<a onclick= \"if ( unMarkCheckboxes('bills_form{$rand}') ) " . "return false;\" href='#'>" . __("Uncheck all") . "</a>";
             echo "</td><td align='left' width='80%'>";
             echo "<input type='hidden' name='plugin_order_orders_id' value='" . $order->getID() . "'>";
             $this->dropdownBillItemsActions($order->getID());
             echo "</td>";
             echo "</table>";
             echo "</div>";
         }
         Html::closeForm();
         echo "</div>";
     }
     echo "<br>";
 }
Example #8
0
 public function generateInfoComRelatedToOrder($entity, $detailID, $itemtype, $items_id, $templateID = 0)
 {
     global $CFG_GLPI;
     //Do not try to generate infocoms if itemtype doesn't support it (ie contracts...)
     if (in_array($itemtype, $CFG_GLPI["infocom_types"])) {
         // Retrieve configuration for generate assets feature
         $config = PluginOrderConfig::getConfig();
         $fields = array();
         //Create empty infocom, in order to forward entities_id and is_recursive
         $ic = new Infocom();
         $infocomID = !$ic->getFromDBforDevice($itemtype, $items_id) ? false : $ic->fields["id"];
         $detail = new PluginOrderOrder_Item();
         $detail->getFromDB($detailID);
         $order = new PluginOrderOrder();
         $order->getFromDB($detail->fields["plugin_order_orders_id"]);
         $order_supplier = new PluginOrderOrder_Supplier();
         $order_supplier->getFromDBByOrder($detail->fields["plugin_order_orders_id"]);
         if ($templateID) {
             if ($ic->getFromDBforDevice($itemtype, $templateID)) {
                 $fields = $ic->fields;
                 unset($fields["id"]);
                 if (isset($fields["immo_number"])) {
                     $fields["immo_number"] = autoName($fields["immo_number"], "immo_number", 1, 'Infocom', $entity);
                 }
                 if (empty($fields['buy_date'])) {
                     unset($fields['buy_date']);
                 }
             }
         }
         $fields["entities_id"] = $entity;
         $fields["itemtype"] = $itemtype;
         $fields["items_id"] = $items_id;
         $fields["order_number"] = $order->fields["num_order"];
         $fields["delivery_number"] = $detail->fields["delivery_number"];
         $fields["budgets_id"] = $order->fields["budgets_id"];
         $fields["suppliers_id"] = $order->fields["suppliers_id"];
         $fields["value"] = $detail->fields["price_discounted"];
         $fields["order_date"] = $order->fields["order_date"];
         if (!is_null($detail->fields["delivery_date"])) {
             $fields["delivery_date"] = $detail->fields["delivery_date"];
         }
         // Get bill data
         if ($config->canAddBillDetails()) {
             $bill = new PluginOrderBill();
             if ($bill->getFromDB($detail->fields["plugin_order_bills_id"])) {
                 $fields['bill'] = $bill->fields['number'];
                 $fields['warranty_date'] = $bill->fields['billdate'];
             }
         }
         foreach (array('warranty_date', 'buy_date', 'inventory_date') as $date) {
             if (!isset($fields[$date])) {
                 $fields[$date] = 'NULL';
             }
         }
         $fields['_no_warning'] = true;
         if ($infocomID) {
             $fields['id'] = $infocomID;
             $ic->update($fields);
         } else {
             $ic->add($fields);
         }
     }
 }
Example #9
0
 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";
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
if (!defined('GLPI_ROOT')) {
    die("Can not acces directly to this file");
}
if (isset($_POST["action"])) {
    switch ($_POST["action"]) {
        case "bill":
            echo "&nbsp;<input type='hidden' name='plugin_order_orders_id' " . "  value='" . $_POST["plugin_order_orders_id"] . "'>";
            PluginOrderBill::Dropdown(array('condition' => "`plugin_order_orders_id`='" . $_POST['plugin_order_orders_id'] . "'"));
            break;
    }
    PluginOrderBillState::Dropdown(array('comments' => true));
    echo "&nbsp;<input type='submit' name='action' class='submit' " . "   value='" . __("Post") . "'>";
}
Example #10
0
    Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderOrder'));
} elseif (!PluginOrderOrder::canView() && PluginOrderReference::canView() && !PluginOrderBill::canView()) {
    Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderReference'));
} elseif (!PluginOrderOrder::canView() && !PluginOrderReference::canView() && PluginOrderBill::canView()) {
    Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderBill'));
}
if (PluginOrderOrder::canView() || PluginOrderReference::canView()) {
    echo "<div class='center'>";
    echo "<table class='tab_cadre'>";
    echo "<tr><th colspan='2'>" . __("Orders management", "order") . "</th></tr>";
    if (PluginOrderOrder::canView()) {
        echo "<tr class='tab_bg_1' align='center'>";
        echo "<td><img src='../pics/order-icon.png'></td>";
        echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginOrderOrder') . "'>" . __("Orders", "order") . "</a></td></tr>";
    }
    if (PluginOrderReference::canView()) {
        echo "<tr class='tab_bg_1' align='center'>";
        echo "<td><img src='../pics/reference-icon.png'></td>";
        echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginOrderReference') . "'>" . __("Products references", "order") . "</a></td></tr>";
    }
    if (PluginOrderBill::canView()) {
        echo "<tr class='tab_bg_1' align='center'>";
        echo "<td><img src='../pics/bill-icon.png'></td>";
        echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginOrderBill') . "'>" . __("Bills", "order") . "</a></td></tr>";
    }
    echo "</table></div>";
} 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();