alsmanager_lib 1.0.45 → 1.0.47

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 -15
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -5300,7 +5300,7 @@ function queryLastDismissioneId(db_used) {
5300
5300
  }
5301
5301
 
5302
5302
  function selectDocumentiByIdDismissioneSQLite(id_dismiss) {
5303
- var query = "select distinct doc.id, doc.descrizione, doc.data_emissione from device_dismissioni ds ";
5303
+ var query = "select distinct doc.id_doc, doc.descrizione, doc.data_emissione from device_dismissioni ds ";
5304
5304
  query += "join devices d on d.id = ds.id_device ";
5305
5305
  query += "join device_doc dc on dc.id_device = ds.id_device ";
5306
5306
  query += "join dismissioni dm on dm.id = ds.id_dismissione ";
@@ -5578,25 +5578,27 @@ function insertDocumentoDevice(db_used, id_device, id_doc, scopo) {
5578
5578
  }
5579
5579
 
5580
5580
 
5581
- function removeDocumentoDeviceSQLite(id_docdev) {
5581
+ function removeDocumentoDeviceSQLite(id_device, id_doc) {
5582
5582
  var query = "delete from device_doc ";
5583
- query += "where id = " + id_docdev;
5583
+ query += "where id_device = " + id_device + " and ";
5584
+ query += "id_doc = " + id_doc;
5584
5585
  return query;
5585
5586
  }
5586
- function removeDocumentoDeviceMySQL(id_docdev) {
5587
+ function removeDocumentoDeviceMySQL(id_device, id_doc) {
5587
5588
  var query = "delete from device_doc ";
5588
- query += "where id = :id_docdev";
5589
+ query += "where id_device = :id_device and ";
5590
+ query += "id_doc = :id_doc";
5589
5591
  return query;
5590
5592
  }
5591
- function removeDocumentoDevice(db_used, id_docdev) {
5593
+ function removeDocumentoDevice(db_used, id_device, id_doc) {
5592
5594
  var query = "";
5593
5595
  if (db_used) {
5594
5596
  switch (db_used) {
5595
5597
  case 'SQLITE':
5596
- query = removeDocumentoDeviceSQLite(id_docdev);
5598
+ query = removeDocumentoDeviceSQLite(id_device, id_doc);
5597
5599
  break;
5598
5600
  case 'MYSQL':
5599
- query = removeDocumentoDeviceMySQL(id_docdev);
5601
+ query = removeDocumentoDeviceMySQL(id_device, id_doc);
5600
5602
  break;
5601
5603
  }
5602
5604
  }
@@ -5680,16 +5682,12 @@ function getDocumentByIdDoc(db_used, id_doc) {
5680
5682
  return query;
5681
5683
  }
5682
5684
 
5683
- function selectDocumentoByIdSQLite(id_doc) {
5684
- var query = "select id, tipo, data_emissione, descrizione, riferimento, nome_originale, nome_uuid from documenti ";
5685
- query += "where id = " + id_doc;
5686
- return query;
5685
+ function selectDocumentoByIdSQLite(id_doc) {
5686
+ return getDocumentByIdDocSQLite(id_doc);
5687
5687
  }
5688
5688
 
5689
5689
  function selectDocumentoByIdMySQL(id_doc) {
5690
- var query = "select id, tipo, data_emissione, descrizione, riferimento, nome_originale, nome_uuid from documenti ";
5691
- query += "where id = :id_doc";
5692
- return query;
5690
+ return getDocumentByIdDocMySQL(id_doc);
5693
5691
  }
5694
5692
  function selectDocumentoById(db_used, id_doc) {
5695
5693
  var query = "";
@@ -5710,6 +5708,10 @@ function queryDocumentoTypes() {
5710
5708
  return "select tipo, descrizione from documento_types order by tipo";
5711
5709
  }
5712
5710
 
5711
+ function queryDocumentoMotivo() {
5712
+ return "select scopo, descrizione from documento_scopo order by scopo";
5713
+ }
5714
+
5713
5715
  function selectDocumentiComboSQLite(tipo, anno_emissione) {
5714
5716
  var where_clause = "";
5715
5717
  var query = "select id, concat(tipo, ' - ', descrizione, ' - ', data_emissione, ' - ', riferimento) as doc from documenti ";
@@ -7451,6 +7453,7 @@ module.exports = {
7451
7453
  removeDocumento,
7452
7454
  getDocumentByIdDoc,
7453
7455
  queryDocumentoTypes,
7456
+ queryDocumentoMotivo,
7454
7457
  checkDocumentoDevice,
7455
7458
  selectDocumentoDeviceById,
7456
7459
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",