alsmanager_lib 3.0.71 → 3.0.73

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 CHANGED
@@ -6847,7 +6847,7 @@ function queryConsegne(db_used,data_da, data_a, data_filter) {
6847
6847
  }
6848
6848
 
6849
6849
  function queryConsegnaByIdSQLite(id_consegna) {
6850
- var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, ";
6850
+ var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, data_limite, ";
6851
6851
  query += "case ";
6852
6852
  query += "when stato_restituzione is null then 0 else stato_restituzione end as stato_restituzione";
6853
6853
  query += ", is_home, note, richiedente_adulto, richiedente_alunno, richiedente_genitore, email_adulto, email_genitore, invia_email_sollecito from consegne";
@@ -6856,7 +6856,7 @@ function queryConsegnaByIdSQLite(id_consegna) {
6856
6856
  }
6857
6857
 
6858
6858
  function queryConsegnaByIdMySQL(id_consegna) {
6859
- var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, ";
6859
+ var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, data_limite, ";
6860
6860
  query += "case ";
6861
6861
  query += "when stato_restituzione is null then 0 else stato_restituzione end as stato_restituzione";
6862
6862
  query += ", is_home, note, richiedente_adulto, richiedente_alunno, richiedente_genitore, email_adulto, email_genitore, invia_email_sollecito from consegne";
@@ -6890,11 +6890,16 @@ function getDatiConsegneAttive() {
6890
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
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
6892
  query += "else '' ";
6893
- query += "end as bene_consegnato ";
6893
+ query += "end as bene_consegnato, ";
6894
+ query += "case ";
6895
+ query += "when cie.id is not null then 'SI' ";
6896
+ query += "else 'NO' ";
6897
+ query += "end as invio_sollecito ";
6894
6898
  query += "from consegna_beni cb ";
6895
6899
  query += "join consegne c on c.id = cb.id_consegna ";
6896
6900
  query += "left join devices d on cb.id_bene = d.id ";
6897
6901
  query += "left join softwares s on cb.id_bene = s.id ";
6902
+ query += "left join consegna_invio_email cie on cb.id_consegna = cie.id_consegna ";
6898
6903
  query += "where cb.stato_restituzione = 0 ";
6899
6904
  return query;
6900
6905
  }
@@ -7438,6 +7443,7 @@ function createConsegnaObj(consegna) {
7438
7443
  consegnaObj.data_ric_str = "";
7439
7444
  consegnaObj.data_cons_str = "";
7440
7445
  consegnaObj.data_rest_str = "";
7446
+ consegnaObj.data_limite_str = "";
7441
7447
  consegnaObj.id_site = consegna.id_site;
7442
7448
  consegnaObj.id_place = consegna.id_place;
7443
7449
 
@@ -7459,6 +7465,12 @@ function createConsegnaObj(consegna) {
7459
7465
  consegnaObj.data_rest_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
7460
7466
  }
7461
7467
 
7468
+ var dl = consegna.data_limite;
7469
+ if (dl) {
7470
+ var d = new Date(dl);
7471
+ consegnaObj.data_limite_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
7472
+ }
7473
+
7462
7474
  if (!consegna.stato_restituzione) {
7463
7475
  consegnaObj.stato_res = 0;
7464
7476
  }
@@ -7502,6 +7514,7 @@ function createConsegnaMySQLObj(consegna) {
7502
7514
  consegnaMySQLObj.data_ric_str = consegnaObj.data_ric_str;
7503
7515
  consegnaMySQLObj.data_cons_str = consegnaObj.data_cons_str;
7504
7516
  consegnaMySQLObj.data_rest_str = consegnaObj.data_rest_str;
7517
+ consegnaMySQLObj.data_limite_str = consegnaObj.data_limite_str;
7505
7518
  consegnaMySQLObj.id_site = consegnaObj.id_site;
7506
7519
  consegnaMySQLObj.id_place = consegnaObj.id_place;
7507
7520
  consegnaMySQLObj.id = consegnaObj.id;
@@ -7514,9 +7527,10 @@ function insertConsegnaSQLite(consegna) {
7514
7527
  var consegnaObj = createConsegnaObj(consegna);
7515
7528
  if (consegnaObj) {
7516
7529
  query = "insert into consegne ";
7517
- query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
7530
+ query += "(data_richiesta, data_consegna, data_limite, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
7518
7531
  query += " values ('" + consegnaObj.data_ric_str + "',";
7519
7532
  query += "'" + consegnaObj.data_cons_str + "',";
7533
+ query += "'" + consegnaObj.data_limite_str + "',";
7520
7534
  query += consegnaObj.stato_res + ",";
7521
7535
  query += "'" + consegnaObj.data_rest_str + "',";
7522
7536
  query += "'" + consegnaObj.adulto + "',";
@@ -7536,9 +7550,10 @@ function insertConsegnaMySQL(consegnaObj) {
7536
7550
  var query = "";
7537
7551
  if (consegnaObj) {
7538
7552
  query = "insert into consegne ";
7539
- query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
7553
+ query += "(data_richiesta, data_consegna, data_limite, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note, email_adulto, email_genitore) ";
7540
7554
  query += " values (:data_ric_str,";
7541
7555
  query += ":data_cons_str,";
7556
+ query += ":data_limite_str,";
7542
7557
  query += ":stato_res,";
7543
7558
  query += ":data_rest_str,";
7544
7559
  query += ":adulto,";
@@ -7583,6 +7598,8 @@ function updateConsegnaSQLite(consegna) {
7583
7598
  query += ", data_richiesta = '" + consegnaObj.data_ric_str + "'";
7584
7599
  if (consegnaObj.data_cons_str.trim() != '')
7585
7600
  query += ", data_consegna = '" + consegnaObj.data_cons_str + "'";
7601
+ if (consegnaObj.data_limite_str.trim() != '')
7602
+ query += ", data_limite = '" + consegnaObj.data_limite_str + "'";
7586
7603
  query += ", stato_restituzione = " + consegnaObj.stato_res;
7587
7604
  if (consegnaObj.data_rest_str.trim() != '')
7588
7605
  query += ", data_rientro = '" + consegnaObj.data_rest_str + "'";
@@ -7613,6 +7630,8 @@ function updateConsegnaMySQL(consegna) {
7613
7630
  query += ", data_richiesta = :data_ric_str ";
7614
7631
  if (consegnaObj.data_cons_str.trim() != '')
7615
7632
  query += ", data_consegna = :data_cons_str ";
7633
+ if (consegnaObj.data_limite_str.trim() != '')
7634
+ query += ", data_limite = :data_limite_str ";
7616
7635
  query += ", stato_restituzione = " + consegnaObj.stato_res;
7617
7636
  if (consegnaObj.data_rest_str.trim() != '')
7618
7637
  query += ", data_rientro = :data_rest_str ";
@@ -7809,27 +7828,29 @@ function removeConsegnaDevice(db_used, id_consegna, id_device) {
7809
7828
  }
7810
7829
  // Consegna beni
7811
7830
  function insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
7812
- var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna) values ";
7831
+ var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna, data_restituzione, note_restituzione) values ";
7813
7832
  query += "(" + id_consegna + ", ";
7814
7833
  query += id_bene + ", ";
7815
7834
  query += "'" + tipo_bene + "', ";
7816
7835
  query += "'" + data_consegna + "', ";
7817
7836
  query += numero + ", "
7818
7837
  query += "0, "
7819
- query += "'" + note + "'";
7838
+ query += "'" + note + "', ";
7839
+ query += "NULL, NULL ";
7820
7840
  query += ")";
7821
7841
  return query;
7822
7842
  }
7823
7843
 
7824
7844
  function insertConsegnaBeneMySQL(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
7825
- var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna) values ";
7845
+ var query = "insert into consegna_beni (id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note_consegna, data_restituzione, note_restituzione) values ";
7826
7846
  query += "(:id_consegna, ";
7827
7847
  query += ":id_bene, ";
7828
7848
  query += ":tipo_bene, ";
7829
7849
  query += ":data_consegna, ";
7830
7850
  query += ":numero, ";
7831
7851
  query += "0, ";
7832
- query += ":note ";
7852
+ query += ":note, ";
7853
+ query += "NULL, NULL ";
7833
7854
  query += ")";
7834
7855
  return query;
7835
7856
  }
@@ -7852,44 +7873,48 @@ function insertConsegnaBene(db_used, id_consegna, id_bene, tipo_bene, data_conse
7852
7873
  return query;
7853
7874
  }
7854
7875
 
7855
- function updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note){
7876
+ function updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione){
7856
7877
  var query = "update consegna_beni set ";
7857
7878
  query += "id_consegna = " + id_consegna + ", ";
7858
7879
  query += "id_bene = " + id_bene + ", ";
7859
7880
  query += "tipo_bene = '" + tipo_bene + "', ";
7860
7881
  query += "data_consegna = '" + data_consegna + "', ";
7882
+ query += "data_restituzione = '" + data_restituzione + "', ";
7861
7883
  query += "numero = " + numero + ", ";
7862
- query += "note = '" + note + "', ";
7884
+ query += "note_consegna = '" + note_cons + "', ";
7885
+ query += "note_restituzione = '" + note_restituzione + "', ";
7863
7886
  query += "stato_restituzione = " + stato_restituzione + " ";
7864
7887
  query += "where id = " + id_benecons;
7865
7888
  return query;
7866
7889
  }
7867
7890
 
7868
- function updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note){
7891
+ function updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione){
7869
7892
  var query = "update consegna_beni set ";
7870
7893
  query += "id_consegna = :id_consegna, ";
7871
7894
  query += "id_bene = :id_bene, ";
7872
7895
  query += "tipo_bene = :tipo_bene, ";
7873
7896
  query += "data_consegna = :data_consegna, ";
7897
+ query += "data_restituzione = :data_restituzione, ";
7874
7898
  query += "numero = :numero, ";
7875
- query += "note = :note ";
7899
+ query += "note_consegna = :note_cons, ";
7900
+ query += "note_restituzione = :note_restituzione, ";
7876
7901
  query += "stato_restituzione = :stato_restituzione ";
7877
7902
  query += "where id = :id_benecons";
7878
7903
  return query;
7879
7904
  }
7880
7905
 
7881
- function updateConsegnaBene(db_used, id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note) {
7906
+ function updateConsegnaBene(db_used, id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione) {
7882
7907
  var query = "";
7883
7908
  if (db_used) {
7884
7909
  switch (db_used) {
7885
7910
  case 'SQLITE':
7886
- query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note);
7911
+ query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione);
7887
7912
  break;
7888
7913
  case 'MYSQL':
7889
- query = updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note);
7914
+ query = updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione);
7890
7915
  break;
7891
7916
  case 'MYSQL2':
7892
- query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, note);
7917
+ query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione);
7893
7918
  break;
7894
7919
  }
7895
7920
  }
@@ -7979,7 +8004,7 @@ function selectBeniPerConsegnaSQLite(id_consegna, solo_prestito_attivo) {
7979
8004
  query += "else '' ";
7980
8005
  query += "end as Stato, ";
7981
8006
 
7982
- query += "cb.note_consegna as Note_cons ";
8007
+ query += "cb.note_consegna as Note_Cons, cb.note_restituzione as Note_Rest ";
7983
8008
  query += "from consegna_beni cb ";
7984
8009
  query += "left join devices d on cb.id_bene = d.id ";
7985
8010
  query += "left join softwares s on cb.id_bene = s.id ";
@@ -8049,7 +8074,7 @@ function selectBeniPerConsegnaMySQL(id_consegna, solo_prestito_attivo) {
8049
8074
  query += "else '' ";
8050
8075
  query += "end as Stato, ";
8051
8076
 
8052
- query += "cb.note_consegna as Note_cons ";
8077
+ query += "cb.note_consegna as Note_Cons, cb.note_restituzione as Note_Rest ";
8053
8078
  query += "from consegna_beni cb ";
8054
8079
  query += "left join devices d on cb.id_bene = d.id ";
8055
8080
  query += "left join softwares s on cb.id_bene = s.id ";
@@ -8082,14 +8107,14 @@ function selectBeniPerConsegna(db_used, id_consegna, solo_prestito_attivo) {
8082
8107
 
8083
8108
  function selectBeneConsegnaSQLite(id_benecons) {
8084
8109
  var query = "select cb.id as id_benecons, cb.id_consegna, cb.id_bene, cb.tipo_bene, ";
8085
- query += "cb.note_consegna, cb.numero, cb.stato_restituzione, cb.data_consegna, cb.data_restituzione from consegna_beni cb";
8110
+ query += "cb.note_consegna, cb.numero, cb.stato_restituzione, cb.data_consegna, cb.data_restituzione, cb.note_restituzione from consegna_beni cb";
8086
8111
  query += " where cb.id = " + id_benecons;
8087
8112
  return query;
8088
8113
  }
8089
8114
 
8090
8115
  function selectBeneConsegnaMySQL(id_benecons) {
8091
8116
  var query = "select cb.id as id_benecons, cb.id_consegna, cb.id_bene, cb.tipo_bene, ";
8092
- query += "cb.note_consegna, cb.numero, cb.stato_restituzione, cb.data_consegna, cb.data_restituzione from consegna_beni cb";
8117
+ query += "cb.note_consegna, cb.numero, cb.stato_restituzione, cb.data_consegna, cb.data_restituzione, cb.note_restituzione from consegna_beni cb";
8093
8118
  query += " where cb.id = :id_benecons";
8094
8119
  return query;
8095
8120
  }
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.71",
7
+ "version": "3.0.73",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",
package/settings_als.txt CHANGED
@@ -514,6 +514,7 @@ module.exports = {
514
514
  os:require('os'),
515
515
  getmac:require('getmac'),
516
516
  alsmanager_lib:require('alsmanager_lib'),
517
+ nodemailer:require('nodemailer'),
517
518
  },
518
519
 
519
520
  /** The maximum number of messages nodes will buffer internally as part of their