alsmanager_lib 3.0.146 → 3.0.149

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.
Files changed (2) hide show
  1. package/lib/modules.js +98 -27
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -3163,6 +3163,7 @@ function buildDevicesQuery(queryList) {
3163
3163
  return whereClause;
3164
3164
  }
3165
3165
 
3166
+
3166
3167
  // End Device select
3167
3168
  // Select devices by details
3168
3169
  function getDevicesByDetailsSelectSQLite(search_criteria, details) {
@@ -3182,6 +3183,29 @@ function getDevicesByDetailsSelectSQLite(search_criteria, details) {
3182
3183
  query += "left join device_gestioni dg on d.id = dg.id_device ";
3183
3184
  if (search_criteria.in_consegna)
3184
3185
  query += "left join consegna_beni cb on d.id = cb.id_bene ";
3186
+ if (details) {
3187
+ if (search_criteria.dev_type == "DESKTOP" || search_criteria.dev_type == "NOTEBOOK" || search_criteria.dev_type == "TABLET" || search_criteria.dev_type == "SMART TV" || search_criteria.dev_type == "SERVER") {
3188
+ query += "left join device_pc dd on d.id = dd.id_device ";
3189
+ }
3190
+ else if (search_criteria.dev_type == "A") {
3191
+
3192
+ }
3193
+ else if (search_criteria.dev_type == "B") {
3194
+
3195
+ }
3196
+ else if (search_criteria.dev_type == "C") {
3197
+
3198
+ }
3199
+ if (details.network || details.mac_address) {
3200
+ query += "left join device_networks dn on d.id = dn.id_device ";
3201
+ }
3202
+ if (details.storage) {
3203
+ query += "left join device_storages dr on d.id = dr.id_device ";
3204
+ }
3205
+ if (details.addon) {
3206
+ query += "left join device_addons don on d.id = don.id_device ";
3207
+ }
3208
+ }
3185
3209
 
3186
3210
  var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
3187
3211
  if (search_criteria.inv_code || search_criteria.dev_type || search_criteria.marca || search_criteria.dev_model || (search_criteria.is_PNRR && search_criteria.is_PNRR > 0) || search_criteria.dev_status || search_criteria.dev_gestione || search_criteria.no_inv || search_criteria.in_consegna) {
@@ -3250,6 +3274,66 @@ function getDevicesByDetailsSelectSQLite(search_criteria, details) {
3250
3274
  }
3251
3275
  }
3252
3276
  }
3277
+
3278
+ // Filtro su dettagli...
3279
+ if (details) {
3280
+ if (search_criteria.dev_type == "DESKTOP" || search_criteria.dev_type == "NOTEBOOK" || search_criteria.dev_type == "TABLET" || search_criteria.dev_type == "SMART TV" || search_criteria.dev_type == "SERVER") {
3281
+ where_clause += " and ";
3282
+ if (details.os) {
3283
+ where_clause += "(dd.os = '" + details.os + "') ";
3284
+ if (details.version || details.storage || details.addon || details.network || details.storage || details.mac_address || details.name) {
3285
+ where_clause += " and ";
3286
+ }
3287
+ }
3288
+ if (details.os) {
3289
+ where_clause += "(dd.version = '" + details.version + "') ";
3290
+ if (details.storage || details.addon || details.network || details.mac_address || details.name) {
3291
+ where_clause += " and ";
3292
+ }
3293
+ }
3294
+ if (details.name) {
3295
+ where_clause += "(dd.pc_name = '" + details.name + "') ";
3296
+ if (details.storage || details.addon || details.network || details.mac_address) {
3297
+ where_clause += " and ";
3298
+ }
3299
+ }
3300
+
3301
+ }
3302
+ else if (search_criteria.search_type == "MONITOR") {
3303
+
3304
+ }
3305
+ else if (search_criteria.search_type == "SWITCH") {
3306
+
3307
+ }
3308
+ else if (search_criteria.search_type == "C") {
3309
+
3310
+ }
3311
+ if (details.network) {
3312
+ where_clause += "(dn.net_type = '" + details.network + "') ";
3313
+ if (details.storage || details.addon || details.network || details.mac_address) {
3314
+ where_clause += " and ";
3315
+ }
3316
+ }
3317
+ if (details.mac_address) {
3318
+ var mac_address_clean = details.mac_address.replaceAll(":","").replaceAll("-","").trim().toLowerCase();
3319
+ if (mac_address_clean != "") {
3320
+ where_clause += "lower(trim(replace(replace(dn.mac_address, ':', ''), '-', ''))) = '" + mac_address_clean + "') ";
3321
+ if (details.storage || details.addon) {
3322
+ where_clause += " and ";
3323
+ }
3324
+ }
3325
+ }
3326
+ if (details.storage) {
3327
+ where_clause += "(dr.storage_type = '" + details.storage + "') ";
3328
+ if (details.addon) {
3329
+ where_clause += " and ";
3330
+ }
3331
+ }
3332
+ if (details.addon) {
3333
+ where_clause += "(don.addon_type = '" + details.addon + "') ";
3334
+ }
3335
+ }
3336
+ // Esclusione
3253
3337
  if (search_criteria.id_dev_exclude > 0) {
3254
3338
  where_clause += " and d.id <> " + search_criteria.id_dev_exclude;
3255
3339
  }
@@ -3275,18 +3359,27 @@ function getDevicesByDetailsSelectMySQL(search_criteria, details) {
3275
3359
  query += "left join consegna_beni cb on d.id = cb.id_bene ";
3276
3360
 
3277
3361
  if (details) {
3278
- if (search_criteria.search_type == "DESKTOP" || search_criteria.search_type == "NOTEBOOK") {
3362
+ if (search_criteria.dev_type == "DESKTOP" || search_criteria.dev_type == "NOTEBOOK" || search_criteria.dev_type == "TABLET" || search_criteria.dev_type == "SMART TV" || search_criteria.dev_type == "SERVER") {
3279
3363
  query += "left join device_pc dd on d.id = dd.id_device ";
3280
3364
  }
3281
- else if (search_criteria.search_type == "A") {
3365
+ else if (search_criteria.dev_type == "A") {
3282
3366
 
3283
3367
  }
3284
- else if (search_criteria.search_type == "B") {
3368
+ else if (search_criteria.dev_type == "B") {
3285
3369
 
3286
3370
  }
3287
- else if (search_criteria.search_type == "C") {
3371
+ else if (search_criteria.dev_type == "C") {
3288
3372
 
3289
3373
  }
3374
+ if (details.network || details.mac_address) {
3375
+ query += "left join device_networks dn on d.id = dn.id_device ";
3376
+ }
3377
+ if (details.storage) {
3378
+ query += "left join device_storages dr on d.id = dr.id_device ";
3379
+ }
3380
+ if (details.addon) {
3381
+ query += "left join device_addons don on d.id = don.id_device ";
3382
+ }
3290
3383
  }
3291
3384
 
3292
3385
  var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
@@ -3357,29 +3450,7 @@ function getDevicesByDetailsSelectMySQL(search_criteria, details) {
3357
3450
  }
3358
3451
  }
3359
3452
 
3360
- if (details) {
3361
- if (search_criteria.search_type == "DESKTOP" || search_criteria.search_type == "NOTEBOOK") {
3362
- query += "left join device_pc dd on d.id = dd.id_device ";
3363
- }
3364
- else if (search_criteria.search_type == "A") {
3365
-
3366
- }
3367
- else if (search_criteria.search_type == "B") {
3368
-
3369
- }
3370
- else if (search_criteria.search_type == "C") {
3371
-
3372
- }
3373
- if (details.network || details.mac_address) {
3374
- query += "left join device_networks dn on d.id = dn.id_device ";
3375
- }
3376
- if (details.storage) {
3377
- query += "left join device_storages dr on d.id = dr.id_device ";
3378
- }
3379
- if (details.addon) {
3380
- query += "left join device_addons don on d.id = don.id_device ";
3381
- }
3382
- }
3453
+
3383
3454
  // Filtro su dettagli...
3384
3455
  if (details) {
3385
3456
  if (search_criteria.search_type == "DESKTOP" || search_criteria.search_type == "NOTEBOOK" || search_criteria.search_type == "TABLET" || search_criteria.search_type == "SMART TV" || search_criteria.search_type == "SERVER") {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "3.0.146",
7
+ "version": "3.0.149",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",