alsmanager_lib 3.0.49 → 3.0.51

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 +28 -13
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -6882,20 +6882,34 @@ function queryConsegnaById(db_used,id_consegna) {
6882
6882
  }
6883
6883
 
6884
6884
  //Creazione email sollecito consegna
6885
- function createConsegnaMessage(consegna, listBeni, data_limite) {
6885
+ function getDatiConsegneAttive() {
6886
+ var query = "select c.richiedente_adulto as Nominativo, c.email_adulto as Email, concat('Consegna n.', c.id, ' del ', STRFTIME('%d/%m/%Y', c.data_consegna)) as Consegna, ";
6887
+ query += "case ";
6888
+ query += "when d.id is not null and d.inv_ict3_number is not null and trim(d.inv_ict3_number) <> '' then concat(d.manifacturer, ' - ', d.model, ' - Inv.', d.inv_ict3_number) ";
6889
+ query += "when d.id is not null and d.serial_no is not null and trim(d.serial_no) <> '' then concat(d.manifacturer, ' - ', d.model, ' - S/N:', d.serial_no) ";
6890
+ query += "when s.id is not null and s.inv_ict3_number is not null and trim(s.inv_ict3_number) <> '' then concat(s.maker, ' - ', s.model, ' - Inv.', s.inv_ict3_number) ";
6891
+ query += "when s.id is not null and s.serial_no is not null and trim(s.serial_no) <> '' then concat(s.maker, ' - ', s.model, ' - S/N:', s.serial_no) ";
6892
+ query += "else '' ";
6893
+ query += "end as bene_consegnato ";
6894
+ query += "from consegna_beni cb ";
6895
+ query += "join consegne c on c.id = cb.id_consegna ";
6896
+ query += "left join devices d on cb.id_bene = d.id ";
6897
+ query += "left join softwares s on cb.id_bene = s.id ";
6898
+ query += "where cb.stato_restituzione = 0 ";
6899
+ return query;
6900
+ }
6901
+
6902
+
6903
+ function createConsegnaMessage(nominativo, email, rif_consegna, bene) {
6886
6904
  var msgObj = {};
6887
- if (consegna) {
6888
- msgObj.email_to = consegna.email_adulto;
6889
- msgObj.subject = "Rif. consegna: " + consegna.id + " del " + consegna.data_consegna;
6890
- msgObj.message = "Gentile/Egregio " + consegna.richiedente_adulto + "\n";
6891
- msgObj.message += "\n\nSi ricorda di effettuare entro la data " + data_limite + " la consegna dei seguenti beni : \n\n";
6892
- listBeni.forEach(element => {
6893
- msgObj.message += "n. " + element.numero + " - " + element.tipo + " - " + element.marca + " - " + element.modello + " - Cod. " + element.codice + "\n";
6894
- });
6895
- msgObj.message += "\n\nSi richiede che la consegna venga effettuata ad un tecnico dell'Istituto per le verifiche del caso.\n";
6896
- msgObj.message += "Se per eventuali esigenze fosse necessario prolungare l'utilizzo del bene, si prega di contattare l'Ufficio Tecnico.\n ";
6897
- msgObj.message += "Cordiali saluti \n\n I tecnici dell'I.C. Trento 3";
6898
- }
6905
+ msgObj.email_to = email;
6906
+ msgObj.subject = rif_consegna;
6907
+ msgObj.message = "Gentile/Egregio ins." + nominativo + "\n";
6908
+ msgObj.message += "\n\nSi ricorda di effettuare entro la data " + data_limite + " la consegna dei seguenti beni : \n\n";
6909
+ msgObj.message += "n. 1 " + bene + "\n";
6910
+ msgObj.message += "\n\nSi richiede che la consegna venga effettuata ad un tecnico dell'Istituto per le verifiche del caso.\n";
6911
+ msgObj.message += "Se per eventuali esigenze fosse necessario prolungare l'utilizzo del bene, si prega di contattare l'Ufficio Tecnico.\n ";
6912
+ msgObj.message += "Cordiali saluti \n\n I tecnici dell'I.C. Trento 3";
6899
6913
  return msgObj;
6900
6914
  }
6901
6915
 
@@ -14252,6 +14266,7 @@ module.exports = {
14252
14266
  getLastGestioneDeviceByIdDevice,
14253
14267
  queryConsegne,
14254
14268
  queryConsegnaById,
14269
+ getDatiConsegneAttive,
14255
14270
  createConsegnaMessage,
14256
14271
  createConsegnaMySQLObj,
14257
14272
  insertConsegna,
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.49",
7
+ "version": "3.0.51",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",