<%@language = "javascript" %>
<%
/*
    $Revision$
    $Id$
*/
%>
<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../api2/model_res_artikel.inc" -->

<%
var canImport = user.has("WEB_IMPORT");
var this_model = new model_res_artikel();
var this_params = {
        "search": {
            "autosearch": true,
            "filters": [
                "bookingdiscipline",
                "name"
            ],
            "transit": [
                "bookingdiscipline"
            ]
        },
        "list": {
            "columns": [
                "id",
                "bookingdiscipline",
                "name",
                "code",
                "unit",
                "price",
                "fixedprice",
                "purchaseprice",
                "group",
                "staffcosts",
                "generalcosts",
                "sequence",
                "expirationdate"
            ],
            "actions": arrangementAction(),
            "requires": {
              js: ["./res_artikel.js"]
            }
        },
        "layout": {
            "miscellaneous": {
                "icon": "fa-mug-hot"
            }
        }
    }

if (canImport) {
    this_params.list.roundtripCode = "RES_ARTIKEL_SYNC";
}

scaffolding(this_model, this_params);


    function arrangementAction() {
      var sql = "SELECT count(res_arrangement_key) total FROM res_arrangement";
      var oRs = Oracle.Execute(sql);
      var total = oRs("total").Value;
      oRs.Close();
      if (total > 0)
        return [{ action: "scf_multiarrangement", caption: L("res_arrangement_m"), multi: true, onlyMulti: true, multiOnce: true }];
      else
        return [];
    }
%>
<% ASPPAGE_END(); %>
