alsmanager_lib 3.0.2 → 3.0.4

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 +47 -5
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -12127,12 +12127,37 @@ function getAltroBeneManifacturerCombo() {
12127
12127
  return query;
12128
12128
  }
12129
12129
 
12130
- function getAltroBeneModelCombo(manifacturer) {
12130
+ function getAltroBeneModelComboSQLite(manifacturer) {
12131
12131
  var query = "select DISTINCT model from altri_beni ";
12132
- query += "where manifacturer = '" + manifacturer + "'";
12132
+ query += "where manifacturer = '" + manifacturer + "' ";
12133
+ query += "order by model";
12133
12134
  return query;
12134
12135
  }
12135
12136
 
12137
+ function getAltroBeneModelComboMySQL(manifacturer) {
12138
+ var query = "select DISTINCT model from altri_beni ";
12139
+ query += "where manifacturer = :manifacturer ";
12140
+ query += "order by model";
12141
+ return query;
12142
+ }
12143
+
12144
+ function getAltroBeneModelCombo(db_used, manifacturer) {
12145
+ var query = "";
12146
+ if (db_used) {
12147
+ switch (db_used) {
12148
+ case 'SQLITE':
12149
+ query = getAltroBeneModelComboSQLite(manifacturer);
12150
+ break;
12151
+ case 'MYSQL':
12152
+ query = getAltroBeneModelComboMySQL(manifacturer);
12153
+ break;
12154
+ case 'MYSQL2':
12155
+ query = getAltroBeneModelComboSQLite(manifacturer);
12156
+ break;
12157
+ }
12158
+ }
12159
+ return query;
12160
+ }
12136
12161
 
12137
12162
  function getAltroBeneByIdSQLite(id_bene) {
12138
12163
  var query = "select id, inv_ict3_number, inv_comune_prov, id_type, descrizione, manifacturer, model, note from altri_beni ";
@@ -12163,7 +12188,15 @@ function getAltroBeneById(db_used, id_bene) {
12163
12188
  }
12164
12189
 
12165
12190
  function getAltriBeniSQLite(id_type, manifacturer, model, id_site, id_place) {
12166
- var query = "select ab.id, ab.inv_ict3_number, ab.inv_comune_prov, ab.id_type, ab.descrizione, ab.manifacturer, ab.model, ab.note from altri_beni ab ";
12191
+ var query = "select ab.id, ";
12192
+ query += "case ";
12193
+ query += "when ab.inv_ict3_number is not null and trim(ab.inv_ict3_number) <> '' then concat(ab.inv_ict3_number, ' (inv.)') ";
12194
+ query += "when ab.inv_comune_prov is not null and trim(ab.inv_comune_prov) <> '' then concat(ab.inv_comune_prov, ' (TN/Prov)') ";
12195
+ query += "when ab.serial_no is not null and trim(ab.serial_no) <> '' then concat(ab.serial_no, ' (S/N)') ";
12196
+ query += "else '' ";
12197
+ query += "end as codice, ";
12198
+ query += "a.name as tipo, ab.descrizione, ab.manifacturer, ab.model, ab.note from altri_beni ab ";
12199
+ query += "join altro_tipi a on a.id = ab.id_type "
12167
12200
  if ((id_site && id_site > 0) || (id_place && id_place != '')) {
12168
12201
  query += "left join altri_beni_site s on ab.id = s.id_bene ";
12169
12202
  }
@@ -12197,7 +12230,15 @@ function getAltriBeniSQLite(id_type, manifacturer, model, id_site, id_place) {
12197
12230
  return query;
12198
12231
  }
12199
12232
  function getAltriBeniMySQL(id_type, manifacturer, model, id_site, id_place) {
12200
- var query = "select ab.id, ab.inv_ict3_number, ab.inv_comune_prov, ab.id_type, ab.descrizione, ab.manifacturer, ab.model, note from altri_beni ";
12233
+ var query = "select ab.id, ";
12234
+ query += "case ";
12235
+ query += "when ab.inv_ict3_number is not null and trim(ab.inv_ict3_number) <> '' then concat(ab.inv_ict3_number, ' (inv.)') ";
12236
+ query += "when ab.inv_comune_prov is not null and trim(ab.inv_comune_prov) <> '' then concat(ab.inv_comune_prov, ' (TN/Prov)') ";
12237
+ query += "when ab.serial_no is not null and trim(ab.serial_no) <> '' then concat(ab.serial_no, ' (S/N)') ";
12238
+ query += "else '' ";
12239
+ query += "end as codice, ";
12240
+ query += "a.name as tipo, ab.descrizione, ab.manifacturer, ab.model, ab.note from altri_beni ab ";
12241
+ query += "join altro_tipi a on a.id = ab.id_type "
12201
12242
  if ((id_site && id_site > 0) || (id_place && id_place != '')) {
12202
12243
  query += "left join altri_beni_site s on ab.id = s.id_bene ";
12203
12244
  }
@@ -12231,7 +12272,8 @@ function getAltriBeniMySQL(id_type, manifacturer, model, id_site, id_place) {
12231
12272
  return query;
12232
12273
  }
12233
12274
  function getAltriBeniMySQL2(id_type, manifacturer, model, id_site, id_place) {
12234
- var query = "select ab.id, ab.inv_ict3_number, ab.inv_comune_prov, ab.id_type, ab.descrizione, ab.manifacturer, ab.model, ab.note from altri_beni ab ";
12275
+ var query = "select ab.id, ab.inv_ict3_number, ab.inv_comune_prov, a.name as tipo, ab.descrizione, ab.manifacturer, ab.model, ab.note from altri_beni ab ";
12276
+ query += "join altro_tipi a on a.id = ab.id_type "
12235
12277
  if ((id_site && id_site > 0) || (id_place && id_place != '')) {
12236
12278
  query += "left join altri_beni_site s on ab.id = s.id_bene ";
12237
12279
  }
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.2",
7
+ "version": "3.0.4",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",