alsmanager_lib 1.0.35 → 1.0.37

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 +36 -8
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -5326,6 +5326,33 @@ function selectDocumentiByIdDismissione(db_used,id_dismiss) {
5326
5326
  return query;
5327
5327
  }
5328
5328
 
5329
+ function selectDocumentoDismissioneByIdSQLite(id_docdismiss) {
5330
+ var query = "select id, tipo, data_emissione, descrizione, riferimento, nome_originale, nome_uuid from dismissione_docs ";
5331
+ query += "where id = " + id_docdismiss;
5332
+ return query;
5333
+ }
5334
+
5335
+ function selectDocumentoDismissioneByIdMySQL(id_docdismiss) {
5336
+ var query = "select id, id_dismissione, id_documento from dismissione_docs ";
5337
+ query += "where id = :id_docdismiss";
5338
+ return query;
5339
+ }
5340
+ function selectDocumentoDismissioneById(db_used, id_docdismiss) {
5341
+ var query = "";
5342
+ if (db_used) {
5343
+ switch (db_used) {
5344
+ case 'SQLITE':
5345
+ query = selectDocumentoDismissioneByIdSQLite(id_docdismiss);
5346
+ break;
5347
+ case 'MYSQL':
5348
+ query = selectDocumentoDismissioneByIdMySQL(id_docdismiss);
5349
+ break;
5350
+ }
5351
+ }
5352
+ return query;
5353
+ }
5354
+
5355
+
5329
5356
  function insertDocumentoDismissioneSQLite(id_dismiss, id_doc) {
5330
5357
  var query = "insert into dismissioni_docs (id_dismissione, id_documento) values ";
5331
5358
  query += "(" + id_dismiss + ", " + id_doc + ")";
@@ -5517,15 +5544,15 @@ function queryDocumentoTypes() {
5517
5544
  function selectDocumentiComboSQLite(tipo, anno_emissione) {
5518
5545
  var where_clause = "";
5519
5546
  var query = "select id, concat(tipo, ' - ', descrizione, ' - ', data_emissione, ' - ', riferimento) as doc from documenti ";
5520
- if (tipo || anno_emissione) {
5547
+ if ((tipo && tipo.trim() != '') || (anno_emissione && anno_emissione.trim() != '')) {
5521
5548
  where_clause = "where ";
5522
- if (tipo && tipo != '') {
5549
+ if (tipo && tipo.trim() != '') {
5523
5550
  where_clause += "tipo = '" + tipo + "' ";
5524
- if (anno_emissione && anno_emissione > 0) {
5551
+ if (anno_emissione && anno_emissione.trim() != '') {
5525
5552
  where_clause += " and ";
5526
5553
  }
5527
5554
  }
5528
- if (anno_emissione && anno_emissione > 0){
5555
+ if (anno_emissione && anno_emissione.trim() != ''){
5529
5556
  where_clause += "substr(data_emissione, 1,4) = '" + anno_emissione + "' ";
5530
5557
  }
5531
5558
  }
@@ -5537,15 +5564,15 @@ function selectDocumentiComboSQLite(tipo, anno_emissione) {
5537
5564
  function selectDocumentiComboMySQL(tipo, anno_emissione) {
5538
5565
  var where_clause = "";
5539
5566
  var query = "select id, concat(tipo, ' - ', descrizione, ' - ', data_emissione, ' - ', riferimento) as doc from documenti ";
5540
- if (tipo || anno_emissione) {
5567
+ if ((tipo && tipo.trim() != '') || (anno_emissione && anno_emissione.trim() != '')) {
5541
5568
  where_clause = "where ";
5542
- if (tipo && tipo != '') {
5569
+ if (tipo && tipo.trim() != '') {
5543
5570
  where_clause += "tipo = :tipo ";
5544
- if (anno_emissione && anno_emissione > 0) {
5571
+ if (anno_emissione && anno_emissione.trim() != '') {
5545
5572
  where_clause += " and ";
5546
5573
  }
5547
5574
  }
5548
- if (anno_emissione && anno_emissione > 0){
5575
+ if (anno_emissione && anno_emissione.trim() != ''){
5549
5576
  where_clause += "substr(data_emissione, 1,4) = :anno_emissione ";
5550
5577
  }
5551
5578
  }
@@ -7273,6 +7300,7 @@ module.exports = {
7273
7300
  removeDismissioneDeviceFromDismissione,
7274
7301
  queryLastDismissioneId,
7275
7302
  selectDocumentiByIdDismissione,
7303
+ selectDocumentoDismissioneById,
7276
7304
  insertDocumentoDismissione,
7277
7305
  updateDocumentoDismissione,
7278
7306
  removeDocumentoDismissione,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",