|
290 | 290 |
|
291 | 291 | if (id === 'system.config') { |
292 | 292 | // set langugae for debug messages |
293 | | - if (objects['system.config'].common.language) words.setLanguage(objects['system.config'].common.language); |
| 293 | + if (objects['system.config'].common && objects['system.config'].common.language) { |
| 294 | + words.setLanguage(objects['system.config'].common.language); |
| 295 | + } |
294 | 296 | } |
295 | 297 |
|
296 | 298 | return; |
|
2697 | 2699 | script.onStopTimeout = timeout || 1000; |
2698 | 2700 | }, |
2699 | 2701 | formatValue: function (value, decimals, format) { |
2700 | | - if (!format && objects['system.config']) { |
2701 | | - format = objects['system.config'].common.isFloatComma ? '.,' : ',.'; |
| 2702 | + if (!format) { |
| 2703 | + if (adapter.isFloatComma !== undefined) { |
| 2704 | + format = adapter.isFloatComm ? '.,' : ',.'; |
| 2705 | + } else if (objects['system.config'] && objects['system.config'].common) { |
| 2706 | + format = objects['system.config'].common.isFloatComma ? '.,' : ',.'; |
| 2707 | + } |
2702 | 2708 | } |
2703 | 2709 | return adapter.formatValue(value, decimals, format); |
2704 | 2710 | }, |
2705 | 2711 |
|
2706 | 2712 | formatDate: function (date, format, language) { |
2707 | 2713 | if (!format) { |
2708 | | - format = objects['system.config'] ? (objects['system.config'].common.dateFormat || 'DD.MM.YYYY') : 'DD.MM.YYYY'; |
| 2714 | + if (adapter.dateFormat) { |
| 2715 | + format = adapter.dateFormat; |
| 2716 | + } else if (objects['system.config'] && objects['system.config'].common) { |
| 2717 | + format = objects['system.config'] ? (objects['system.config'].common.dateFormat || 'DD.MM.YYYY') : 'DD.MM.YYYY'; |
| 2718 | + } |
| 2719 | + format = format || 'DD.MM.YYYY'; |
2709 | 2720 | } |
2710 | 2721 | if (format.match(/W|Н|O|О/)) { |
2711 | 2722 | var text = adapter.formatDate(date, format); |
2712 | | - if (!language || !dayOfWeeksFull[language]) language = objects['system.config'].common.language; |
| 2723 | + if (!language || !dayOfWeeksFull[language]) { |
| 2724 | + if (adapter.language) { |
| 2725 | + language = adapter.language; |
| 2726 | + } else { |
| 2727 | + language = objects['system.config'] && objects['system.config'].common && objects['system.config'].common.language; |
| 2728 | + } |
| 2729 | + if (!dayOfWeeksFull[language]) { |
| 2730 | + language = 'de'; |
| 2731 | + } |
| 2732 | + } |
2713 | 2733 | var d = date.getDay(); |
2714 | 2734 | text = text.replace('WW', dayOfWeeksFull[language][d]); |
2715 | 2735 | text = text.replace('НН', dayOfWeeksFull[language][d]); |
|
2826 | 2846 | var timeoutMs = parseInt(options.timeout, 10) || 20000; |
2827 | 2847 |
|
2828 | 2848 | if (!instance) { |
2829 | | - instance = objects['system.config'] ? objects['system.config'].common.defaultHistory : null; |
| 2849 | + if (adapter.defaultHistory) { |
| 2850 | + instance = adapter.defaultHistory; |
| 2851 | + } else { |
| 2852 | + instance = objects['system.config'] && objects['system.config'].common ? objects['system.config'].common.defaultHistory : null; |
| 2853 | + } |
2830 | 2854 | } |
2831 | 2855 |
|
2832 | 2856 | if (sandbox.verbose) sandbox.log('getHistory(instance=' + instance + ', options=' + JSON.stringify(options) + ')', 'debug'); |
|
3327 | 3351 | } |
3328 | 3352 | addGetProperty(objects); |
3329 | 3353 |
|
| 3354 | + var systemConfig = objects['system.config']; |
| 3355 | + |
3330 | 3356 | // set language for debug messages |
3331 | | - if (objects['system.config'] && objects['system.config'].common.language) words.setLanguage(objects['system.config'].common.language); |
| 3357 | + if (systemConfig && systemConfig.common && systemConfig.common.language) { |
| 3358 | + words.setLanguage(systemConfig.common.language); |
| 3359 | + } else if (adapter.language) { |
| 3360 | + words.setLanguage(adapter.language); |
| 3361 | + } |
3332 | 3362 |
|
3333 | 3363 | // try to use system coordinates |
3334 | | - if (adapter.config.useSystemGPS && objects['system.config'] && |
3335 | | - objects['system.config'].common.latitude) { |
3336 | | - adapter.config.latitude = objects['system.config'].common.latitude; |
3337 | | - adapter.config.longitude = objects['system.config'].common.longitude; |
| 3364 | + if (adapter.config.useSystemGPS) { |
| 3365 | + if (systemConfig && systemConfig.common && systemConfig.common.latitude) { |
| 3366 | + adapter.config.latitude = systemConfig.common.latitude; |
| 3367 | + adapter.config.longitude = systemConfig.common.longitude; |
| 3368 | + } else if (adapter.latitude) { |
| 3369 | + adapter.config.latitude = adapter.latitude; |
| 3370 | + adapter.config.longitude = adapter.longitude; |
| 3371 | + } |
3338 | 3372 | } |
3339 | 3373 | adapter.config.latitude = parseFloat(adapter.config.latitude); |
3340 | 3374 | adapter.config.longitude = parseFloat(adapter.config.longitude); |
|
0 commit comments