function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile' && $item->getField('interface') != 'helpdesk') {
         return PluginFinancialreportsFinancialreport::getTypeName();
     }
     return '';
 }
    }
}
//First time this screen is displayed : set the rebus mode to 'all'
if (!isset($_SESSION["displaydisposal"])) {
    $_SESSION["displaydisposal"] = false;
}
//Changing the rebus mode
if (isset($_GET["displaydisposal"])) {
    if ($_GET["displaydisposal"] == "false") {
        $_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;
Financialreports 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.

Financialreports 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 Financialreports. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkCentralAccess();
if (!isset($_POST["start"])) {
    $_POST["start"] = 0;
}
if (!isset($_POST["is_deleted"])) {
    $_POST["is_deleted"] = "0";
}
if (isset($_POST["display_type"])) {
    if ($_POST["display_type"] < 0) {
        $_POST["display_type"] = -$_POST["display_type"];
        $_POST["export_all"] = 1;
    }
    $display = array('displaypc' => $_SESSION["displaypc"], 'displaynotebook' => $_SESSION["displaynotebook"], 'displayserver' => $_SESSION["displayserver"], 'displaymonitor' => $_SESSION["displaymonitor"], 'displayprinter' => $_SESSION["displayprinter"], 'displaynetworking' => $_SESSION["displaynetworking"], 'displayperipheral' => $_SESSION["displayperipheral"], 'displayphone' => $_SESSION["displayphone"], 'displaydisposal' => $_SESSION["displaydisposal"]);
    $report = new PluginFinancialreportsFinancialreport();
    $report->displayReport($_POST, $display);
}
 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();
 }
Financialreports 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.

Financialreports 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 Financialreports. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkCentralAccess();
if (!isset($_POST["start"])) {
    $_POST["start"] = 0;
}
if (!isset($_POST["is_deleted"])) {
    $_POST["is_deleted"] = "0";
}
if (isset($_POST["display_type"])) {
    if ($_POST["display_type"] < 0) {
        $_POST["display_type"] = -$_POST["display_type"];
        $_POST["export_all"] = 1;
    }
    $display = array('displaypc' => $_SESSION["displaypc"], 'displaynotebook' => $_SESSION["displaynotebook"], 'displayserver' => $_SESSION["displayserver"], 'displaymonitor' => $_SESSION["displaymonitor"], 'displayprinter' => $_SESSION["displayprinter"], 'displaynetworking' => $_SESSION["displaynetworking"], 'displayperipheral' => $_SESSION["displayperipheral"], 'displayphone' => $_SESSION["displayphone"], 'displaydisposal' => $_SESSION["displaydisposal"]);
    $report = new PluginFinancialreportsFinancialreport();
    $report->display($_POST, $display);
}
    }
}
//First time this screen is displayed : set the rebus mode to 'all'
if (!isset($_SESSION["displaydisposal"])) {
    $_SESSION["displaydisposal"] = false;
}
//Changing the rebus mode
if (isset($_GET["displaydisposal"])) {
    if ($_GET["displaydisposal"] == "false") {
        $_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;