MARX#51559 Ook bijlagen bij opdrachten via API2 kunnen uploaden
Nog wel aan te scherpen svn path=/Website/branches/v2017.2/; revision=36329
This commit is contained in:
@@ -95,7 +95,8 @@ var api2_mapper = {
|
||||
"workflowsteps" : { "filename": "appl/mgt/mld_workflowstep.asp", "nodoc": true },
|
||||
"workflowexpressions" : { "filename": "appl/mgt/mld_workflow_expression.asp" },
|
||||
"issuedisciplines" : { "filename": "appl/api2/api_issuedisciplines.asp", "module": "MLD" },
|
||||
"orders" : { "filename": "appl/api2/api_orders.asp", "module": "MLD" },
|
||||
// "orders" : { "filename": "appl/api2/api_orders.asp", "module": "MLD" },
|
||||
"orders" : { "filename": "appl/bgt/mld_opdr.asp", "module": "MLD" },
|
||||
"issues" : { "filename": "appl/api2/api_issues.asp", "module": "MLD" },
|
||||
"issuetypes" : { "filename": "appl/api2/api_issuetypes.asp", "module": "MLD" },
|
||||
"pinboardcategories" : { "filename": "appl/mgt/mrk_discipline.asp" },
|
||||
|
||||
@@ -164,8 +164,10 @@ api2_rest = {
|
||||
var filter = shared.qs2json(model);
|
||||
filter = api2_rest.plugin.transform_filter(filter);
|
||||
var requestparams = { filter: filter, include: getQParamArray("include", []) };
|
||||
if (filter.mode == "attachment" && !("includes" in model && "custom_fields" in model.includes))
|
||||
api2.error(400, "Attachment not supported for this model");
|
||||
|
||||
if (filter.mode == "attachment" && "custom_fields" in model.includes)
|
||||
if (filter.mode == "attachment")
|
||||
{
|
||||
if (key > 0 && method == "POST") // het bestand mag dan wel nieuw zijn (POST is van toepassing),
|
||||
method = "PUT"; // intern is het een update van een bestaand record, dus PUT
|
||||
@@ -180,7 +182,7 @@ api2_rest = {
|
||||
|
||||
if (/PUT|POST/.test(method)) // Dan is er in de body data meegestuurd
|
||||
{
|
||||
if (filter.mode == "attachment" && "custom_fields" in model.includes)
|
||||
if (filter.mode == "attachment")
|
||||
{
|
||||
// Body bevat application/octet-stream, dat lezen we later wel uit
|
||||
}
|
||||
@@ -297,7 +299,7 @@ api2_rest = {
|
||||
{
|
||||
var result = model["REST_" + method]( requestparams, key );
|
||||
}
|
||||
else if (filter.mode == "attachment" && "custom_fields" in model.includes)
|
||||
else if (filter.mode == "attachment")
|
||||
{ // GET/PUT/POST https://xxxx.facilitor.nl/api2/visitors/99685/attachments/1040/testfile.jpg" bestaande folder
|
||||
// POST https://xxxx.facilitor.nl/api2/issues/0/attachments/1040/testfile.jpg" nieuw object, maakt TEMP aan
|
||||
if (wasCodePage != 65001)
|
||||
@@ -879,7 +881,7 @@ api2_rest = {
|
||||
error_handler: function(code, msg, orgHandler)
|
||||
{
|
||||
var hook = api2_rest.find_plugin();
|
||||
if ("error_handler" in hook)
|
||||
if ("error_handler" in hook)
|
||||
outdata = hook.error_handler(code, msg, orgHandler);
|
||||
else
|
||||
outdata = orgHandler(code, msg);
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="../api2/model_fin_factuur.inc" -->
|
||||
<!-- #include file="./model_custom_fields.inc"-->
|
||||
<!-- #include file="./model_mld_kenmerk.inc"-->
|
||||
<%
|
||||
|
||||
function model_mld_opdr()
|
||||
@@ -20,7 +22,7 @@ function model_mld_opdr()
|
||||
this.record_name = "order";
|
||||
this.table = "mld_opdr";
|
||||
this.primary = "mld_opdr_key";
|
||||
this.autfunction = "WEB_BGTORD";
|
||||
this.autfunction = S("bgt_enabled")==1?"WEB_BGTORD":"WEB_ORDBOF";
|
||||
this.record_title = L("lcl_fin_mld_opdr");
|
||||
this.records_title = L("lcl_fin_opdrachten");
|
||||
|
||||
@@ -223,6 +225,13 @@ function model_mld_opdr()
|
||||
}
|
||||
};
|
||||
|
||||
this.includes= {
|
||||
"custom_fields" : {
|
||||
"model": new model_custom_fields(this, new model_mld_kenmerk('O', { internal: true }), { pNiveau: "O" }),
|
||||
"joinfield": "flexparentkey",
|
||||
"enable_update": true
|
||||
}
|
||||
}
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user