$_SESSION["displayphone"] = true;
    }
}
//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"])) {
Exemplo n.º 2
0
function plugin_financialreports_MassiveActions($type)
{
    if (in_array($type, PluginFinancialreportsDisposalItem::getTypes())) {
        return array('PluginFinancialreportsDisposalItem' . MassiveAction::CLASS_ACTION_SEPARATOR . 'plugin_financialreports_add_date_disposal' => __('Indicate the date of disposal', 'financialreports'));
    }
    return array();
}
 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     $disposal = new PluginFinancialreportsDisposalItem();
     switch ($ma->getAction()) {
         case "plugin_financialreports_add_date_disposal":
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if ($disposal->addDateDisposal($id, $item->getType(), $input['date_disposal'])) {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
Exemplo n.º 4
0
function plugin_financialreports_MassiveActionsProcess($data)
{
    $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
    switch ($data['action']) {
        case "plugin_financialreports_add_date_disposal":
            foreach ($data["item"] as $key => $val) {
                if ($val == 1) {
                    $disposal = new PluginFinancialreportsDisposalItem();
                    if ($disposal->addDateDisposal($key, $data['itemtype'], $data['date_disposal'])) {
                        $res['ok']++;
                    } else {
                        $res['ko']++;
                    }
                }
            }
            break;
    }
    return $res;
}