diff --git a/APPL/API2/api2.inc b/APPL/API2/api2.inc index d6d6192d37..d990f84b85 100644 --- a/APPL/API2/api2.inc +++ b/APPL/API2/api2.inc @@ -657,6 +657,15 @@ api2 = { } else { + if (params.orderby) + { + for (var i = 0; i < params.orderby.length; i++) + { + var field = inc.model.fields[params.orderby[i]]; + if (field) + orderbys.push(inc.model.table + "." + field.dbs); + } + } // In orderbys worden de include primary keys verzameld om te sorteren // We bieden daar geen garantie op maar tijdens testen is deterministisch // gedrag wel fijn. diff --git a/APPL/API2/model_cnt_factuurschema.inc b/APPL/API2/model_cnt_factuurschema.inc new file mode 100644 index 0000000000..2b10267024 --- /dev/null +++ b/APPL/API2/model_cnt_factuurschema.inc @@ -0,0 +1,62 @@ +<% /* + $Revision$ + $Id$ + + File: model_cnt_factuurschema.inc + + Description: Model voor cnt_factuurschema + + Context: + + Notes: +*/ +%> +<% + +function model_cnt_factuurschema() +{ + this.table = "cnt_factuurschema"; + this.primary = "cnt_factuurschema_key"; + this.records_name = "cnt_factuurschemas"; + this.record_name = "cnt_factuurschema"; + this.autfunction = "WEB_CNTMGT"; + this.record_title = L("cnt_factuurschema"); + this.records_title = L("cnt_factuurschema_m"); + + this.fields = { + "id": { + "dbs": "cnt_factuurschema_key", + "label": "Key", + "typ": "key", + "required": true, + "seq": "cnt_s_cnt_factuurschema_key" + }, + "cnt_contract_key": { + "dbs": "cnt_contract_key", + "typ": "key", + "foreign": "cnt_contract", + "label": L("lcl_contract") + }, + "accountingperiod": { + "dbs": "cnt_factuurschema_boekmaand", + "typ": "varchar", + "track": true, + "label": L("lcl_fin_divide_period") + }, + "amount": { + "dbs": "cnt_factuurschema_bedrag", + "typ": "float" + }, + "description": { + "dbs": "cnt_factuurschema_opmerking", + "typ": "memo", + "label": L("cnt_factuurschema_opmerking") + } + }; + + 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); +} +%> \ No newline at end of file diff --git a/APPL/API2/model_contracts.inc b/APPL/API2/model_contracts.inc index d9fada66c0..c7145841cb 100644 --- a/APPL/API2/model_contracts.inc +++ b/APPL/API2/model_contracts.inc @@ -15,6 +15,7 @@ + <% model_contracts = @@ -47,6 +48,10 @@ model_contracts = "tracking": { model: new model_tracking(['contract']), joinfield: "fac_tracking_refkey" + }, + "schedule": { + model: new model_cnt_factuurschema(), + joinfield: "cnt_contract_key" } }, diff --git a/APPL/CNT/cnt_factuurschema.asp b/APPL/CNT/cnt_factuurschema.asp new file mode 100644 index 0000000000..45c2735535 --- /dev/null +++ b/APPL/CNT/cnt_factuurschema.asp @@ -0,0 +1,45 @@ +<%@language = "javascript" %> +<% /* + $Revision$ + $Id$ + + File: cnt_factuurschema + + Description: Aanroep voor model_cnt_factuurschema + + Context: Zal altijd aangeroepen worden met (include) model=schedule + + Notes: cnt_factuurschema is een include van cnt_contract + Daarom doen we hier ook model cnt_contract en zorgen voor + een 'include-aanroep' +*/ +%> + + + +<% +var this_model = model_contracts; + +scaffolding(this_model, + { "included": { + "schedule" : { + "list": { + "columns": [ + "id", + "cnt_contract_key", + "accountingperiod", + "amount", + "description" + ], + "orderby": [, + "cnt_contract_key", + "accountingperiod" + ] + }, + "edit": { + "modal": true + } + } + } + }); +%>