alsmanager_lib 3.0.76 → 3.0.77

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 +39 -14
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -6768,9 +6768,15 @@ function getLastGestioneDeviceByIdDevice(db_used,id_device, date_ref) {
6768
6768
  return query;
6769
6769
  }
6770
6770
 
6771
- function queryConsegneSQLite(data_da, data_a, data_filter) {
6772
- var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne";
6773
- query += " where (removed is null or removed = 0) ";
6771
+ function queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno) {
6772
+ var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne ";
6773
+ query += "where (removed is null or removed = 0) ";
6774
+ if (adulto && adulto.trim() != '') {
6775
+ query += "and richiedente_adulto = " + adulto + " ";
6776
+ }
6777
+ if (alunno && alunno.trim() != '') {
6778
+ query += "and richiedente_alunno = " + alunno + " ";
6779
+ }
6774
6780
  if (data_da || data_a) {
6775
6781
  query += " and ";
6776
6782
  if (data_da) {
@@ -6800,9 +6806,15 @@ function queryConsegneSQLite(data_da, data_a, data_filter) {
6800
6806
  return query;
6801
6807
  }
6802
6808
 
6803
- function queryConsegneMySQL(data_da, data_a, data_filter) {
6804
- var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne";
6805
- query += " where (removed is null or removed = 0) ";
6809
+ function queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno) {
6810
+ var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note, email_adulto, email_genitore from consegne ";
6811
+ query += "where (removed is null or removed = 0) ";
6812
+ if (adulto && adulto.trim() != '') {
6813
+ query += "and richiedente_adulto = :adulto "
6814
+ }
6815
+ if (alunno && alunno.trim() != '') {
6816
+ query += "and richiedente_alunno = :alunno "
6817
+ }
6806
6818
  if (data_da || data_a) {
6807
6819
  query += " and ";
6808
6820
  if (data_da) {
@@ -6828,18 +6840,18 @@ function queryConsegneMySQL(data_da, data_a, data_filter) {
6828
6840
 
6829
6841
  return query;
6830
6842
  }
6831
- function queryConsegne(db_used,data_da, data_a, data_filter) {
6843
+ function queryConsegne(db_used,data_da, data_a, data_filter, adulto, alunno) {
6832
6844
  var query = "";
6833
6845
  if (db_used) {
6834
6846
  switch (db_used) {
6835
6847
  case 'SQLITE':
6836
- query = queryConsegneSQLite(data_da, data_a, data_filter);
6848
+ query = queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno);
6837
6849
  break;
6838
6850
  case 'MYSQL':
6839
- query = queryConsegneMySQL(data_da, data_a, data_filter);
6851
+ query = queryConsegneMySQL(data_da, data_a, data_filter, adulto, alunno);
6840
6852
  break;
6841
6853
  case 'MYSQL2':
6842
- query = queryConsegneSQLite(data_da, data_a, data_filter);
6854
+ query = queryConsegneSQLite(data_da, data_a, data_filter, adulto, alunno);
6843
6855
  break;
6844
6856
  }
6845
6857
  }
@@ -7533,9 +7545,9 @@ function insertConsegnaSQLite(consegna) {
7533
7545
  query += "'" + consegnaObj.data_limite_str + "',";
7534
7546
  query += consegnaObj.stato_res + ",";
7535
7547
  query += "'" + consegnaObj.data_rest_str + "',";
7536
- query += "'" + consegnaObj.adulto + "',";
7537
- query += "'" + consegnaObj.alunno + "',";
7538
- query += "'" + consegnaObj.genitore + "',";
7548
+ query += "upper('" + consegnaObj.adulto + "'),";
7549
+ query += "upper('" + consegnaObj.alunno + "'),";
7550
+ query += "upper('" + consegnaObj.genitore + "'),";
7539
7551
  query += "'" + consegnaObj.id_place + "',";
7540
7552
  query += consegnaObj.id_site + ",";
7541
7553
  query += consegnaObj.is_home + ",";
@@ -8214,8 +8226,19 @@ function selectBeneConsegna(db_used, id_benecons) {
8214
8226
  }
8215
8227
  // End Consegna beni
8216
8228
 
8229
+ function getAdultiConsegnaCombo() {
8230
+ var query = "select DISTINCT richiedente_adulto from consegne ";
8231
+ query += "where richiedente_adulto is not null and trim(richiedente_adulto) <> '' ";
8232
+ query += "order by richiedente_adulto";
8233
+ return query;
8234
+ }
8217
8235
 
8218
-
8236
+ function getAlunniConsegnaCombo() {
8237
+ var query = "select DISTINCT richiedente_alunno from consegne ";
8238
+ query += "where richiedente_alunno is not null and trim(richiedente_alunno) <> '' ";
8239
+ query += "order by richiedente_alunno";
8240
+ return query;
8241
+ }
8219
8242
 
8220
8243
 
8221
8244
  function selectDevicePerConsegnaSQLite(id_consegna) {
@@ -14512,6 +14535,8 @@ module.exports = {
14512
14535
  removeConsegnaBene,
14513
14536
  selectBeniPerConsegna,
14514
14537
  selectBeneConsegna,
14538
+ getAdultiConsegnaCombo,
14539
+ getAlunniConsegnaCombo,
14515
14540
  selectDevicePerConsegna,
14516
14541
  selectDeviceConsegna,
14517
14542
  selectSoftwarePerConsegna,
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.76",
7
+ "version": "3.0.77",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",