FSN#36227 fac_srtnotificatie bewerkbaar via scaffolding

svn path=/Website/trunk/; revision=29358
This commit is contained in:
Erik Groener
2016-05-11 10:34:17 +00:00
parent fa88ff69ff
commit 0e4e3e6646
2 changed files with 29 additions and 32 deletions

View File

@@ -13,7 +13,7 @@
%>
<%
function model_fac_srtnotificatie()
function model_fac_srtnotificatie(cust)
{
this.table = "fac_srtnotificatie";
this.primary = "fac_srtnotificatie_key";
@@ -29,13 +29,14 @@ function model_fac_srtnotificatie()
"label": "Key",
"typ": "key",
"required": true,
"seq": "fac_s_fac_srtnotificatie_key",
"filter": "exact"
},
"name": {
"dbs": "fac_srtnotificatie_code",
"label": L("fac_srtnotificatie_code"),
"typ": "varchar",
"insertonly": true
"readonly": true
},
"description": {
"dbs": "fac_srtnotificatie_oms",
@@ -48,7 +49,7 @@ function model_fac_srtnotificatie()
"dbs": "fac_srtnotificatie_xmlnode",
"label": L("fac_srtnotificatie_xmlnode"),
"typ": "varchar",
"insertonly": true,
"readonly": true,
"LOV": fill_srtnotificatie_LOV(),
"emptyoption": null
},
@@ -56,14 +57,14 @@ function model_fac_srtnotificatie()
"dbs": "fac_srtnotificatie_url",
"label": L("fac_srtnotificatie_url"),
"typ": "varchar",
"insertonly": true,
"readonly": true,
"defaultvalue": "1"
},
"group": {
"dbs": "fac_srtnotificatie_groep",
"label": L("fac_srtnotificatie_groep"),
"typ": "varchar",
"insertonly": true
"readonly": true
},
"notification_mode": {
"dbs": "fac_srtnotificatie_mode",
@@ -160,16 +161,28 @@ function model_fac_srtnotificatie()
+ " , DECODE(BITAND(fac_srtnotificatie_mode, 8), 8,"+ safe.qL("lcl_on") +", '') portal"
+ " FROM fac_srtnotificatie) notimode ";
var get_param = {
"GET": {
"tables": [ext_sql],
"wheres": ["fac_srtnotificatie.fac_srtnotificatie_key = notimode.fac_srtnotificatie_key"]
}
};
this.REST_GET = generic_REST_GET(this, {
"GET": {
"tables": [ext_sql],
"wheres": ["fac_srtnotificatie.fac_srtnotificatie_key = notimode.fac_srtnotificatie_key"]
}
});
this.REST_POST = generic_REST_POST(this);
if (cust==1 && user.has("WEB_FACTAB"))
{
// Een gebruiker met WEB_FACTAB-rechten mag meer velden wijzigen...
this.fields.name.readonly = false;
this.fields.xmlnode.readonly = false;
this.fields.notification_url.readonly = false;
this.fields.group.readonly = false;
get_param.GET.wheres.push("UPPER(SUBSTR(fac_srtnotificatie_code, 1, 4)) = 'CUST' ");
this.REST_POST = generic_REST_POST(this); // ... ook toevoegen...
this.REST_DELETE = generic_REST_DELETE(this); // en verwijderen.
}
this.REST_GET = generic_REST_GET(this, get_param);
this.REST_PUT = generic_REST_PUT(this);
// Met alleen WEB_PRSSYS rechten is verwijderen niet toegestaan.
function fnshowusermode(oRs)

View File

@@ -16,30 +16,14 @@
<!-- #include file="../api2/model_fac_srtnotificatie.inc" -->
<%
var iscust = getQParamInt("cust", 0);
var this_model = new model_fac_srtnotificatie();
if (iscust==1 && user.has("WEB_FACTAB"))
{
// Een gebruiker met WEB_FACTAB-rechten mag meer.
this_model.fields.name.insertonly = false;
this_model.fields.xmlnode.insertonly = false;
this_model.fields.notification_url.insertonly = false;
this_model.fields.group.insertonly = false;
this_model.fields.id.seq = "fac_s_fac_srtnotificatie_key"; // Ook toevoegen..
this_model.REST_DELETE = generic_REST_DELETE(this_model); // en verwijderen.
// POST en PUT opnieuw initialiseren. Anders kun je niet toevoegen.
this_model.REST_POST = generic_REST_POST(this_model);
this_model.REST_PUT = generic_REST_PUT(this_model);
this_model.gparams.GET.wheres.push("UPPER(SUBSTR(fac_srtnotificatie_code, 1, 4)) = 'CUST' ");
}
var this_model = new model_fac_srtnotificatie(iscust);
this_model.hook_pre_edit = function (obj, fld)
{
// Voorlopig mag alleen voor meldingen en opdrachten het vinkje 'E-mail sturen naar gebouw'
// gezet worden
if (!inArray(obj.name.substring(0,3), ["MLD", "ORD"]))
fld.mail_building.readonly = true;
if (iscust== 1 || !inArray(obj.name.substring(0,3), ["MLD", "ORD"]))
fld.mail_building.readonly = true;
}
scaffolding(this_model,