alsmanager_lib 1.0.58 → 1.0.60
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/lib/modules.js +179 -5
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -412,25 +412,27 @@ function insertNetwork(db_used, id_device, network_obj) {
|
|
|
412
412
|
}
|
|
413
413
|
function updateNetworkSQLite(id_device, network_obj) {
|
|
414
414
|
var query = "update device_networks "
|
|
415
|
-
query += "set
|
|
415
|
+
query += "set ";
|
|
416
416
|
query += "net_type = '" + network_obj.tipo + "', ";
|
|
417
417
|
query += "mac_address = '" + network_obj.mac_address + "', ";
|
|
418
418
|
query += "ipv4_static = '" + network_obj.ipv4_static + "', ";
|
|
419
419
|
query += "ipv6_static = '" + network_obj.ipv6_static + "' ";
|
|
420
|
-
query += "where id = " + network_obj.id;
|
|
420
|
+
query += "where id = " + network_obj.id + " ";
|
|
421
|
+
query += "and id_device = " + id_device;
|
|
421
422
|
return query;
|
|
422
423
|
}
|
|
423
424
|
function updateNetworkMySQL(id_device, network_obj) {
|
|
424
425
|
var query = "update device_networks "
|
|
425
|
-
query += "set
|
|
426
|
+
query += "set ";
|
|
426
427
|
query += "net_type = :tipo, ";
|
|
427
428
|
query += "mac_address = :mac_address, ";
|
|
428
429
|
query += "ipv4_static = :ipv4_static, ";
|
|
429
430
|
query += "ipv6_static = :ipv6_static ";
|
|
430
|
-
query += "where id = :id_network";
|
|
431
|
+
query += "where id = :id_network ";
|
|
432
|
+
query += "and id_device = :id_device";
|
|
431
433
|
return query;
|
|
432
434
|
}
|
|
433
|
-
function updateNetwork(db_used,
|
|
435
|
+
function updateNetwork(db_used, id_device, network_obj) {
|
|
434
436
|
var query = "";
|
|
435
437
|
if (db_used) {
|
|
436
438
|
switch (db_used) {
|
|
@@ -2260,6 +2262,177 @@ function getBeniDaInventari(db_used, table_name, inv_code, include_imp, is_pnrr,
|
|
|
2260
2262
|
}
|
|
2261
2263
|
return query;
|
|
2262
2264
|
}
|
|
2265
|
+
// Su modello
|
|
2266
|
+
function getBeniDaInventariOnDescriptionSQLite(table_name, search_string, include_imp, is_pnrr, is_dismissione) {
|
|
2267
|
+
var query = "";
|
|
2268
|
+
if (table_name && table_name != '') {
|
|
2269
|
+
if (table_name == "ImportRevisione2024") {
|
|
2270
|
+
query = "Select ";
|
|
2271
|
+
query += "inv_ict3 as Inventario, ";
|
|
2272
|
+
query += "ex_inv as Precedente, ";
|
|
2273
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2274
|
+
query += "collocazione as Luogo, ";
|
|
2275
|
+
query += "sede as Plesso, ";
|
|
2276
|
+
query += "marca as 'Marca bene', ";
|
|
2277
|
+
query += "modello_serie as Modello, ";
|
|
2278
|
+
query += "targa_matricola as Matricola, ";
|
|
2279
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2280
|
+
query += "prezzo as Costo, ";
|
|
2281
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2282
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as 'Note bene' ";
|
|
2283
|
+
query += "from " + table_name + " imp ";
|
|
2284
|
+
query += "left join devices d on imp.inv_ict3 = d.inv_ict3_number "
|
|
2285
|
+
}
|
|
2286
|
+
else if (table_name == "devices") {
|
|
2287
|
+
query = getDevicesSelectForInventarioRawSQLite(inv_code);
|
|
2288
|
+
}
|
|
2289
|
+
else if (is_pnrr == 1) {
|
|
2290
|
+
query = "Select ";
|
|
2291
|
+
query += "inventario as Inventario, ";
|
|
2292
|
+
query += "Tipo, ";
|
|
2293
|
+
query += "marca as 'Marca bene', ";
|
|
2294
|
+
query += "Descrizione, ";
|
|
2295
|
+
query += "Plesso as Luogo ";
|
|
2296
|
+
query += "from " + table_name + " imp ";
|
|
2297
|
+
}
|
|
2298
|
+
else if (is_dismissione == 1) {
|
|
2299
|
+
query = "Select ";
|
|
2300
|
+
query += "inv_ict3 as Inventario, ";
|
|
2301
|
+
query += "Descrizione, ";
|
|
2302
|
+
query += "Plesso, ";
|
|
2303
|
+
query += "Costo, ";
|
|
2304
|
+
query += "Note as 'Note bene' ";
|
|
2305
|
+
query += "from " + table_name + " imp ";
|
|
2306
|
+
}
|
|
2307
|
+
else {
|
|
2308
|
+
query = "Select ";
|
|
2309
|
+
query += "inv_ict3 as Inventario, ";
|
|
2310
|
+
query += "ex_inventario as Precedente, ";
|
|
2311
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2312
|
+
query += "collocazione as Luogo, ";
|
|
2313
|
+
query += "sede as Plesso, ";
|
|
2314
|
+
query += "marca as 'Marca bene', ";
|
|
2315
|
+
query += "modello_serie as Modello, ";
|
|
2316
|
+
query += "targa_matricola as Matricola, ";
|
|
2317
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2318
|
+
query += "prezzo as Costo, ";
|
|
2319
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2320
|
+
query += "concat(note, ' ', note_2, ' ', note_3) as 'Note bene' ";
|
|
2321
|
+
query += "from " + table_name + " imp ";
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
if (search_string && table_name) {
|
|
2325
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2326
|
+
query += " where descrizione_bene like '%" + search_string + "%'"
|
|
2327
|
+
if (!include_imp || include_imp == 0) {
|
|
2328
|
+
query += "and d.id is null"
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
else {
|
|
2333
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2334
|
+
if (!include_imp || include_imp == 0) {
|
|
2335
|
+
query += "where d.id is null"
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
return query;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
function getBeniDaInventariOnDescriptionMySQL(table_name, search_string, include_imp, is_pnrr, is_dismissione) {
|
|
2343
|
+
if (table_name && table_name != '') {
|
|
2344
|
+
if (table_name == "ImportRevisione2024") {
|
|
2345
|
+
query = "Select ";
|
|
2346
|
+
query += "inv_ict3 as Inventario, ";
|
|
2347
|
+
query += "ex_inv as Precedente, ";
|
|
2348
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2349
|
+
query += "collocazione as Luogo, ";
|
|
2350
|
+
query += "sede as Plesso, ";
|
|
2351
|
+
query += "marca as 'Marca bene', ";
|
|
2352
|
+
query += "modello_serie as Modello, ";
|
|
2353
|
+
query += "targa_matricola as Matricola, ";
|
|
2354
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2355
|
+
query += "prezzo as Costo, ";
|
|
2356
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2357
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as 'Note bene' ";
|
|
2358
|
+
query += "from :table_name imp ";
|
|
2359
|
+
query += "left join devices d on imp.inv_ict3 = d.inv_ict3_number "
|
|
2360
|
+
}
|
|
2361
|
+
else if (table_name == "devices") {
|
|
2362
|
+
query = getDevicesSelectForInventarioRawMySQL(inv_code);
|
|
2363
|
+
}
|
|
2364
|
+
else if (is_pnrr == 1) {
|
|
2365
|
+
query = "Select ";
|
|
2366
|
+
query += "inventario as Inventario, ";
|
|
2367
|
+
query += "Tipo, ";
|
|
2368
|
+
query += "marca as 'Marca bene', ";
|
|
2369
|
+
query += "Descrizione, ";
|
|
2370
|
+
query += "Plesso as Luogo ";
|
|
2371
|
+
query += "from :table_name imp ";
|
|
2372
|
+
}
|
|
2373
|
+
else if (is_dismissione == 1) {
|
|
2374
|
+
query = "Select ";
|
|
2375
|
+
query += "inv_ict3 as Inventario, ";
|
|
2376
|
+
query += "Descrizione, ";
|
|
2377
|
+
query += "Plesso, ";
|
|
2378
|
+
query += "Costo, ";
|
|
2379
|
+
query += "Note as 'Note bene' ";
|
|
2380
|
+
query += "from :table_name imp ";
|
|
2381
|
+
}
|
|
2382
|
+
else {
|
|
2383
|
+
query = "Select ";
|
|
2384
|
+
query += "inv_ict3 as Inventario, ";
|
|
2385
|
+
query += "ex_inventario as Precedente, ";
|
|
2386
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2387
|
+
query += "collocazione as Luogo, ";
|
|
2388
|
+
query += "sede as Plesso, ";
|
|
2389
|
+
query += "marca as 'Marca bene', ";
|
|
2390
|
+
query += "modello_serie as Modello, ";
|
|
2391
|
+
query += "targa_matricola as Matricola, ";
|
|
2392
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2393
|
+
query += "prezzo as Costo, ";
|
|
2394
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2395
|
+
query += "concat(note, ' ', note_2, ' ', note_3) as 'Note bene' ";
|
|
2396
|
+
query += "from :table_name imp ";
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
if (inv_code && table_name) {
|
|
2400
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2401
|
+
query += " where Inventario = '" + inv_code +"' or ";
|
|
2402
|
+
query += " Precedente = '" + inv_code +"' ";
|
|
2403
|
+
if (!include_imp || include_imp == 0) {
|
|
2404
|
+
query += "and d.id is null"
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
else {
|
|
2409
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2410
|
+
if (!include_imp || include_imp == 0) {
|
|
2411
|
+
query += "where d.id is null"
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
return query;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
function getBeniDaInventariOnDescription(db_used, table_name, search_string, include_imp, is_pnrr, is_dismissione) {
|
|
2419
|
+
var query = "";
|
|
2420
|
+
if (db_used) {
|
|
2421
|
+
switch (db_used) {
|
|
2422
|
+
case 'SQLITE':
|
|
2423
|
+
query = getBeniDaInventariOnDescriptionSQLite(table_name, inv_code, include_imp, is_pnrr, is_dismissione);
|
|
2424
|
+
break;
|
|
2425
|
+
case 'MYSQL':
|
|
2426
|
+
query = getBeniDaInventariOnDescriptionMySQL(table_name, inv_code, include_imp, is_pnrr, is_dismissione);
|
|
2427
|
+
break;
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
return query;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2263
2436
|
// Range..
|
|
2264
2437
|
function selectInventariPerIntervalloSQLite(table_name, is_pnrr, is_dismissione, code_da, code_a) {
|
|
2265
2438
|
var query = "";
|
|
@@ -7584,6 +7757,7 @@ module.exports = {
|
|
|
7584
7757
|
updateDeviceFromInventario,
|
|
7585
7758
|
insertDeviceSiteFromInventario,
|
|
7586
7759
|
getBeniDaInventari,
|
|
7760
|
+
getBeniDaInventariOnDescription,
|
|
7587
7761
|
getNetworksOnDevice,
|
|
7588
7762
|
getImportedPropertiesByIdDevice,
|
|
7589
7763
|
getSetInfoByIdSet,
|