alsmanager_lib 3.0.203 → 3.0.204

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 +56 -4
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1374,7 +1374,7 @@ function getUtentiByIdDeviceMySQL(id_device) {
1374
1374
  }
1375
1375
 
1376
1376
 
1377
- function getUtentiByIdDeviceSQLiteMYSQL2(id_device) {
1377
+ function getUtentiByIdDeviceMYSQL2(id_device) {
1378
1378
  var query = "select au.id, au.cognome_denominazione, au.nome, au.titolo from device_utenza du ";
1379
1379
  query += "join anagrafica_utenze au on au.id = du.id_utenza ";
1380
1380
  query += "where du.id_device = " + id_device + " ";
@@ -1394,7 +1394,7 @@ function getUtentiByIdDevice(db_used, id_device) {
1394
1394
  query = getUtentiByIdDeviceMySQL(id_device);
1395
1395
  break;
1396
1396
  case 'MYSQL2':
1397
- query = getUtentiByIdDeviceSQLiteMYSQL2(id_device);
1397
+ query = getUtentiByIdDeviceMYSQL2(id_device);
1398
1398
  break;
1399
1399
  }
1400
1400
  }
@@ -1415,8 +1415,42 @@ function removeUtentePerDevice(id_dev_user) {
1415
1415
 
1416
1416
  // End Anagrafica utenti
1417
1417
  //Anagrafica docenti
1418
- function getDocentiCombo(db_used, id_place, ordine_scuola, ruolo) {
1419
- var query = "select id, concat(cognome, ' ', nome, ' - ', ordine, ' - ', ruolo) as nominativo from anagrafica_docenti ";
1418
+ function getDocentiComboSQLite(id_place, ordine_scuola, ruolo) {
1419
+ var query = "select id, concat(cognome, ' ', nome, iif(ordine is not null, concat(' - ', ordine), ' '), iif(ruolo is not null, concat(' - ', ruolo), ' ')) as nominativo from anagrafica_docenti ";
1420
+ query += "where is_attivo = 1 "
1421
+ if (ordine_scuola && ordine_scuola.trim() != '') {
1422
+ query += "and (ordine = '" + ordine_scuola + "' or ruolo <> 'DOCENTE') ";
1423
+ }
1424
+ if (id_place && id_place.trim() != '') {
1425
+ query += "and (id_place = '" + id_place + "' or id_place is null) ";
1426
+ }
1427
+ if (ruolo && ruolo.trim() != '') {
1428
+ query += "and ruolo = '" + ruolo + "' ";
1429
+ }
1430
+ query += "order by cognome, nome";
1431
+ return query;
1432
+ }
1433
+
1434
+
1435
+
1436
+ function getDocentiComboMySQL(id_place, ordine_scuola, ruolo) {
1437
+ var query = "select id, concat(cognome, ' ', nome, if(ordine is not null, concat(' - ', ordine), ' '), if(ruolo is not null, concat(' - ', ruolo), ' ')) as nominativo from anagrafica_docenti ";
1438
+ query += "where is_attivo = 1 "
1439
+ if (ordine_scuola && ordine_scuola.trim() != '') {
1440
+ query += "and (ordine = '" + ordine_scuola + "' or ruolo <> 'DOCENTE') ";
1441
+ }
1442
+ if (id_place && id_place.trim() != '') {
1443
+ query += "and (id_place = '" + id_place + "' or id_place is null) ";
1444
+ }
1445
+ if (ruolo && ruolo.trim() != '') {
1446
+ query += "and ruolo = '" + ruolo + "' ";
1447
+ }
1448
+ query += "order by cognome, nome";
1449
+ return query;
1450
+ }
1451
+
1452
+ function getDocentiComboMySQL2(id_place, ordine_scuola, ruolo) {
1453
+ var query = "select id, concat(cognome, ' ', nome, if(ordine is not null, concat(' - ', ordine), ' '), if(ruolo is not null, concat(' - ', ruolo), ' ')) as nominativo from anagrafica_docenti ";
1420
1454
  query += "where is_attivo = 1 "
1421
1455
  if (ordine_scuola && ordine_scuola.trim() != '') {
1422
1456
  query += "and (ordine = '" + ordine_scuola + "' or ruolo <> 'DOCENTE') ";
@@ -1431,6 +1465,24 @@ function getDocentiCombo(db_used, id_place, ordine_scuola, ruolo) {
1431
1465
  return query;
1432
1466
  }
1433
1467
 
1468
+ function getDocentiCombo(db_used, id_place, ordine_scuola, ruolo) {
1469
+ var query = "";
1470
+ if (db_used) {
1471
+ switch (db_used) {
1472
+ case 'SQLITE':
1473
+ query = getDocentiComboSQLite(id_place, ordine_scuola, ruolo);
1474
+ break;
1475
+ case 'MYSQL':
1476
+ query = getDocentiComboMySQL(id_place, ordine_scuola, ruolo);
1477
+ break;
1478
+ case 'MYSQL2':
1479
+ query = getDocentiComboMySQL2(id_place, ordine_scuola, ruolo);
1480
+ break;
1481
+ }
1482
+ }
1483
+ return query;
1484
+ }
1485
+
1434
1486
  function getDocenteById(db_used, id_docente) {
1435
1487
  var query = "select id, cognome, nome, email, id_place, ordine, ruolo, is_attivo from anagrafica_docenti ";
1436
1488
  query += "where id = " + id_docente;
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.203",
7
+ "version": "3.0.204",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",