PNBR#34356 Overzicht verbruiksartikelen

svn path=/Website/trunk/; revision=29432
This commit is contained in:
Erik Groener
2016-05-18 12:40:59 +00:00
parent ccebfdf1fc
commit e4e628115e
9 changed files with 130 additions and 127 deletions

View File

@@ -636,6 +636,12 @@ api2 = {
)
wheres.push(inc.model.soft_delete + " IS NULL");
// Bij includes ook de vervallen records tonen indien gewenst.
if (inc.model.soft_expire &&
( (params.filter.has_show_expired && params.filter.show_expired != "on") || !params.filter.has_show_expired)
)
wheres.push("(" + model.soft_expire + " IS NULL OR " + model.soft_expire + " > SYSDATE)");
if (inc.joinfunction)
{
var where = inc.joinfunction(params);
@@ -1265,6 +1271,9 @@ function generic_REST_GET(model, gparams)
if (model.soft_delete && params.filter.show_deleted != "on")
query.wheres.push(model.soft_delete + " IS NULL");
if (model.soft_expire && params.filter.show_expired != "on" && !params.filter.id)
query.wheres.push("(" + model.soft_expire + " IS NULL OR " + model.soft_expire + " > SYSDATE)");
var sql = "SELECT " + query.selects.join(", ")
+ " FROM " + query.tables.join(", ")
+ (query.wheres.length ? " WHERE " + query.wheres.join(" AND " ) : "");

View File

@@ -18,6 +18,11 @@ function model_res_artikel()
this.primary = "res_artikel_key";
this.records_name = "res_artikels";
this.record_name = "res_artikel";
this.soft_delete = "res_artikel_verwijder";
this.soft_expire = "res_artikel_vervaldatum";
this.autfunction = "WEB_RESMSU";
this.record_title = L("res_artikel");
this.records_title = L("res_artikel_m");
this.fields = {
@@ -143,39 +148,10 @@ function model_res_artikel()
}
};
this.list = {
"columns": [
"id",
"res_discipline_key",
"name",
"code",
"res_artikel_eenheid",
"res_artikel_prijs",
"res_artikel_prijs_vast",
"res_artikel_inkoopprijs",
"res_artikel_groep",
"res_artikel_kostenpersoneel",
"res_artikel_kostenalgemeen",
"res_artikel_volgnummer",
"res_artikel_vervaldatum"
]
};
this.search = {
"autosearch": true,
"filters": [
"res_discipline_key",
"name"
]
};
this.soft_delete = "res_artikel_verwijder";
this.autfunction = "WEB_RESMSU";
this.record_title = L("res_artikel");
this.records_title = L("res_artikel_m");
this.REST_GET = generic_REST_GET(this, this.gparams);
this.REST_GET = generic_REST_GET(this);
this.REST_POST = generic_REST_POST(this);
this.REST_PUT = generic_REST_PUT(this);
this.REST_DELETE = generic_REST_DELETE(this, {});
this.REST_DELETE = generic_REST_DELETE(this);
}
%>

View File

@@ -19,6 +19,11 @@ function model_res_deel()
this.primary = "res_deel_key";
this.records_name = "res_deels";
this.record_name = "res_deel";
this.soft_delete = "res_deel_verwijder";
this.soft_expire = "res_deel_vervaldatum";
this.autfunction = "WEB_RESMSU";
this.record_title = L("res_deel");
this.records_title = L("res_deel_m");
this.fields = {
@@ -41,7 +46,6 @@ function model_res_deel()
"desc": "ins_deel_omschrijving"
},
"filter": "exact"
},
"name": {
"dbs": "res_deel_omschrijving",
@@ -119,35 +123,9 @@ function model_res_deel()
};
this.list = {
"columns": [
"id",
"res_ins_deel_key",
"name",
"res_discipline_key",
"res_deel_eenheid",
"res_deel_prijs",
"res_deel_prijs_vast",
"res_deel_alg_level"
]
};
this.search = {
"autosearch": true,
"filters": [
"res_discipline_key",
"name"]
};
this.soft_delete = "res_deel_verwijder";
this.autfunction = "WEB_RESMSU";
this.record_title = L("res_deel");
this.records_title = L("res_deel_m");
this.edit = {};
this.REST_GET = generic_REST_GET(this, this.gparams);
this.REST_GET = generic_REST_GET(this);
this.REST_POST = generic_REST_POST(this);
this.REST_PUT = generic_REST_PUT(this);
this.REST_DELETE = generic_REST_DELETE(this, {});
this.REST_DELETE = generic_REST_DELETE(this);
}
%>

View File

@@ -22,6 +22,11 @@ function model_res_ruimte()
this.primary = "res_ruimte_key";
this.records_name = "res_ruimtes";
this.record_name = "res_ruimte";
this.soft_delete = "res_ruimte_verwijder";
this.soft_expire = "res_ruimte_vervaldatum";
this.autfunction = "WEB_RESMSU";
this.record_title = L("res_v_aanwezigruimte");
this.records_title = L("res_v_aanwezigruimte_m");
this.fields = {
"id": {
@@ -206,11 +211,6 @@ function model_res_ruimte()
"label": L("res_ruimte_vervaldatum"),
"typ": "date"
},
"res_ruimte_vervaldatum": {
"dbs": "res_ruimte_vervaldatum",
"label": L("res_ruimte_vervaldatum"),
"typ": "date"
},
"res_ruimte_extern_id": {
"dbs": "res_ruimte_extern_id",
"label": L("res_ruimte_extern_id"),
@@ -223,34 +223,6 @@ function model_res_ruimte()
if (!authparams)
this.fields.res_ruimte_extern_id.readonly = true;
this.list = {
"columns": [
"id",
"locatiekey",
"name",
"description",
"catalog",
"configurations.res_opstelling_key",
"rooms.ruimtekey"
]
};
this.search = {
"filters": [
"name",
"description",
"locatiekey",
"catalog",
"configurations.res_opstelling_key"
]
};
this.soft_delete = "res_ruimte_verwijder";
this.autfunction = "WEB_RESMSU";
this.record_title = L("res_v_aanwezigruimte");
this.records_title = L("res_v_aanwezigruimte_m");
this.show = {};
this.edit = {};
this.includes = {
"rooms": {
"model": new model_res_alg_ruimte(),

View File

@@ -4,10 +4,33 @@
<!-- #include file="../api2/model_res_artikel.inc" -->
<%
scaffolding(new model_res_artikel(),
{
"search": {
autosearch: true
}
});
var this_model = new model_res_artikel();
scaffolding(this_model,
{
"search": {
"autosearch": true,
"filters": [
"res_discipline_key",
"name"
]
},
"list": {
"columns": [
"id",
"res_discipline_key",
"name",
"code",
"res_artikel_eenheid",
"res_artikel_prijs",
"res_artikel_prijs_vast",
"res_artikel_inkoopprijs",
"res_artikel_groep",
"res_artikel_kostenpersoneel",
"res_artikel_kostenalgemeen",
"res_artikel_volgnummer",
"res_artikel_vervaldatum"
]
}
});
%>

View File

@@ -14,16 +14,33 @@ res_deelmodel.hook_pre_edit = function (obj, fld)
<%
}
if (mode == "list")
res_deelmodel.REST_POST = false;
if (mode == "list")
res_deelmodel.REST_POST = false;
scaffolding(res_deelmodel,
{
"search": {
autosearch: true
},
"edit": {
requires: { js: ["../mgt/res_deel.js"]}
}
});
scaffolding(res_deelmodel,
{
"search": {
"autosearch": true,
"filters": [
"res_discipline_key",
"name"]
},
"list": {
"columns": [
"id",
"res_ins_deel_key",
"name",
"res_discipline_key",
"res_deel_eenheid",
"res_deel_prijs",
"res_deel_prijs_vast",
"res_deel_alg_level"
]
},
"edit": {
"requires": {
"js": ["../mgt/res_deel.js"]
}
}
});
%>

View File

@@ -4,22 +4,46 @@
<!-- #include file="../api2/model_res_ruimte.inc" -->
<%
var url = "appl/shared/BijlagenForm.asp?module=RESPH";
var proturl = protectQS.create(url);
var fotoaction = "FcltMgr.openDetail('" + safe.jsstring(proturl) + "', L(\"lcl_photos\"))";
var url = "appl/shared/BijlagenForm.asp?module=RESPH";
var proturl = protectQS.create(url);
var fotoaction = "FcltMgr.openDetail('" + safe.jsstring(proturl) + "', L(\"lcl_photos\"))";
scaffolding(new model_res_ruimte(),
var this_model = new model_res_ruimte();
scaffolding(this_model,
{
"search": {
autosearch: false
},
"show": {
js: ["./mgt_tools.js"],
buttons: [{ title: L("lcl_photos"), action: safe.htmlattr(fotoaction), icon: "folder.png" }]
},
"edit": {
js: ["./mgt_tools.js"],
buttons: [{ title: L("lcl_photos"), action: safe.htmlattr(fotoaction), icon: "folder.png" }]
}
});
"autosearch": false,
"filters": [
"name",
"description",
"locatiekey",
"catalog",
"configurations.res_opstelling_key"
]
},
"list": {
"columns": [
"id",
"locatiekey",
"name",
"description",
"catalog",
"configurations.res_opstelling_key",
"rooms.ruimtekey"
]
},
"show": {
"js": ["./mgt_tools.js"],
"buttons": [
{ title: L("lcl_photos"), action: safe.htmlattr(fotoaction), icon: "folder.png" }
]
},
"edit": {
"js": ["./mgt_tools.js"],
"buttons": [
{ title: L("lcl_photos"), action: safe.htmlattr(fotoaction), icon: "folder.png" }
]
}
});
%>

View File

@@ -114,12 +114,14 @@ function scaffolding_edit(model, scf_params)
var field = model.fields[fld];
if (field.uniquewith)
{
var where = "{0} NOT IN (SELECT {1} FROM {2} WHERE {3} = {4} {5})".format(field.foreign.key,
var where = "{0} NOT IN (SELECT {1} FROM {2} WHERE {3} = {4} {5} {6})".format(field.foreign.key,
field.dbs,
model.table,
filter[field.uniquewith],
model.fields[field.uniquewith].dbs,
model.soft_delete?" AND " + model.soft_delete + " IS NULL":"")
model.soft_delete?" AND " + model.soft_delete + " IS NULL":"",
model.soft_expire?" AND(" + model.soft_expire + " IS NULL OR " + model.soft_expire + " > SYSDATE)":""
)
field.foreign.where = (field.foreign.where?field.foreign.where + " AND ":"") + where;
}
}

View File

@@ -214,6 +214,8 @@ function scaffolding_search(model, scf_params)
}
if (model.soft_delete)
RWCHECKBOXTR("show_deleted", "fldcheck", L("lcl_scf_show_deleted"), defaults["show_deleted"]);
if (model.soft_expire)
RWCHECKBOXTR("show_expired", "fldcheck", L("lcl_scf_show_expired"), defaults["show_expired"]);
if (model.includes)
{