alsmanager_lib 2.0.28 → 2.0.30

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 +18 -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,15 @@ 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
+ }
2255
+ query += "order by devices.type ";
2252
2256
  return query;
2253
2257
  }
2254
2258
 
2255
- function getDevicesSelectBySiteMySQL(id_site) {
2259
+ function getDevicesSelectBySiteMySQL(id_site, dev_type) {
2256
2260
  var query = "select DISTINCT devices.id, devices.type as Tipo, devices.manifacturer as Marca, devices.model as modello, ";
2257
2261
  query += "case ";
2258
2262
  query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
@@ -2271,18 +2275,23 @@ function getDevicesSelectBySiteMySQL(id_site) {
2271
2275
  query += "inner join sites on sites.id = device_site.id_site ";
2272
2276
  query += "where (CURDATE() >= device_site.date_in and CURDATE() <= device_site.date_out) ";
2273
2277
  query += "and (devices.is_removed is null or devices.is_removed = 0) ";
2274
- query += "and sites.id = :id_site";
2278
+ query += "and sites.id = :id_site ";
2279
+ if (dev_type && dev_type != '') {
2280
+ query += "and devices.type = :dev_type ";
2281
+ }
2282
+ query += "order by devices.type ";
2283
+
2275
2284
  return query;
2276
2285
  }
2277
- function getDevicesSelectBySite(db_used, id_site) {
2286
+ function getDevicesSelectBySite(db_used, id_site, dev_type) {
2278
2287
  var query = "";
2279
2288
  if (db_used) {
2280
2289
  switch (db_used) {
2281
2290
  case 'SQLITE':
2282
- query = getDevicesSelectBySiteSQLite(id_site);
2291
+ query = getDevicesSelectBySiteSQLite(id_site, dev_type);
2283
2292
  break;
2284
2293
  case 'MYSQL':
2285
- query = getDevicesSelectBySiteMySQL(id_site);
2294
+ query = getDevicesSelectBySiteMySQL(id_site, dev_type);
2286
2295
  break;
2287
2296
  }
2288
2297
  }
@@ -2313,6 +2322,7 @@ function getDevicesSelectByPlaceSQLite(id_place, dev_type) {
2313
2322
  if (dev_type && dev_type != '') {
2314
2323
  query += "and devices.type = '" + dev_type + "' ";
2315
2324
  }
2325
+ query += "order by devices.type ";
2316
2326
  return query;
2317
2327
  }
2318
2328
 
@@ -2339,6 +2349,7 @@ function getDevicesSelectByPlaceMySQL(id_place, dev_type) {
2339
2349
  if (dev_type && dev_type != '') {
2340
2350
  query += "and devices.type = :dev_type ";
2341
2351
  }
2352
+ query += "order by devices.type ";
2342
2353
  return query;
2343
2354
  }
2344
2355
  function getDevicesSelectByPlace(db_used, id_place, dev_type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "2.0.28",
3
+ "version": "2.0.30",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",