alsmanager_lib 3.0.98 → 3.0.100

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 +60 -3
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -11102,6 +11102,58 @@ function querySites(db_used, place, piano, funzione, date_ref) {
11102
11102
 
11103
11103
  }
11104
11104
 
11105
+ function writeSite(id_place, mark, floor, size) {
11106
+ var query = "insert into sites (id_place, mark, flooor, size) values ";
11107
+ query += "('" + id_place + "', ";
11108
+ query += "'" + mark + "', ";
11109
+ query += floor + ", ";
11110
+ query += size + ") ";
11111
+ return query;
11112
+ }
11113
+
11114
+ function updateSite(id_site, id_place, mark, floor, size) {
11115
+ var query = "update sites set ";
11116
+ query += "id_place = '" + id_place + "', ";
11117
+ query += "mark = '" + mark + "', ";
11118
+ query += "floor = " + floor + ", ";
11119
+ query += "size = " + size + " ";
11120
+ query += "where id = " + id_site;
11121
+ return query;
11122
+ }
11123
+
11124
+ function writeSiteDestination(id_site, id_place, date_start, date_end, name, funzione) {
11125
+ var query = "insert into site_destinations (id_site, id_place, date_start, date_end, name, type) values ";
11126
+ query += "(" + id_site + ", ";
11127
+ query += "'" + id_place + "', ";
11128
+ query += "'" + date_start + "', ";
11129
+ query += "'" + date_end + "', ";
11130
+ query += "'" + name + "', ";
11131
+ query += "'" + funzione + "' ";
11132
+ return query;
11133
+ }
11134
+
11135
+ function updateSiteDestination(id_site, id_place, date_start, date_end, name, funzione) {
11136
+ var query = "update site_destinations set ";
11137
+ query += "'" + date_start + "', ";
11138
+ query += "'" + date_end + "', ";
11139
+ if (name) {
11140
+ query += "name = '" + name + "', ";
11141
+ }
11142
+ if (funzione) {
11143
+ query += "type = '" + funzione + "' ";
11144
+ }
11145
+ query += "where id_site = " + id_site + " and id_place = '" + id_place + "'";
11146
+ return query;
11147
+ }
11148
+
11149
+ function getSiteDestinationsByIdSite(id_site, id_place) {
11150
+ var query = "select date_start, date_end, name, type from site_destinations ";
11151
+ query += "where id_site = " + id_site + " and id_place = '" + id_place + "' ";
11152
+ query += "order by date_start desc ";
11153
+ return query;
11154
+ }
11155
+
11156
+
11105
11157
  //Sites by devices
11106
11158
  function getSitesFromDeviceSQLite(id_device, prec_pos) {
11107
11159
  var query = "SELECT DISTINCT p.mark as Sigla, p.name as Plesso, sd.name as Aula, sd.type as Funzione, s.floor as Piano from device_site ds ";
@@ -11709,7 +11761,7 @@ function getSitesSelectComboByPlace(db_used, id_place, floor, date_ref) {
11709
11761
  //End Site in Combo Parziale
11710
11762
  // Select Site in Combo Parziale
11711
11763
  function getSitesSelectComboExcludeIdSQLite(id_place, id_site, date_ref) {
11712
- var query = "select s.id, concat(sd.name, ' - ', s.mark) as Descrizione from sites s ";
11764
+ var query = "select s.id, concat('Piano ', s.floor, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
11713
11765
  query += "join site_destinations sd on sd.id_site = s.id ";
11714
11766
  if (date_ref) {
11715
11767
  query += "where '" + date_ref + "' >= sd.date_start and '" + date_ref + "' <= sd.date_end ";
@@ -11724,7 +11776,7 @@ function getSitesSelectComboExcludeIdSQLite(id_place, id_site, date_ref) {
11724
11776
  }
11725
11777
 
11726
11778
  function getSitesSelectComboExcludeIdMySQL(id_place, id_site, date_ref) {
11727
- var query = "select s.id, concat(sd.name, ' - ', s.mark) as Descrizione from sites s ";
11779
+ var query = "select s.id, concat('Piano ', s.floor, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
11728
11780
  query += "join site_destinations sd on sd.id_site = s.id ";
11729
11781
  if (date_ref) {
11730
11782
  query += "where :date_ref >= sd.date_start and :date_ref <= sd.date_end ";
@@ -11739,7 +11791,7 @@ function getSitesSelectComboExcludeIdMySQL(id_place, id_site, date_ref) {
11739
11791
  }
11740
11792
 
11741
11793
  function getSitesSelectComboExcludeIdMySQL2(id_place, id_site, date_ref) {
11742
- var query = "select s.id, concat(sd.name, ' - ', s.mark) as Descrizione from sites s ";
11794
+ var query = "select s.id, concat('Piano ', s.floor, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
11743
11795
  query += "join site_destinations sd on sd.id_site = s.id ";
11744
11796
  if (date_ref) {
11745
11797
  query += "where '" + date_ref + "' >= sd.date_start and '" + date_ref + "' <= sd.date_end ";
@@ -14910,6 +14962,11 @@ module.exports = {
14910
14962
  queryFloorsByPlace,
14911
14963
  queryFunzioneByPlaceAndFloor,
14912
14964
  querySites,
14965
+ writeSite,
14966
+ updateSite,
14967
+ writeSiteDestination,
14968
+ updateSiteDestination,
14969
+ getSiteDestinationsByIdSite,
14913
14970
  getSitesFromDevice,
14914
14971
  getSitesWithDatesFromDevice,
14915
14972
  querySitesWithDefaults,
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.98",
7
+ "version": "3.0.100",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",