function showForm($type, $device)
 {
     global $DB, $CFG_GLPI;
     $PluginFinancialreportsFinancialreport = new PluginFinancialreportsFinancialreport();
     $canedit = $PluginFinancialreportsFinancialreport->canView();
     $query = "SELECT *\n      FROM `" . $this->getTable() . "`\n      WHERE `itemtype` = '" . $type . "'\n      AND `items_id` = '" . $device . "'";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/financialreports/front/financialreport.php\">";
     echo "<div align='center'><table class=\"tab_cadre_fixe\"  cellspacing=\"2\" cellpadding=\"2\">";
     echo "<tr><th colspan='3'>" . PluginFinancialreportsFinancialreport::getTypeName() . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td class='left'>";
     echo __('Indicate the date of disposal', 'financialreports') . "</td><td class='left'>";
     if ($number == 1) {
         while ($line = $DB->fetch_array($result)) {
             $ID = $line["id"];
             Html::showDateFormItem("date_disposal", $line["date_disposal"], true, true);
             echo "</td>";
             if ($canedit) {
                 echo "<td class='center' class='tab_bg_2'>";
                 Html::showSimpleForm($CFG_GLPI['root_doc'] . '/plugins/financialreports/front/financialreport.php', 'delete_date', _x('button', 'Delete permanently'), array('id' => $ID));
                 echo "</td>";
             }
         }
     } else {
         if ($canedit) {
             Html::showDateFormItem("date_disposal", "", true, true);
             echo "</td>";
             echo "</tr>";
             echo "<tr><th colspan='3'>";
             echo "<input type='hidden' name='items_id' value='" . $device . "'>";
             echo "<input type='hidden' name='itemtype' value='" . $type . "'>";
             echo "<input type=\"submit\" name=\"add_date\" class=\"submit\" value='" . _sx('button', 'Post') . "'>";
             echo "</th></tr>";
         }
     }
     echo "</table></div>";
     Html::closeForm();
 }
        $_SESSION["displaydisposal"] = false;
    } else {
        $_SESSION["displaydisposal"] = true;
    }
}
$disposal = new PluginFinancialreportsDisposalItem();
$report = new PluginFinancialreportsFinancialreport();
if (isset($_POST["add_date"])) {
    $disposal->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete_date"])) {
        $disposal->delete($_POST);
        Html::back();
    } else {
        if ($report->canView() || Session::haveRight("config", UPDATE)) {
            Report::title();
            if (empty($_GET["date"])) {
                $_GET["date"] = date("Y-m-d");
            }
            if (empty($_GET["locations_id"])) {
                $_GET["locations_id"] = 0;
            }
            if (!isset($_POST["date"])) {
                $_POST["date"] = $_GET["date"];
            }
            if (!isset($_POST["locations_id"])) {
                $_POST["locations_id"] = $_GET["locations_id"];
            }
            echo "<div align='center'><form action=\"./financialreport.php\" method=\"post\">";
            echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'>";
Пример #3
0
        $_SESSION["displaydisposal"] = false;
    } else {
        $_SESSION["displaydisposal"] = true;
    }
}
$disposal = new PluginFinancialreportsDisposalItem();
$report = new PluginFinancialreportsFinancialreport();
if (isset($_POST["add_date"])) {
    $disposal->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete_date"])) {
        $disposal->delete($_POST);
        Html::back();
    } else {
        if ($report->canView() || Session::haveRight("config", "w")) {
            Report::title();
            if (empty($_GET["date"])) {
                $_GET["date"] = date("Y-m-d");
            }
            if (empty($_GET["locations_id"])) {
                $_GET["locations_id"] = 0;
            }
            if (!isset($_POST["date"])) {
                $_POST["date"] = $_GET["date"];
            }
            if (!isset($_POST["locations_id"])) {
                $_POST["locations_id"] = $_GET["locations_id"];
            }
            echo "<div align='center'><form action=\"./financialreport.php\" method=\"post\">";
            echo "<table class='tab_cadre'><tr class='tab_bg_2'>";