alsmanager_lib 3.0.220 → 3.0.221

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 +33 -8
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -4686,7 +4686,7 @@ function insertDeviceSQLite(dev) {
4686
4686
  if (dev.peso_g)
4687
4687
  peso = dev.peso_g;
4688
4688
 
4689
- query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects, no_inventario, peso_g, part_of, is_unused) ";
4689
+ query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects, no_inventario, peso_g, part_of, is_unused, date_insert) ";
4690
4690
  query += "values (";
4691
4691
  query += "'" + String(inventario).trim() + "',";
4692
4692
  query += "'" + String(inv_comune).trim() + "',";
@@ -4701,13 +4701,14 @@ function insertDeviceSQLite(dev) {
4701
4701
  query += dev.no_inv + ", ";
4702
4702
  query += peso + ", ";
4703
4703
  query += "'" + dev.part_of + "', ";
4704
- query += dev.is_unused;
4704
+ query += dev.is_unused + ", ";
4705
+ query += "'" + convertDateToStringDB(new Date()) + "'";
4705
4706
  query += ")";
4706
4707
  }
4707
4708
  return query;
4708
4709
  }
4709
4710
  function insertDeviceMySQL() {
4710
- var query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects, no_inventario, peso_g, part_of, is_unused) ";
4711
+ query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note, num_objects, no_inventario, peso_g, part_of, is_unused, date_insert) ";
4711
4712
  query += "values (";
4712
4713
  query += ":inventario, ";
4713
4714
  query += ":inv_comune, ";
@@ -4723,6 +4724,7 @@ function insertDeviceMySQL() {
4723
4724
  query += ":peso_g, ";
4724
4725
  query += ":part_of, ";
4725
4726
  query += ":is_unused, ";
4727
+ query += "'" + convertDateToStringDB(new Date()) + "'";
4726
4728
  query += ")";
4727
4729
  return query;
4728
4730
  }
@@ -4800,7 +4802,8 @@ function updateDeviceSQLite(deviceObj) {
4800
4802
  query += "no_inventario = " + dev.no_inv + ", ";
4801
4803
  query += "peso_g = " + peso + ", ";
4802
4804
  query += "part_of = '" + part_of + "', ";
4803
- query += "is_unused = " + dev.is_unused + " ";
4805
+ query += "is_unused = " + dev.is_unused + ", ";
4806
+ query += "date_last_update = '" + convertDateToStringDB(new Date()) + "' ";
4804
4807
  query += " where id = " + dev.id;
4805
4808
  }
4806
4809
  return query;
@@ -4821,7 +4824,8 @@ function updateDeviceMySQL() {
4821
4824
  query += "no_inventario = :no_inv, ";
4822
4825
  query += "peso_g = :peso_g, ";
4823
4826
  query += "part_of = :part_of, ";
4824
- query += "is_unused = :is_unused ";
4827
+ query += "is_unused = :is_unused, ";
4828
+ query += "date_last_update = '" + convertDateToStringDB(new Date()) + "' ";
4825
4829
  query += " where id = :id_device";
4826
4830
  return query;
4827
4831
  }
@@ -4914,13 +4918,15 @@ function getDeviceMySQLPayload(dev) {
4914
4918
  //End Update Device
4915
4919
  // Remove Device
4916
4920
  function removeDeviceSQLite(id_device) {
4917
- var query = "update devices set is_removed = 1 ";
4921
+ var query = "update devices set is_removed = 1, ";
4922
+ query += "date_removed = '" + convertDateToStringDB(new Date()) + "' ";
4918
4923
  query += "where id = " + id_device;
4919
4924
  return query;
4920
4925
  }
4921
4926
 
4922
4927
  function removeDeviceMySQL() {
4923
- var query = "update devices set is_removed = 1 ";
4928
+ var query = "update devices set is_removed = 1, ";
4929
+ query += "date_removed = '" + convertDateToStringDB(new Date()) + "' ";
4924
4930
  query += "where id = :id_device";
4925
4931
  return query;
4926
4932
  }
@@ -17056,6 +17062,23 @@ function deleteCountersPrinterRechargeUser(id_counteruser) {
17056
17062
 
17057
17063
 
17058
17064
  // End Printer management
17065
+ // Notes for devices
17066
+ function getNotesByIdDevice(id_device) {
17067
+ var query = "select CONCAT('DISPOSITIVO id. ', d2.id) as Tipo, d2.date_insert as Data, d2.note as note from devices d2 ";
17068
+ query += "where d2.id = " + id_device + " and d2.note is not null ";
17069
+ query += "UNION ";
17070
+ query += "select CONCAT('CONSEGNA n. ', cb.id_consegna), cb.data_consegna as Data, cb.note_consegna as note from consegna_beni cb ";
17071
+ query += "where cb.id_bene = " + id_device + " and cb.note_consegna is not null ";
17072
+ query += "UNION ";
17073
+ query += "select CONCAT('RESTITUZIONE n. ', cb2.id_consegna) as Tipo, cb2.data_restituzione as Data, cb2.note_restituzione as note from consegna_beni cb2 ";
17074
+ query += "where cb.id_bene = " + id_device + " and cb2.note_restituzione is not null ";
17075
+ query += "UNION ";
17076
+ query += "select CONCAT('INTERVENTO n. ', di.id) as Tipo, di.date_start as Data, di.note_intervento as note from device_interventi di ";
17077
+ query += "where di.id_device = " + id_device + " and di.note_intervento is not null ";
17078
+ return query;
17079
+ }
17080
+
17081
+ // End Notes for devices
17059
17082
  // Exports
17060
17083
 
17061
17084
  module.exports = {
@@ -17546,6 +17569,8 @@ module.exports = {
17546
17569
  readCountersPrinterRechargeUser,
17547
17570
  writeCountersPrinterRechargeUser,
17548
17571
  updateCountersPrinterRechargeUser,
17549
- deleteCountersPrinterRechargeUser
17572
+ deleteCountersPrinterRechargeUser,
17573
+ //
17574
+ getNotesByIdDevice
17550
17575
  };
17551
17576
  // end of source
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.220",
7
+ "version": "3.0.221",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",