alsmanager_lib 3.0.72 → 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.
Files changed (2) hide show
  1. package/lib/modules.js +40 -20
  2. package/package.json +1 -1
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";
@@ -7443,6 +7443,7 @@ function createConsegnaObj(consegna) {
7443
7443
  consegnaObj.data_ric_str = "";
7444
7444
  consegnaObj.data_cons_str = "";
7445
7445
  consegnaObj.data_rest_str = "";
7446
+ consegnaObj.data_limite_str = "";
7446
7447
  consegnaObj.id_site = consegna.id_site;
7447
7448
  consegnaObj.id_place = consegna.id_place;
7448
7449
 
@@ -7464,6 +7465,12 @@ function createConsegnaObj(consegna) {
7464
7465
  consegnaObj.data_rest_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
7465
7466
  }
7466
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
+
7467
7474
  if (!consegna.stato_restituzione) {
7468
7475
  consegnaObj.stato_res = 0;
7469
7476
  }
@@ -7507,6 +7514,7 @@ function createConsegnaMySQLObj(consegna) {
7507
7514
  consegnaMySQLObj.data_ric_str = consegnaObj.data_ric_str;
7508
7515
  consegnaMySQLObj.data_cons_str = consegnaObj.data_cons_str;
7509
7516
  consegnaMySQLObj.data_rest_str = consegnaObj.data_rest_str;
7517
+ consegnaMySQLObj.data_limite_str = consegnaObj.data_limite_str;
7510
7518
  consegnaMySQLObj.id_site = consegnaObj.id_site;
7511
7519
  consegnaMySQLObj.id_place = consegnaObj.id_place;
7512
7520
  consegnaMySQLObj.id = consegnaObj.id;
@@ -7519,9 +7527,10 @@ function insertConsegnaSQLite(consegna) {
7519
7527
  var consegnaObj = createConsegnaObj(consegna);
7520
7528
  if (consegnaObj) {
7521
7529
  query = "insert into consegne ";
7522
- 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) ";
7523
7531
  query += " values ('" + consegnaObj.data_ric_str + "',";
7524
7532
  query += "'" + consegnaObj.data_cons_str + "',";
7533
+ query += "'" + consegnaObj.data_limite_str + "',";
7525
7534
  query += consegnaObj.stato_res + ",";
7526
7535
  query += "'" + consegnaObj.data_rest_str + "',";
7527
7536
  query += "'" + consegnaObj.adulto + "',";
@@ -7541,9 +7550,10 @@ function insertConsegnaMySQL(consegnaObj) {
7541
7550
  var query = "";
7542
7551
  if (consegnaObj) {
7543
7552
  query = "insert into consegne ";
7544
- 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) ";
7545
7554
  query += " values (:data_ric_str,";
7546
7555
  query += ":data_cons_str,";
7556
+ query += ":data_limite_str,";
7547
7557
  query += ":stato_res,";
7548
7558
  query += ":data_rest_str,";
7549
7559
  query += ":adulto,";
@@ -7588,6 +7598,8 @@ function updateConsegnaSQLite(consegna) {
7588
7598
  query += ", data_richiesta = '" + consegnaObj.data_ric_str + "'";
7589
7599
  if (consegnaObj.data_cons_str.trim() != '')
7590
7600
  query += ", data_consegna = '" + consegnaObj.data_cons_str + "'";
7601
+ if (consegnaObj.data_limite_str.trim() != '')
7602
+ query += ", data_limite = '" + consegnaObj.data_limite_str + "'";
7591
7603
  query += ", stato_restituzione = " + consegnaObj.stato_res;
7592
7604
  if (consegnaObj.data_rest_str.trim() != '')
7593
7605
  query += ", data_rientro = '" + consegnaObj.data_rest_str + "'";
@@ -7618,6 +7630,8 @@ function updateConsegnaMySQL(consegna) {
7618
7630
  query += ", data_richiesta = :data_ric_str ";
7619
7631
  if (consegnaObj.data_cons_str.trim() != '')
7620
7632
  query += ", data_consegna = :data_cons_str ";
7633
+ if (consegnaObj.data_limite_str.trim() != '')
7634
+ query += ", data_limite = :data_limite_str ";
7621
7635
  query += ", stato_restituzione = " + consegnaObj.stato_res;
7622
7636
  if (consegnaObj.data_rest_str.trim() != '')
7623
7637
  query += ", data_rientro = :data_rest_str ";
@@ -7814,27 +7828,29 @@ function removeConsegnaDevice(db_used, id_consegna, id_device) {
7814
7828
  }
7815
7829
  // Consegna beni
7816
7830
  function insertConsegnaBeneSQLite(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
7817
- 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 ";
7818
7832
  query += "(" + id_consegna + ", ";
7819
7833
  query += id_bene + ", ";
7820
7834
  query += "'" + tipo_bene + "', ";
7821
7835
  query += "'" + data_consegna + "', ";
7822
7836
  query += numero + ", "
7823
7837
  query += "0, "
7824
- query += "'" + note + "'";
7838
+ query += "'" + note + "', ";
7839
+ query += "NULL, NULL ";
7825
7840
  query += ")";
7826
7841
  return query;
7827
7842
  }
7828
7843
 
7829
7844
  function insertConsegnaBeneMySQL(id_consegna, id_bene, tipo_bene, data_consegna, numero, note){
7830
- 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 ";
7831
7846
  query += "(:id_consegna, ";
7832
7847
  query += ":id_bene, ";
7833
7848
  query += ":tipo_bene, ";
7834
7849
  query += ":data_consegna, ";
7835
7850
  query += ":numero, ";
7836
7851
  query += "0, ";
7837
- query += ":note ";
7852
+ query += ":note, ";
7853
+ query += "NULL, NULL ";
7838
7854
  query += ")";
7839
7855
  return query;
7840
7856
  }
@@ -7857,44 +7873,48 @@ function insertConsegnaBene(db_used, id_consegna, id_bene, tipo_bene, data_conse
7857
7873
  return query;
7858
7874
  }
7859
7875
 
7860
- 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){
7861
7877
  var query = "update consegna_beni set ";
7862
7878
  query += "id_consegna = " + id_consegna + ", ";
7863
7879
  query += "id_bene = " + id_bene + ", ";
7864
7880
  query += "tipo_bene = '" + tipo_bene + "', ";
7865
7881
  query += "data_consegna = '" + data_consegna + "', ";
7882
+ query += "data_restituzione = '" + data_restituzione + "', ";
7866
7883
  query += "numero = " + numero + ", ";
7867
- query += "note = '" + note + "', ";
7884
+ query += "note_consegna = '" + note_cons + "', ";
7885
+ query += "note_restituzione = '" + note_restituzione + "', ";
7868
7886
  query += "stato_restituzione = " + stato_restituzione + " ";
7869
7887
  query += "where id = " + id_benecons;
7870
7888
  return query;
7871
7889
  }
7872
7890
 
7873
- 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){
7874
7892
  var query = "update consegna_beni set ";
7875
7893
  query += "id_consegna = :id_consegna, ";
7876
7894
  query += "id_bene = :id_bene, ";
7877
7895
  query += "tipo_bene = :tipo_bene, ";
7878
7896
  query += "data_consegna = :data_consegna, ";
7897
+ query += "data_restituzione = :data_restituzione, ";
7879
7898
  query += "numero = :numero, ";
7880
- query += "note = :note ";
7899
+ query += "note_consegna = :note_cons, ";
7900
+ query += "note_restituzione = :note_restituzione, ";
7881
7901
  query += "stato_restituzione = :stato_restituzione ";
7882
7902
  query += "where id = :id_benecons";
7883
7903
  return query;
7884
7904
  }
7885
7905
 
7886
- 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) {
7887
7907
  var query = "";
7888
7908
  if (db_used) {
7889
7909
  switch (db_used) {
7890
7910
  case 'SQLITE':
7891
- 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);
7892
7912
  break;
7893
7913
  case 'MYSQL':
7894
- 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);
7895
7915
  break;
7896
7916
  case 'MYSQL2':
7897
- 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);
7898
7918
  break;
7899
7919
  }
7900
7920
  }
@@ -7984,7 +8004,7 @@ function selectBeniPerConsegnaSQLite(id_consegna, solo_prestito_attivo) {
7984
8004
  query += "else '' ";
7985
8005
  query += "end as Stato, ";
7986
8006
 
7987
- query += "cb.note_consegna as Note_cons ";
8007
+ query += "cb.note_consegna as Note_Cons, cb.note_restituzione as Note_Rest ";
7988
8008
  query += "from consegna_beni cb ";
7989
8009
  query += "left join devices d on cb.id_bene = d.id ";
7990
8010
  query += "left join softwares s on cb.id_bene = s.id ";
@@ -8054,7 +8074,7 @@ function selectBeniPerConsegnaMySQL(id_consegna, solo_prestito_attivo) {
8054
8074
  query += "else '' ";
8055
8075
  query += "end as Stato, ";
8056
8076
 
8057
- query += "cb.note_consegna as Note_cons ";
8077
+ query += "cb.note_consegna as Note_Cons, cb.note_restituzione as Note_Rest ";
8058
8078
  query += "from consegna_beni cb ";
8059
8079
  query += "left join devices d on cb.id_bene = d.id ";
8060
8080
  query += "left join softwares s on cb.id_bene = s.id ";
@@ -8087,14 +8107,14 @@ function selectBeniPerConsegna(db_used, id_consegna, solo_prestito_attivo) {
8087
8107
 
8088
8108
  function selectBeneConsegnaSQLite(id_benecons) {
8089
8109
  var query = "select cb.id as id_benecons, cb.id_consegna, cb.id_bene, cb.tipo_bene, ";
8090
- 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";
8091
8111
  query += " where cb.id = " + id_benecons;
8092
8112
  return query;
8093
8113
  }
8094
8114
 
8095
8115
  function selectBeneConsegnaMySQL(id_benecons) {
8096
8116
  var query = "select cb.id as id_benecons, cb.id_consegna, cb.id_bene, cb.tipo_bene, ";
8097
- 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";
8098
8118
  query += " where cb.id = :id_benecons";
8099
8119
  return query;
8100
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.72",
7
+ "version": "3.0.73",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",