alsmanager_lib 2.0.50 → 2.0.51
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.
- package/lib/modules.js +56 -0
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -5228,6 +5228,61 @@ function querySelectGestioniDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
|
5228
5228
|
return query;
|
|
5229
5229
|
}
|
|
5230
5230
|
|
|
5231
|
+
function getLastGestioneDeviceByIdDeviceSQLite(id_device, date_ref) {
|
|
5232
|
+
var query = "select dg.id, dg.id_gestione, dg.date_start, dg_date_end, from device_gestioni dg ";
|
|
5233
|
+
query += "where dg.id_device = " + id_device;
|
|
5234
|
+
if (date_ref) {
|
|
5235
|
+
switch (date_ref) {
|
|
5236
|
+
case "current":
|
|
5237
|
+
query += " and ";
|
|
5238
|
+
query += " (date('now') >= dg.date_start and date('now') <= dg.date_end)";
|
|
5239
|
+
break;
|
|
5240
|
+
default:
|
|
5241
|
+
query += " and ";
|
|
5242
|
+
query += " ('" + date_ref + "' >= dg.date_start and '" + date_ref + "' <= dg.date_end)";
|
|
5243
|
+
break;
|
|
5244
|
+
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
query += " order by date_start desc LIMIT 1"
|
|
5248
|
+
return query;
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5251
|
+
function getLastGestioneDeviceByIdDeviceMySQL(id_device, date_ref) {
|
|
5252
|
+
var query = "select dg.id, dg.id_gestione, dg.date_start, dg_date_end, from device_gestioni dg ";
|
|
5253
|
+
query += "where dg.id_device = " + id_device;
|
|
5254
|
+
if (date_ref) {
|
|
5255
|
+
switch (date_ref) {
|
|
5256
|
+
case "current":
|
|
5257
|
+
query += " and ";
|
|
5258
|
+
query += " (CURDATE() >= dg.date_start and CURDATE() <= dg.date_end)";
|
|
5259
|
+
break;
|
|
5260
|
+
default:
|
|
5261
|
+
query += " and ";
|
|
5262
|
+
query += " (:date_ref >= date_start and :date_ref <= date_end)";
|
|
5263
|
+
break;
|
|
5264
|
+
|
|
5265
|
+
}
|
|
5266
|
+
}
|
|
5267
|
+
query += " order by date_start desc LIMIT 1"
|
|
5268
|
+
return query;
|
|
5269
|
+
}
|
|
5270
|
+
|
|
5271
|
+
function getLastGestioneDeviceByIdDevice(db_used,id_device, date_ref) {
|
|
5272
|
+
var query = "";
|
|
5273
|
+
if (db_used) {
|
|
5274
|
+
switch (db_used) {
|
|
5275
|
+
case 'SQLITE':
|
|
5276
|
+
query = getLastGestioneDeviceByIdDeviceSQLite(id_device, date_ref);
|
|
5277
|
+
break;
|
|
5278
|
+
case 'MYSQL':
|
|
5279
|
+
query = getLastGestioneDeviceByIdDeviceMySQL(id_device, date_ref);
|
|
5280
|
+
break;
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5283
|
+
return query;
|
|
5284
|
+
}
|
|
5285
|
+
|
|
5231
5286
|
function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
5232
5287
|
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 from consegne";
|
|
5233
5288
|
query += " where (removed is null or removed = 0) ";
|
|
@@ -9835,6 +9890,7 @@ module.exports = {
|
|
|
9835
9890
|
queryInsertGestioneDevice,
|
|
9836
9891
|
querySelectExistsGestioneDeviceByIds,
|
|
9837
9892
|
querySelectGestioniDeviceByIdDevice,
|
|
9893
|
+
getLastGestioneDeviceByIdDevice,
|
|
9838
9894
|
queryConsegne,
|
|
9839
9895
|
queryConsegnaById,
|
|
9840
9896
|
createConsegnaMySQLObj,
|