예제 #1
0
 public function transfer($ID, $entity)
 {
     global $DB;
     $supplier = new PluginOrderOrder_Supplier();
     $reference = new PluginOrderReference();
     $this->getFromDB($ID);
     $input["id"] = $ID;
     $input["entities_id"] = $entity;
     $this->update($input);
     if ($supplier->getFromDBByOrder($ID)) {
         $input["id"] = $supplier->fields["id"];
         $input["entities_id"] = $entity;
         $supplier->update($input);
     }
     $query = "SELECT `plugin_order_references_id`\n                FROM `glpi_plugin_order_orders_items`\n                WHERE `plugin_order_orders_id` = '{$ID}'\n                GROUP BY plugin_order_references_id";
     $result = $DB->query($query);
     $num = $DB->numrows($result);
     if ($num) {
         while ($detail = $DB->fetch_array($result)) {
             $ref = $reference->transfer($detail["plugin_order_references_id"], $entity);
         }
     }
 }
예제 #2
0
                if ($_POST["num_quote"]) {
                    $new_value .= __("Quote number", "order") . " " . $_POST["num_quote"];
                }
                if ($_POST["num_order"]) {
                    $new_value .= " - " . __("Order number") . " : " . $_POST["num_order"];
                }
                $order->addHistory('PluginOrderOrder', "", $new_value, $_POST["plugin_order_orders_id"]);
            }
        }
    }
    Html::back();
} elseif (isset($_POST["delete"])) {
    if (PluginOrderOrder_Supplier::canCreate()) {
        foreach ($_POST["check"] as $ID => $value) {
            if ($supplier->delete(array("id" => $ID), 0, 0)) {
                $new_value = __("Delete", "order") . " " . __("Supplier Detail", "order") . " : " . $ID;
                $order->addHistory('PluginOrderOrder', "", $new_value, $_POST["plugin_order_orders_id"]);
            }
        }
    }
    Html::back();
} elseif (isset($_POST["update"])) {
    if (PluginOrderOrder_Supplier::canCreate()) {
        $supplier->update($_POST);
    }
    Html::back();
} else {
    Html::header(__("Orders management", "order"), '', "plugins", "order", "order");
    $supplier->showForm($_GET["id"], array('plugin_order_orders_id' => $_GET["plugin_order_orders_id"]));
    Html::footer();
}