alsmanager_lib 3.0.33 → 3.0.34

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 +61 -22
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -8007,15 +8007,17 @@ function selectDeviceInDepositoSQLite(inv_code) {
8007
8007
  query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
8008
8008
  query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
8009
8009
  query += "end as Codice ";
8010
- query += " from devices d";
8011
- query += " join device_site ds on ds.id_device = d.id"
8012
- query += " join sites s on s.id = ds.id_site"
8013
- query += " join site_destinations sd on sd.id_site = s.id"
8014
- query += " where (inv_ict3_number = '" + inv_code + "' or ";
8010
+ query += "from devices d ";
8011
+ query += "join device_site ds on ds.id_device = d.id "
8012
+ query += "join sites s on s.id = ds.id_site "
8013
+ query += "join site_destinations sd on sd.id_site = s.id "
8014
+ query += "left join consegna_bene cb on d.id = cb.id_bene "
8015
+ query += "where (inv_ict3_number = '" + inv_code + "' or ";
8015
8016
  query += "inv_tn_number = '" + inv_code + "' or ";
8016
- //query += "serial_no like '" + inv_code + "%' or ";
8017
- query += "inv_pnrr_number = '" + inv_code + "') and ";
8018
- query += "sd.type = 'MAGAZZINO'";
8017
+ query += "serial_no = '" + inv_code + "' or ";
8018
+ query += "inv_pnrr_number = '" + inv_code + "') ";
8019
+ query += "and sd.type = 'MAGAZZINO'";
8020
+ query += "and (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2))";
8019
8021
  return query;
8020
8022
  }
8021
8023
  function selectDeviceInDepositoMySQL(inv_code) {
@@ -8027,15 +8029,17 @@ function selectDeviceInDepositoMySQL(inv_code) {
8027
8029
  query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
8028
8030
  query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
8029
8031
  query += "end as Codice ";
8030
- query += " from devices d";
8031
- query += " join device_site ds on ds.id_device = d.id"
8032
- query += " join sites s on s.id = ds.id_site"
8033
- query += " join site_destinations sd on sd.id_site = s.id"
8032
+ query += "from devices d ";
8033
+ query += "join device_site ds on ds.id_device = d.id "
8034
+ query += "join sites s on s.id = ds.id_site "
8035
+ query += "join site_destinations sd on sd.id_site = s.id "
8036
+ query += "left join consegna_bene cb on d.id = cb.id_bene "
8034
8037
  query += " where (inv_ict3_number = :inv_code or ";
8035
8038
  query += "inv_tn_number = :inv_code or ";
8036
- //query += "serial_no like ':inv_code%' or ";
8039
+ query += "serial_no = :inv_code or ";
8037
8040
  query += "inv_pnrr_number = :inv_code) and ";
8038
8041
  query += "sd.type = 'MAGAZZINO'";
8042
+ query += "and (cb.id is null or (cb.tipo_bene = 'DEVICE' and cb.stato_restituzione = 2))";
8039
8043
  return query;
8040
8044
  }
8041
8045
  function selectDeviceInDeposito(db_used, inv_code) {
@@ -8156,16 +8160,53 @@ function selectSoftwareConsegna(db_used, id_consegna, id_software) {
8156
8160
  return query;
8157
8161
  }
8158
8162
 
8159
- function insertConsegnaSoftware() {
8160
-
8163
+ function selectSoftwaresInDepositoSQLite(inv_code) {
8164
+ var query = "SELECT s.id, s.support, s.platform, s.version, s.licence_type, s.maker, s.model, ";
8165
+ query += "case ";
8166
+ query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
8167
+ query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
8168
+ query += "else concat(s.id,'(ID)') ";
8169
+ query += "end as Codice ";
8170
+ query += "from softwares s ";
8171
+ query += "left join consegna_bene cb on d.id = cb.id_bene "
8172
+ query += "where (inv_ict3_number = '" + inv_code + "' or ";
8173
+ query += "serial_no = '" + inv_code + "')";
8174
+ query += "and (cb.id is null or (cb.tipo_bene = 'SOFTWARE' and cb.stato_restituzione = 2))";
8175
+ return query;
8161
8176
  }
8162
- function updateConsegnaSoftware() {
8163
-
8177
+ function selectSoftwaresInDepositoMySQL(inv_code) {
8178
+ var query = "SELECT s.id, s.support, s.platform, s.version, s.licence_type, s.maker, s.model, ";
8179
+ query += "case ";
8180
+ query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
8181
+ query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
8182
+ query += "else concat(s.id,'(ID)') ";
8183
+ query += "end as Codice ";
8184
+ query += "from softwares s ";
8185
+ query += "left join consegna_bene cb on d.id = cb.id_bene "
8186
+ query += "where (inv_ict3_number = :inv_code or ";
8187
+ query += "serial_no = :inv_code)";
8188
+ query += "and (cb.id is null or (cb.tipo_bene = 'SOFTWARE' and cb.stato_restituzione = 2))";
8189
+ return query;
8164
8190
  }
8165
- function removeConsegnaSoftware() {
8166
-
8191
+ function selectSoftwaresInDeposito(db_used, inv_code) {
8192
+ var query = "";
8193
+ if (db_used) {
8194
+ switch (db_used) {
8195
+ case 'SQLITE':
8196
+ query = selectSoftwaresInDepositoSQLite(inv_code);
8197
+ break;
8198
+ case 'MYSQL':
8199
+ query = selectSoftwaresInDepositoMySQL(inv_code);
8200
+ break;
8201
+ case 'MYSQL2':
8202
+ query = selectSoftwaresInDepositoSQLite(inv_code);
8203
+ break;
8204
+ }
8205
+ }
8206
+ return query;
8167
8207
  }
8168
8208
 
8209
+
8169
8210
  //get connection types
8170
8211
  function getConnectionTypesSQLite() {
8171
8212
  var query = "select id, conn_type from connection_types";
@@ -14038,9 +14079,7 @@ module.exports = {
14038
14079
  selectDeviceConsegna,
14039
14080
  selectSoftwarePerConsegna,
14040
14081
  selectSoftwareConsegna,
14041
- insertConsegnaSoftware,
14042
- updateConsegnaSoftware,
14043
- removeConsegnaSoftware,
14082
+ selectSoftwaresInDeposito,
14044
14083
  //
14045
14084
  selectDeviceInDeposito,
14046
14085
  queryDeviceStatusCombo,
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.33",
7
+ "version": "3.0.34",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",