jsharmony 1.15.2 → 1.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jsHarmony.LoadModels.js
CHANGED
|
@@ -1635,7 +1635,7 @@ exports.ParseEntities = function () {
|
|
|
1635
1635
|
if (field.sql_to_db) field.sql_to_db = _this.parseFieldExpression(field, field.sql_to_db, {}, { ejs:true });
|
|
1636
1636
|
if (field.sqlsort) field.sqlsort = _this.parseFieldExpression(field, field.sqlsort, {}, { ejs:true });
|
|
1637
1637
|
if (field.sqlsearch) field.sqlsearch = _this.parseFieldExpression(field, field.sqlsearch, {}, { ejs:true });
|
|
1638
|
-
if (field.sqlsearch_to_db) field.
|
|
1638
|
+
if (field.sqlsearch_to_db) field.sqlsearch_to_db = _this.parseFieldExpression(field, field.sqlsearch_to_db, {}, { ejs:true });
|
|
1639
1639
|
var has_datatype_validator = false;
|
|
1640
1640
|
if (field.datatype_config){
|
|
1641
1641
|
if(field.datatype_config.override_length){
|
|
@@ -1755,10 +1755,10 @@ exports.ParseEntities = function () {
|
|
|
1755
1755
|
}
|
|
1756
1756
|
|
|
1757
1757
|
//Convert mutli-line variables to single string
|
|
1758
|
-
ParseMultiLineProperties(model, ['js', 'jslib', 'sqlselect', 'sqldownloadselect', 'sqlinsert', 'sqlinsertencrypt', 'sqlupdate', 'sqldelete', 'sqlexec', 'sqlwhere', 'sqlgetinsertkeys', 'ongetfilename', 'oninit', 'onload', 'onloadimmediate', 'oninsert', 'onvalidate', 'onupdate', 'ondestroy', 'oncommit', 'onchange']);
|
|
1758
|
+
ParseMultiLineProperties(model, ['js', 'jslib', 'sqlselect', 'sqldownloadselect', 'sqlrowcount', 'sqlinsert', 'sqlinsertencrypt', 'sqlupdate', 'sqldelete', 'sqlexec', 'sqlwhere', 'sqlgetinsertkeys', 'ongetfilename', 'oninit', 'onload', 'onloadimmediate', 'oninsert', 'onvalidate', 'onupdate', 'ondestroy', 'oncommit', 'onchange']);
|
|
1759
1759
|
if (model.breadcrumbs) ParseMultiLineProperties(model.breadcrumbs, ['sql']);
|
|
1760
1760
|
if (model.fields) _.each(model.fields, function (field) {
|
|
1761
|
-
ParseMultiLineProperties(field, ['onchange', 'sqlselect', 'sqlupdate', 'sqlinsert', 'sqlwhere', 'sqlsort', 'sqlsearch', 'sqlsearchsound', 'value']);
|
|
1761
|
+
ParseMultiLineProperties(field, ['onclick','onchange', 'sqlselect', 'sqlupdate', 'sqlinsert', 'sqlwhere', 'sqlsort', 'sqlsearch', 'sqlsearchsound', 'value']);
|
|
1762
1762
|
if (field.lov) ParseMultiLineProperties(field.lov, ['sql', 'sql2', 'sqlmp', 'sqlselect']);
|
|
1763
1763
|
if (field.controlparams) ParseMultiLineProperties(field.controlparams, ['onpopup']);
|
|
1764
1764
|
});
|
|
@@ -1923,7 +1923,7 @@ exports.ParseEntities = function () {
|
|
|
1923
1923
|
'grid_require_search', 'default_search', 'grid_static', 'rowstyle', 'rowclass', 'rowlimit', 'disableautoload',
|
|
1924
1924
|
'oninit', 'oncommit', 'onload', 'oninsert', 'onupdate', 'onvalidate', 'onloadstate', 'ongetstate', 'onrowbind', 'onrowunbind', 'ondestroy', 'onchange', 'getapi', 'onrender', 'onrendered', 'onsqlinserted', 'onsqlupdated', 'onsqldeleted', 'disable_csv_export',
|
|
1925
1925
|
'js', 'jslib', 'ejs', 'header', 'css', 'dberrors', 'tablestyle', 'tableclass', 'formstyle', 'formclass', 'popup', 'ongetfilename', 'onloadimmediate', 'sqlwhere', 'sqlwhere_disabled_on_insert', 'breadcrumbs', 'tabpos', 'tabs', 'tabpanelstyle',
|
|
1926
|
-
'nokey', 'nodatalock', 'unbound', 'duplicate', 'sqlselect', 'sqlupdate', 'sqlinsert', 'sqlgetinsertkeys', 'sqldelete', 'sqlexec', 'sqlexec_comment', 'sqltype', 'onroute', 'tabcode', 'noresultsmessage', 'bindings',
|
|
1926
|
+
'nokey', 'nodatalock', 'unbound', 'duplicate', 'sqlselect', 'sqlupdate', 'sqlinsert', 'sqlinsertencrypt', 'sqlgetinsertkeys', 'sqldelete', 'sqlexec', 'sqlexec_comment', 'sqlrowcount', 'sqldownloadselect', 'sqltype', 'onroute', 'tabcode', 'noresultsmessage', 'bindings',
|
|
1927
1927
|
'path', 'module', 'templates', 'db', 'onecolumn', 'namespace',
|
|
1928
1928
|
//Report Parameters
|
|
1929
1929
|
'subheader', 'footerheight', 'headeradd',
|
package/jsHarmony.js
CHANGED
|
@@ -141,7 +141,7 @@ jsHarmony.prototype.Init = function(init_cb){
|
|
|
141
141
|
//Load Configuration Files from modules
|
|
142
142
|
var modeldirs = _this.getModelDirs();
|
|
143
143
|
for (var i = 0; i < modeldirs.length; i++) {
|
|
144
|
-
_this.Config.LoadJSONConfigFolder(_this, path.normalize(modeldirs[i].path
|
|
144
|
+
_this.Config.LoadJSONConfigFolder(_this, path.normalize(modeldirs[i].path), _this.Modules[modeldirs[i].module]);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
//Create Required Folders
|
package/jsHarmonyConfig.js
CHANGED
|
@@ -44,9 +44,15 @@ jsHarmonyConfigBase.prototype.Init = function(cb){
|
|
|
44
44
|
if(cb) return cb();
|
|
45
45
|
};
|
|
46
46
|
//Merge target configuration with existing
|
|
47
|
-
jsHarmonyConfigBase.prototype.Merge = function(config, jsh, sourceModuleName){
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
jsHarmonyConfigBase.prototype.Merge = function(config, jsh, sourceModuleName, handlers){
|
|
48
|
+
if(!handlers) handlers = {};
|
|
49
|
+
for(var prop in config){
|
|
50
|
+
if(!(prop in this)) this[prop] = config[prop];
|
|
51
|
+
else if(prop in handlers) handlers[prop](this, config);
|
|
52
|
+
else if(_.isArray(this[prop]) && _.isArray(config[prop])){ for(var j = 0;j<config[prop].length;j++) this[prop].push(config[prop][j]); }
|
|
53
|
+
else if(_.isObject(this[prop])) _.merge(this[prop], config[prop]);
|
|
54
|
+
else this[prop] = config[prop];
|
|
55
|
+
}
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
/////////////////
|
|
@@ -442,8 +448,8 @@ jsHarmonyConfig.prototype.LoadJSONConfigFolder = function(jsh, fpath, sourceModu
|
|
|
442
448
|
var _this = this;
|
|
443
449
|
|
|
444
450
|
//Include appropriate config file based on Path
|
|
445
|
-
if(!fpath) fpath = jsh.Config.appbasepath;
|
|
446
|
-
if(!fpath) fpath = path.dirname(require.main.filename);
|
|
451
|
+
if(!fpath && jsh.Config.appbasepath) fpath = path.join(jsh.Config.appbasepath, 'models');
|
|
452
|
+
if(!fpath) fpath = path.join(path.dirname(require.main.filename), 'models');
|
|
447
453
|
else if(fpath.substr(fpath.length-1,1)=='/') fpath = fpath.substr(0,fpath.length-1);
|
|
448
454
|
|
|
449
455
|
//Create array of application path
|
|
@@ -454,7 +460,6 @@ jsHarmonyConfig.prototype.LoadJSONConfigFolder = function(jsh, fpath, sourceModu
|
|
|
454
460
|
patharr.unshift(fbasename);
|
|
455
461
|
fbasepath = path.dirname(fbasepath);
|
|
456
462
|
}
|
|
457
|
-
fpath += '/models';
|
|
458
463
|
//Load app.config.js
|
|
459
464
|
this.LoadJSONConfigFile(jsh, fpath + '/_config.json', sourceModule);
|
|
460
465
|
//Load app.config.local.js
|
package/package.json
CHANGED
|
@@ -63,14 +63,17 @@
|
|
|
63
63
|
},
|
|
64
64
|
"date":{
|
|
65
65
|
"sql_from_db": "CHAR(%%%SQL%%%, ISO)",
|
|
66
|
+
"sqlsearch": "CAST(%%%SQL%%% AS DATE)",
|
|
66
67
|
"sqlsearch_to_db": "CAST(%%%SQL%%% AS DATE)"
|
|
67
68
|
},
|
|
68
69
|
"time":{
|
|
69
70
|
"sql_from_db": "CHAR(%%%SQL%%%, ISO)",
|
|
71
|
+
"sqlsearch": "CAST(%%%SQL%%% AS TIME)",
|
|
70
72
|
"sqlsearch_to_db": "CAST(%%%SQL%%% AS TIME)"
|
|
71
73
|
},
|
|
72
74
|
"timestamp":{
|
|
73
75
|
"sql_from_db": "REGEXP_REPLACE(CHAR(%%%SQL%%%), '-(\\d\\d)\\.(\\d\\d)\\.(\\d\\d)\\.', ' $1:$2:$3.')",
|
|
76
|
+
"sqlsearch": "CAST(%%%SQL%%% AS TIMESTAMP)",
|
|
74
77
|
"sqlsearch_to_db": "CAST(%%%SQL%%% AS TIMESTAMP)",
|
|
75
78
|
"type": "datetime"
|
|
76
79
|
},
|
package/sql/datatypes.mssql.json
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"bit":{ "type": "boolean" },
|
|
13
13
|
"decimal":{
|
|
14
14
|
"sql_from_db": "cast(%%%SQL%%% as nvarchar)",
|
|
15
|
-
"sqlsearch": "%%%SQL%%%",
|
|
16
15
|
"sqlsort": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
17
16
|
"sql_to_db": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
17
|
+
"sqlsearch": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
18
18
|
"sqlsearch_to_db": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
19
19
|
"datatype_config": {
|
|
20
20
|
"defaults":{ "PREC_H": 38, "PREC_L": 10 }
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"float":{
|
|
24
24
|
"sql_from_db": "convert(varchar(50), %%%SQL%%%, 3)",
|
|
25
|
-
"sqlsearch": "%%%SQL%%%",
|
|
26
25
|
"sqlsort": "cast(%%%SQL%%% as float(%%%PREC%%%))",
|
|
27
26
|
"sql_to_db": "cast(%%%SQL%%% as float(%%%PREC%%%))",
|
|
27
|
+
"sqlsearch": "cast(%%%SQL%%% as float(%%%PREC%%%))",
|
|
28
28
|
"sqlsearch_to_db": "cast(%%%SQL%%% as float(%%%PREC%%%))",
|
|
29
29
|
"datatype_config": {
|
|
30
30
|
"defaults":{ "PREC": 53 }
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
},
|
|
37
37
|
"money":{
|
|
38
38
|
"sql_from_db": "cast(%%%SQL%%% as nvarchar)",
|
|
39
|
-
"sqlsearch": "%%%SQL%%%",
|
|
40
39
|
"sqlsort": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
41
40
|
"sql_to_db": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
41
|
+
"sqlsearch": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
42
42
|
"sqlsearch_to_db": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
43
43
|
"datatype_config": {
|
|
44
44
|
"defaults":{ "PREC_H": 19, "PREC_L": 4 }
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
},
|
|
52
52
|
"smallmoney":{
|
|
53
53
|
"sql_from_db": "cast(%%%SQL%%% as nvarchar)",
|
|
54
|
-
"sqlsearch": "%%%SQL%%%",
|
|
55
54
|
"sqlsort": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
56
55
|
"sql_to_db": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
56
|
+
"sqlsearch": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
57
57
|
"sqlsearch_to_db": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
58
58
|
"datatype_config": {
|
|
59
59
|
"defaults":{ "PREC_H": 10, "PREC_L": 4 }
|
package/sql/datatypes.pgsql.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"decimal":{
|
|
14
14
|
"sql_from_db": "cast(%%%SQL%%% as varchar)",
|
|
15
|
-
"sqlsearch": "%%%SQL%%%",
|
|
15
|
+
"sqlsearch": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
16
16
|
"sqlsearch_to_db": "cast(%%%SQL%%% as decimal(%%%PREC_H%%%,%%%PREC_L%%%))",
|
|
17
17
|
"datatype_config":{
|
|
18
18
|
"defaults":{ "PREC_H": 38, "PREC_L": 10 }
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"double precision":{
|
|
27
27
|
"sql_from_db": "cast(%%%SQL%%% as varchar(50))",
|
|
28
|
-
"sqlsearch": "%%%SQL%%%",
|
|
28
|
+
"sqlsearch": "cast(%%%SQL%%% as float(%%%PREC%%%))",
|
|
29
29
|
"sqlsearch_to_db": "cast(%%%SQL%%% as float(%%%PREC%%%))",
|
|
30
30
|
"datatype_config":{
|
|
31
31
|
"defaults":{ "PREC": 53 }
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"integer":{ "type": "int" },
|
|
3
3
|
"decimal":{
|
|
4
4
|
"sql_from_db": "%%%SQL%%%",
|
|
5
|
-
"sqlsearch": "%%%SQL%%%",
|
|
5
|
+
"sqlsearch": "cast(%%%SQL%%% as real)",
|
|
6
6
|
"sqlsearch_to_db": "cast(%%%SQL%%% as real)"
|
|
7
7
|
},
|
|
8
8
|
"real":{
|
|
9
9
|
"sql_from_db": "%%%SQL%%%",
|
|
10
|
-
"sqlsearch": "%%%SQL%%%",
|
|
10
|
+
"sqlsearch": "cast(%%%SQL%%% as real)",
|
|
11
11
|
"sqlsearch_to_db": "cast(%%%SQL%%% as real)",
|
|
12
12
|
"datatype_config":{
|
|
13
13
|
"defaults":{ "PREC": 53 }
|
|
@@ -16,14 +16,17 @@
|
|
|
16
16
|
},
|
|
17
17
|
"time":{
|
|
18
18
|
"sql_from_db": "strftime('1970-01-01T%H:%M:%f',%%%SQL%%%)",
|
|
19
|
+
"sqlsearch": "strftime('1970-01-01T%H:%M:%f',%%%SQL%%%)",
|
|
19
20
|
"sqlsearch_to_db": "strftime('1970-01-01T%H:%M:%f',%%%SQL%%%)"
|
|
20
21
|
},
|
|
21
22
|
"date":{
|
|
22
23
|
"sql_from_db": "strftime('%Y-%m-%dT00:00:00',%%%SQL%%%)",
|
|
24
|
+
"sqlsearch": "strftime('%Y-%m-%dT00:00:00',%%%SQL%%%)",
|
|
23
25
|
"sqlsearch_to_db": "strftime('%Y-%m-%dT00:00:00',%%%SQL%%%)"
|
|
24
26
|
},
|
|
25
27
|
"datetime":{
|
|
26
28
|
"sql_from_db": "strftime('%Y-%m-%dT%H:%M:%f',%%%SQL%%%)",
|
|
29
|
+
"sqlsearch": "strftime('%Y-%m-%dT%H:%M:%f',%%%SQL%%%)",
|
|
27
30
|
"sqlsearch_to_db": "strftime('%Y-%m-%dT%H:%M:%f',%%%SQL%%%)"
|
|
28
31
|
},
|
|
29
32
|
"text":{ "type": "varchar" },
|