alsmanager_lib 2.0.28 → 2.0.29

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 +13 -7
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -2229,7 +2229,7 @@ function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, is_PN
2229
2229
  }
2230
2230
  // End Device select
2231
2231
  // Device Select by site
2232
- function getDevicesSelectBySiteSQLite(id_site) {
2232
+ function getDevicesSelectBySiteSQLite(id_site, dev_type) {
2233
2233
  var query = "select distinct devices.id, devices.type as Tipo, devices.manifacturer as Marca, devices.model as modello, ";
2234
2234
  query += "case ";
2235
2235
  query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
@@ -2248,11 +2248,14 @@ function getDevicesSelectBySiteSQLite(id_site) {
2248
2248
  query += "inner join sites on sites.id = device_site.id_site ";
2249
2249
  query += "where (date('now') >= device_site.date_in and date('now') <= device_site.date_out) ";
2250
2250
  query += "and (devices.is_removed is null or devices.is_removed = 0) ";
2251
- query += "and sites.id = " + id_site;
2251
+ query += "and sites.id = " + id_site + " ";
2252
+ if (dev_type && dev_type != '') {
2253
+ query += "and devices.type = '" + dev_type + "' ";
2254
+ }
2252
2255
  return query;
2253
2256
  }
2254
2257
 
2255
- function getDevicesSelectBySiteMySQL(id_site) {
2258
+ function getDevicesSelectBySiteMySQL(id_site, dev_type) {
2256
2259
  var query = "select DISTINCT devices.id, devices.type as Tipo, devices.manifacturer as Marca, devices.model as modello, ";
2257
2260
  query += "case ";
2258
2261
  query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
@@ -2271,18 +2274,21 @@ function getDevicesSelectBySiteMySQL(id_site) {
2271
2274
  query += "inner join sites on sites.id = device_site.id_site ";
2272
2275
  query += "where (CURDATE() >= device_site.date_in and CURDATE() <= device_site.date_out) ";
2273
2276
  query += "and (devices.is_removed is null or devices.is_removed = 0) ";
2274
- query += "and sites.id = :id_site";
2277
+ query += "and sites.id = :id_site ";
2278
+ if (dev_type && dev_type != '') {
2279
+ query += "and devices.type = :dev_type ";
2280
+ }
2275
2281
  return query;
2276
2282
  }
2277
- function getDevicesSelectBySite(db_used, id_site) {
2283
+ function getDevicesSelectBySite(db_used, id_site, dev_type) {
2278
2284
  var query = "";
2279
2285
  if (db_used) {
2280
2286
  switch (db_used) {
2281
2287
  case 'SQLITE':
2282
- query = getDevicesSelectBySiteSQLite(id_site);
2288
+ query = getDevicesSelectBySiteSQLite(id_site, dev_type);
2283
2289
  break;
2284
2290
  case 'MYSQL':
2285
- query = getDevicesSelectBySiteMySQL(id_site);
2291
+ query = getDevicesSelectBySiteMySQL(id_site, dev_type);
2286
2292
  break;
2287
2293
  }
2288
2294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "2.0.28",
3
+ "version": "2.0.29",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",