alsmanager_lib 3.0.225 → 3.0.227

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 +22 -5
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -4421,6 +4421,13 @@ function getDeviceAnnotationsByIdDevice(id_device) {
4421
4421
  query += "order by date_annotation";
4422
4422
  return query;
4423
4423
  }
4424
+
4425
+ function selectDeviceAnnotationsById(id_annot) {
4426
+ var query = "select da.id, da.date_annotation, da.annotation, da.annotation_type from device_annotations da ";
4427
+ query += "where id = " + id_annot;
4428
+ return query;
4429
+ }
4430
+
4424
4431
  function insertDeviceAnnotation(id_device, date_annot, annot, annot_type) {
4425
4432
  var query = "insert into device_annotations (id_device, date_annotation, annotation, annotation_type) values (";
4426
4433
  var dt_str = convertDateToStringDB(date_annot);
@@ -9374,11 +9381,20 @@ function updateDataRientroConsegnaSQLite(consegna_id) {
9374
9381
  }
9375
9382
 
9376
9383
  function updateDataRientroConsegnaMySQL(consegna_id) {
9377
- var query = "update consegne ";
9378
- query += "set data_rientro = MAX(cb.data_restituzione) ";
9384
+ var query = "UPDATE consegne as c ";
9385
+ query += "SET c.data_rientro = (SELECT MAX(cb.data_restituzione) ";
9379
9386
  query += "from consegna_beni cb ";
9380
- query += "where consegne.id = :consegna_id ";
9381
- query += "and cb.id_consegna = :consegna_id ";
9387
+ query += "WHERE cb.id_consegna = :consegna_id) ";
9388
+ query += "WHERE c.id = :consegna_id";
9389
+ return query;
9390
+ }
9391
+
9392
+ function updateDataRientroConsegnaMySQL2(consegna_id) {
9393
+ var query = "UPDATE consegne as c ";
9394
+ query += "SET c.data_rientro = (SELECT MAX(cb.data_restituzione) ";
9395
+ query += "from consegna_beni cb ";
9396
+ query += "WHERE cb.id_consegna = " + consegna_id + ") ";
9397
+ query += "WHERE c.id = " + consegna_id;
9382
9398
  return query;
9383
9399
  }
9384
9400
 
@@ -9393,7 +9409,7 @@ function updateDataRientroConsegna(db_used, consegna_id) {
9393
9409
  query = updateDataRientroConsegnaMySQL(consegna_id);
9394
9410
  break;
9395
9411
  case 'MYSQL2':
9396
- query = updateDataRientroConsegnaSQLite(consegna_id);
9412
+ query = updateDataRientroConsegnaMySQL2(consegna_id);
9397
9413
  break;
9398
9414
  }
9399
9415
  }
@@ -17378,6 +17394,7 @@ module.exports = {
17378
17394
  queryDeviceById,
17379
17395
  queryDeviceByIdentificativo,
17380
17396
  getDeviceAnnotationsByIdDevice,
17397
+ selectDeviceAnnotationsById,
17381
17398
  insertDeviceAnnotation,
17382
17399
  updateDeviceAnnotation,
17383
17400
  removeDeviceAnnotation,
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.225",
7
+ "version": "3.0.227",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",