alsmanager_lib 3.0.179 → 3.0.181

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 +84 -2
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -4111,7 +4111,16 @@ function queryDeviceByIdSQLite(id_device) {
4111
4111
  query += "d.manifacturer as Marca, d.model as Modello, ";
4112
4112
  query += "d.inv_ict3_number as Inventario, d.serial_no, ";
4113
4113
  query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
4114
- query += "d.note, d.num_objects, d.no_inventario, d.peso_g, d.part_of, d.is_unused from devices d ";
4114
+ query += "d.note, d.num_objects, d.no_inventario, d.peso_g, d.part_of, d.is_unused, ";
4115
+ query += "case ";
4116
+ query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
4117
+ query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
4118
+ query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
4119
+ query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
4120
+ query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
4121
+ query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
4122
+ query += "end as Codice ";
4123
+ query += "from devices d ";
4115
4124
  query += "where d.id = " + id_device;
4116
4125
  return query;
4117
4126
  }
@@ -4120,7 +4129,16 @@ function queryDeviceByIdMySQL(id_device) {
4120
4129
  query += "d.manifacturer as Marca, d.model as Modello, ";
4121
4130
  query += "d.inv_ict3_number as Inventario, d.serial_no, ";
4122
4131
  query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
4123
- query += "d.note, d.num_objects, d.no_inventario, d.peso_g, d.part_of, d.is_unused from devices d ";
4132
+ query += "d.note, d.num_objects, d.no_inventario, d.peso_g, d.part_of, d.is_unused, ";
4133
+ query += "case ";
4134
+ query += "when d.no_inventario is not null and d.no_inventario > 0 then concat(d.id,'(ID)') ";
4135
+ query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
4136
+ query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
4137
+ query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
4138
+ query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
4139
+ query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
4140
+ query += "end as Codice ";
4141
+ query += "from devices d ";
4124
4142
  query += "where d.id = :id_device";
4125
4143
  return query;
4126
4144
  }
@@ -8307,6 +8325,68 @@ function removeIntervento(db_used,id_intervento) {
8307
8325
 
8308
8326
 
8309
8327
  // Device intervento
8328
+ function selectDevicesInterventoByIdInterventoSQLite(id_intervento) {
8329
+ var query = "select id, id_device, id_intervento, date_start, date_end, note_intervento, tempo_stimato_min, tempo_effettivo_min from device_interventi ";
8330
+ query += "where id_intervento = " + id_intervento;
8331
+ return query;
8332
+ }
8333
+
8334
+ function selectDevicesInterventoByIdInterventoMySQL(id_intervento) {
8335
+ var query = "select id, id_device, id_intervento, date_start, date_end, note_intervento, tempo_stimato_min, tempo_effettivo_min from device_interventi ";
8336
+ query += "where id_intervento = :id_intervento";
8337
+ return query;
8338
+ }
8339
+
8340
+ function selectDevicesInterventoByIdIntervento(db_used, id_intervento) {
8341
+ var query = "";
8342
+ if (db_used) {
8343
+ switch (db_used) {
8344
+ case 'SQLITE':
8345
+ query = selectDevicesInterventoByIdInterventoSQLite(id_intervento);
8346
+ break;
8347
+ case 'MYSQL':
8348
+ query = selectDevicesInterventoByIdInterventoMySQL();
8349
+ break;
8350
+ case 'MYSQL2':
8351
+ query = selectDevicesInterventoByIdInterventoSQLite(id_intervento);
8352
+ break;
8353
+ }
8354
+ }
8355
+ return query;
8356
+ }
8357
+
8358
+
8359
+
8360
+ function selectDevicesInterventoByIdSQLite(id_dev_intervento) {
8361
+ var query = "select id, id_device, id_intervento, date_start, date_end, note_intervento, tempo_stimato_min, tempo_effettivo_min from device_interventi ";
8362
+ query += "where id = " + id_dev_intervento;
8363
+ return query;
8364
+ }
8365
+
8366
+ function selectDevicesInterventoByIdMySQL(id_dev_intervento) {
8367
+ var query = "select id, id_device, id_intervento, date_start, date_end, note_intervento, tempo_stimato_min, tempo_effettivo_min from device_interventi ";
8368
+ query += "where id = :id_dev_intervento";
8369
+ return query;
8370
+ }
8371
+
8372
+ function selectDevicesInterventoById(db_used, id_dev_intervento) {
8373
+ var query = "";
8374
+ if (db_used) {
8375
+ switch (db_used) {
8376
+ case 'SQLITE':
8377
+ query = selectDevicesInterventoByIdSQLite(id_dev_intervento);
8378
+ break;
8379
+ case 'MYSQL':
8380
+ query = selectDevicesInterventoByIdMySQL();
8381
+ break;
8382
+ case 'MYSQL2':
8383
+ query = selectDevicesInterventoByIdSQLite(id_dev_intervento);
8384
+ break;
8385
+ }
8386
+ }
8387
+ return query;
8388
+ }
8389
+
8310
8390
  function insertDeviceInterventoSQLite(id_intervento, id_device, dt_inizio, dt_fine, note, t_stima_min, t_effettivo_min) {
8311
8391
  /*CREATE TABLE "device_interventi" (
8312
8392
  "id" INTEGER,
@@ -16334,6 +16414,8 @@ module.exports = {
16334
16414
  insertDeviceIntervento,
16335
16415
  updateDeviceIntervento,
16336
16416
  removeDeviceIntervento,
16417
+ selectDevicesInterventoByIdIntervento,
16418
+ selectDevicesInterventoById,
16337
16419
  //
16338
16420
  getConnectionTypes,
16339
16421
  getConnectionProtocols,
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.179",
7
+ "version": "3.0.181",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",