alsmanager_lib 3.0.72 → 3.0.74
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 +81 -20
- 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 ";
|
|
@@ -7655,6 +7669,46 @@ function updateConsegna(db_used, consegna) {
|
|
|
7655
7669
|
return query;
|
|
7656
7670
|
}
|
|
7657
7671
|
|
|
7672
|
+
|
|
7673
|
+
function updateDateConsegnaSQLite(consegna_id) {
|
|
7674
|
+
var query = "update consegne ";
|
|
7675
|
+
query += "set data_consegna = MIN(cb.data_consegna), ";
|
|
7676
|
+
query += "data_rientro = MAX(cb.data_restituzione) ";
|
|
7677
|
+
query += "from consegna_beni cb ";
|
|
7678
|
+
query += "where consegne.id = " + consegna_id + " ";
|
|
7679
|
+
query += "and cb.id_consegna = " + consegna_id;
|
|
7680
|
+
return query;
|
|
7681
|
+
}
|
|
7682
|
+
|
|
7683
|
+
function updateDateConsegnaMySQL(consegna_id) {
|
|
7684
|
+
var query = "update consegne ";
|
|
7685
|
+
query += "set data_consegna = MIN(cb.data_consegna), ";
|
|
7686
|
+
query += "data_rientro = MAX(cb.data_restituzione) ";
|
|
7687
|
+
query += "from consegna_beni cb ";
|
|
7688
|
+
query += "where consegne.id = :consegna_id ";
|
|
7689
|
+
query += "and cb.id_consegna = :consegna_id ";
|
|
7690
|
+
return query;
|
|
7691
|
+
}
|
|
7692
|
+
|
|
7693
|
+
function updateDateConsegna(db_used, consegna_id) {
|
|
7694
|
+
var query = "";
|
|
7695
|
+
if (db_used) {
|
|
7696
|
+
switch (db_used) {
|
|
7697
|
+
case 'SQLITE':
|
|
7698
|
+
query = updateDateConsegnaSQLite(consegna_id);
|
|
7699
|
+
break;
|
|
7700
|
+
case 'MYSQL':
|
|
7701
|
+
query = updateDateConsegnaMySQL(consegna_id);
|
|
7702
|
+
break;
|
|
7703
|
+
case 'MYSQL2':
|
|
7704
|
+
query = updateDateConsegnaSQLite(consegna_id);
|
|
7705
|
+
break;
|
|
7706
|
+
}
|
|
7707
|
+
}
|
|
7708
|
+
return query;
|
|
7709
|
+
}
|
|
7710
|
+
|
|
7711
|
+
|
|
7658
7712
|
function removeConsegnaSQLite(id_consegna) {
|
|
7659
7713
|
var query = "update consegne";
|
|
7660
7714
|
query += " set removed = 1"
|
|
@@ -7814,27 +7868,29 @@ function removeConsegnaDevice(db_used, id_consegna, id_device) {
|
|
|
7814
7868
|
}
|
|
7815
7869
|
// Consegna beni
|
|
7816
7870
|
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 ";
|
|
7871
|
+
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
7872
|
query += "(" + id_consegna + ", ";
|
|
7819
7873
|
query += id_bene + ", ";
|
|
7820
7874
|
query += "'" + tipo_bene + "', ";
|
|
7821
7875
|
query += "'" + data_consegna + "', ";
|
|
7822
7876
|
query += numero + ", "
|
|
7823
7877
|
query += "0, "
|
|
7824
|
-
query += "'" + note + "'";
|
|
7878
|
+
query += "'" + note + "', ";
|
|
7879
|
+
query += "NULL, NULL ";
|
|
7825
7880
|
query += ")";
|
|
7826
7881
|
return query;
|
|
7827
7882
|
}
|
|
7828
7883
|
|
|
7829
7884
|
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 ";
|
|
7885
|
+
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
7886
|
query += "(:id_consegna, ";
|
|
7832
7887
|
query += ":id_bene, ";
|
|
7833
7888
|
query += ":tipo_bene, ";
|
|
7834
7889
|
query += ":data_consegna, ";
|
|
7835
7890
|
query += ":numero, ";
|
|
7836
7891
|
query += "0, ";
|
|
7837
|
-
query += ":note ";
|
|
7892
|
+
query += ":note, ";
|
|
7893
|
+
query += "NULL, NULL ";
|
|
7838
7894
|
query += ")";
|
|
7839
7895
|
return query;
|
|
7840
7896
|
}
|
|
@@ -7857,44 +7913,48 @@ function insertConsegnaBene(db_used, id_consegna, id_bene, tipo_bene, data_conse
|
|
|
7857
7913
|
return query;
|
|
7858
7914
|
}
|
|
7859
7915
|
|
|
7860
|
-
function updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione,
|
|
7916
|
+
function updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione){
|
|
7861
7917
|
var query = "update consegna_beni set ";
|
|
7862
7918
|
query += "id_consegna = " + id_consegna + ", ";
|
|
7863
7919
|
query += "id_bene = " + id_bene + ", ";
|
|
7864
7920
|
query += "tipo_bene = '" + tipo_bene + "', ";
|
|
7865
7921
|
query += "data_consegna = '" + data_consegna + "', ";
|
|
7922
|
+
query += "data_restituzione = '" + data_restituzione + "', ";
|
|
7866
7923
|
query += "numero = " + numero + ", ";
|
|
7867
|
-
query += "
|
|
7924
|
+
query += "note_consegna = '" + note_cons + "', ";
|
|
7925
|
+
query += "note_restituzione = '" + note_restituzione + "', ";
|
|
7868
7926
|
query += "stato_restituzione = " + stato_restituzione + " ";
|
|
7869
7927
|
query += "where id = " + id_benecons;
|
|
7870
7928
|
return query;
|
|
7871
7929
|
}
|
|
7872
7930
|
|
|
7873
|
-
function updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione,
|
|
7931
|
+
function updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione){
|
|
7874
7932
|
var query = "update consegna_beni set ";
|
|
7875
7933
|
query += "id_consegna = :id_consegna, ";
|
|
7876
7934
|
query += "id_bene = :id_bene, ";
|
|
7877
7935
|
query += "tipo_bene = :tipo_bene, ";
|
|
7878
7936
|
query += "data_consegna = :data_consegna, ";
|
|
7937
|
+
query += "data_restituzione = :data_restituzione, ";
|
|
7879
7938
|
query += "numero = :numero, ";
|
|
7880
|
-
query += "
|
|
7939
|
+
query += "note_consegna = :note_cons, ";
|
|
7940
|
+
query += "note_restituzione = :note_restituzione, ";
|
|
7881
7941
|
query += "stato_restituzione = :stato_restituzione ";
|
|
7882
7942
|
query += "where id = :id_benecons";
|
|
7883
7943
|
return query;
|
|
7884
7944
|
}
|
|
7885
7945
|
|
|
7886
|
-
function updateConsegnaBene(db_used, id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione,
|
|
7946
|
+
function updateConsegnaBene(db_used, id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione) {
|
|
7887
7947
|
var query = "";
|
|
7888
7948
|
if (db_used) {
|
|
7889
7949
|
switch (db_used) {
|
|
7890
7950
|
case 'SQLITE':
|
|
7891
|
-
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione,
|
|
7951
|
+
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione);
|
|
7892
7952
|
break;
|
|
7893
7953
|
case 'MYSQL':
|
|
7894
|
-
query = updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione,
|
|
7954
|
+
query = updateConsegnaBeneMySQL(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione);
|
|
7895
7955
|
break;
|
|
7896
7956
|
case 'MYSQL2':
|
|
7897
|
-
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione,
|
|
7957
|
+
query = updateConsegnaBeneSQLite(id_benecons, id_consegna, id_bene, tipo_bene, data_consegna, numero, stato_restituzione, data_restituzione, note_cons, note_restituzione);
|
|
7898
7958
|
break;
|
|
7899
7959
|
}
|
|
7900
7960
|
}
|
|
@@ -7984,7 +8044,7 @@ function selectBeniPerConsegnaSQLite(id_consegna, solo_prestito_attivo) {
|
|
|
7984
8044
|
query += "else '' ";
|
|
7985
8045
|
query += "end as Stato, ";
|
|
7986
8046
|
|
|
7987
|
-
query += "cb.note_consegna as
|
|
8047
|
+
query += "cb.note_consegna as Note_Cons, cb.note_restituzione as Note_Rest ";
|
|
7988
8048
|
query += "from consegna_beni cb ";
|
|
7989
8049
|
query += "left join devices d on cb.id_bene = d.id ";
|
|
7990
8050
|
query += "left join softwares s on cb.id_bene = s.id ";
|
|
@@ -8054,7 +8114,7 @@ function selectBeniPerConsegnaMySQL(id_consegna, solo_prestito_attivo) {
|
|
|
8054
8114
|
query += "else '' ";
|
|
8055
8115
|
query += "end as Stato, ";
|
|
8056
8116
|
|
|
8057
|
-
query += "cb.note_consegna as
|
|
8117
|
+
query += "cb.note_consegna as Note_Cons, cb.note_restituzione as Note_Rest ";
|
|
8058
8118
|
query += "from consegna_beni cb ";
|
|
8059
8119
|
query += "left join devices d on cb.id_bene = d.id ";
|
|
8060
8120
|
query += "left join softwares s on cb.id_bene = s.id ";
|
|
@@ -8087,14 +8147,14 @@ function selectBeniPerConsegna(db_used, id_consegna, solo_prestito_attivo) {
|
|
|
8087
8147
|
|
|
8088
8148
|
function selectBeneConsegnaSQLite(id_benecons) {
|
|
8089
8149
|
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";
|
|
8150
|
+
query += "cb.note_consegna, cb.numero, cb.stato_restituzione, cb.data_consegna, cb.data_restituzione, cb.note_restituzione from consegna_beni cb";
|
|
8091
8151
|
query += " where cb.id = " + id_benecons;
|
|
8092
8152
|
return query;
|
|
8093
8153
|
}
|
|
8094
8154
|
|
|
8095
8155
|
function selectBeneConsegnaMySQL(id_benecons) {
|
|
8096
8156
|
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";
|
|
8157
|
+
query += "cb.note_consegna, cb.numero, cb.stato_restituzione, cb.data_consegna, cb.data_restituzione, cb.note_restituzione from consegna_beni cb";
|
|
8098
8158
|
query += " where cb.id = :id_benecons";
|
|
8099
8159
|
return query;
|
|
8100
8160
|
}
|
|
@@ -14406,6 +14466,7 @@ module.exports = {
|
|
|
14406
14466
|
createConsegnaMySQLObj,
|
|
14407
14467
|
insertConsegna,
|
|
14408
14468
|
updateConsegna,
|
|
14469
|
+
updateDateConsegna,
|
|
14409
14470
|
removeConsegna,
|
|
14410
14471
|
queryLastConsegnaId,
|
|
14411
14472
|
insertConsegnaDevice,
|