alsmanager_lib 3.0.161 → 3.0.163

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 +29 -9
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -9982,7 +9982,7 @@ function removeDismissioneById(db_used, id_dismiss) {
9982
9982
  function selectDismissioneDevicesByIdDismissSQLite(id_dismiss) {
9983
9983
  var query = "select dm.id, ";
9984
9984
  query += "case ";
9985
- query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,iif(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'') ";
9985
+ query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,iif(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'')) ";
9986
9986
  query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
9987
9987
  query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
9988
9988
  query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
@@ -10002,7 +10002,7 @@ function selectDismissioneDevicesByIdDismissSQLite(id_dismiss) {
10002
10002
  function selectDismissioneDevicesByIdDismissMySQL(id_dismiss) {
10003
10003
  var query = "select dm.id, ";
10004
10004
  query += "case ";
10005
- query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,iif(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'') ";
10005
+ query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number,iif(d.part_of is not null and trim(d.part_of) <> '', concat('/',d.part_of),'')) ";
10006
10006
  query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
10007
10007
  query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
10008
10008
  query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
@@ -12161,36 +12161,56 @@ function getSitesFromDevice(db_used, id_device, date_ref, prec_pos) {
12161
12161
  }
12162
12162
  //End Sites by devices
12163
12163
  //Sites from device with date
12164
- function getSitesWithDatesFromDeviceSQLite(id_device) {
12164
+ function getSitesWithDatesFromDeviceSQLite(id_device, date_ref) {
12165
+ var dr_str = "";
12166
+ if (date_ref) {
12167
+ var dr = new Date(date_ref);
12168
+ dr_str = convertDateToStringDB(dr);
12169
+ }
12170
+ else {
12171
+ var dr = new Date();
12172
+ dr_str = convertDateToStringDB(dr);
12173
+ }
12165
12174
  var query = "SELECT DISTINCT ds.date_in as 'Data inizio', ds.date_out as 'Data fine', sd.id_place as Plesso, s.mark as Sigla, sd.name as Destinazione from device_site ds ";
12166
12175
  query += "join site_destinations sd on sd.id_site = ds.id_site ";
12167
12176
  query += "join sites s on s.id = sd.id_site ";
12168
- query += "where ds.id_device = " + id_device;
12177
+ query += "where ds.id_device = " + id_device + " ";
12178
+ query += "and ds.date_start <= '" + dr_str + "' and ds.date_end >= '" + dr_str + "' ";
12169
12179
  query += " order by date_in";
12170
12180
  return query;
12171
12181
  }
12172
12182
 
12173
- function getSitesWithDatesFromDeviceMySQL(id_device) {
12183
+ function getSitesWithDatesFromDeviceMySQL(id_device, date_ref) {
12184
+ var dr_str = "";
12185
+ if (date_ref) {
12186
+ var dr = new Date(date_ref);
12187
+ dr_str = convertDateToStringDB(dr);
12188
+ }
12189
+ else {
12190
+ var dr = new Date();
12191
+ dr_str = convertDateToStringDB(dr);
12192
+ }
12174
12193
  var query = "SELECT DISTINCT ds.date_in as 'Data inizio', ds.date_out as 'Data fine', sd.id_place as Plesso, s.mark as Sigla, sd.name as Destinazione from device_site ds ";
12175
12194
  query += "join site_destinations sd on sd.id_site = ds.id_site ";
12176
12195
  query += "join sites s on s.id = sd.id_site ";
12177
12196
  query += "where ds.id_device = :id_device ";
12197
+ query += "and ds.date_start <= '" + dr_str + "' and ds.date_end >= '" + dr_str + "' ";
12178
12198
  query += "order by date_in";
12179
12199
  return query;
12180
12200
  }
12181
12201
 
12182
- function getSitesWithDatesFromDevice(db_used, id_device) {
12202
+ function getSitesWithDatesFromDevice(db_used, id_device, date_ref) {
12183
12203
  var query = "";
12184
12204
  if (db_used) {
12185
12205
  switch (db_used) {
12186
12206
  case 'SQLITE':
12187
- query = getSitesWithDatesFromDeviceSQLite(id_device);
12207
+ query = getSitesWithDatesFromDeviceSQLite(id_device, date_ref);
12188
12208
  break;
12189
12209
  case 'MYSQL':
12190
- query = getSitesWithDatesFromDeviceMySQL(id_device);
12210
+ query = getSitesWithDatesFromDeviceMySQL(id_device, date_ref);
12191
12211
  break;
12192
12212
  case 'MYSQL2':
12193
- query = getSitesWithDatesFromDeviceSQLite(id_device);
12213
+ query = getSitesWithDatesFromDeviceSQLite(id_device, date_ref);
12194
12214
  break;
12195
12215
  }
12196
12216
  }
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.161",
7
+ "version": "3.0.163",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",