alsmanager_lib 3.0.229 → 3.0.230

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 +57 -15
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -17384,46 +17384,81 @@ CREATE TABLE `printer_cartridges` (
17384
17384
  `descrizione` varchar(50) DEFAULT NULL,
17385
17385
  `color` char(20) DEFAULT NULL,
17386
17386
  `numero` int(11) NOT NULL,
17387
- `data_ultimo` char(10) NOT NULL,
17387
+ `data_ultimo_acq` char(10) NOT NULL,
17388
17388
  `note` varchar(100) DEFAULT NULL,
17389
17389
  PRIMARY KEY (`id`)
17390
17390
  ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
17391
17391
  */
17392
+ var query = "select id, tipo, marca, modello, color, numero, data_ultimo_acq, note from printer_cartridges ";
17393
+ query += "order by marca, modello";
17394
+ return query;
17392
17395
  }
17393
17396
 
17394
17397
  function selectPrinterCartridgeById(id_cart) {
17395
-
17398
+ var query = "select id, tipo, marca, modello, color, numero, data_ultimo_acq, note from printer_cartridges ";
17399
+ query += "where id = " + id_cart;
17400
+ return query;
17396
17401
  }
17397
17402
 
17398
- function insertPrinterCartridge() {
17403
+ function insertPrinterCartridge(tipo, marca, modello, color, numero, data_ultimo_acq, note) {
17404
+ var query = "insert into printer_cartridges (tipo, marca, modello, color, numero, data_ultimo_acq, note) values ";
17405
+ query += "(";
17406
+ query += "'" + tipo + "', ";
17407
+ query += "'" + marca + "', ";
17408
+ query += "'" + modello + "', ";
17409
+ query += "'" + color + "', ";
17410
+ query += numero + ", ";
17411
+ query += "'" + data_ultimo_acq + "', ";
17412
+ query += "'" + note + "' ";
17413
+ query += ")";
17414
+ return query;
17399
17415
 
17400
17416
  }
17401
17417
 
17402
- function updatePrinterCartridge(id_cart) {
17403
-
17418
+ function updatePrinterCartridge(id_cart, tipo, marca, modello, color, numero, data_ultimo_acq, note) {
17419
+ var query = "update printer_cartridges tipo, marca, modello, color, numero, data_ultimo_acq, note ";
17420
+ var dt_ultimo_acq_str = convertDateToStringDB(data_ultimo_acq);
17421
+ query += "set ";
17422
+ query += "tipo = '" + tipo + "', ";
17423
+ query += "marca = '" + marca + "', ";
17424
+ query += "modello = '" + modello + "', ";
17425
+ query += "color = '" + color + "', ";
17426
+ query += "numero = " + numero + ", ";
17427
+ query += "data_ultimo_acq = '" + dt_ultimo_acq_str + "', ";
17428
+ query += "note = '" + note + "' ";
17429
+ query += "where id = " + id_cart;
17430
+ return query;
17404
17431
  }
17405
17432
 
17406
17433
  function removePrinterCartridge(id_cart) {
17434
+ var query = "delete from printer_cartridges ";
17435
+ query += "where id = " + id_cart;
17436
+ return query;
17407
17437
 
17408
17438
  }
17409
17439
 
17410
17440
  function installPrinterCartridge(id_cart, id_device, date_install) {
17411
17441
  /*
17412
- -- ALS.printer_cartridges definition
17442
+ -- ALS.printer_cart_install definition
17413
17443
 
17414
- CREATE TABLE `printer_cartridges` (
17444
+ CREATE TABLE `printer_cart_install` (
17415
17445
  `id` int(11) NOT NULL AUTO_INCREMENT,
17416
- `tipo` text NOT NULL,
17417
- `marca` varchar(50) DEFAULT NULL,
17418
- `descrizione` varchar(50) DEFAULT NULL,
17419
- `color` char(20) DEFAULT NULL,
17420
- `numero` int(11) NOT NULL,
17421
- `data_ultimo` char(10) NOT NULL,
17446
+ `id_cart` int(11) DEFAULT NULL,
17447
+ `id_device` int(11) DEFAULT NULL,
17422
17448
  `note` varchar(100) DEFAULT NULL,
17449
+ `date_install` char(10) DEFAULT NULL,
17423
17450
  PRIMARY KEY (`id`)
17424
- ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
17451
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
17425
17452
  */
17426
-
17453
+ var date_install_str = convertDateToStringDB(date_install);
17454
+ var query = "insert into printer_cart_install (id_cart, id_device, note, date_install) values ";
17455
+ query += "(";
17456
+ query += id_cart + ", ";
17457
+ query += id_device + ", ";
17458
+ query += "'" + note + "', ";
17459
+ query += "'" + date_install_str + "' ";
17460
+ query += ")";
17461
+ return query;
17427
17462
  }
17428
17463
 
17429
17464
 
@@ -17956,6 +17991,13 @@ module.exports = {
17956
17991
  updateCountersPrinterRechargeUser,
17957
17992
  deleteCountersPrinterRechargeUser,
17958
17993
  //
17994
+ selectPrinterCartridges,
17995
+ selectPrinterCartridgeById,
17996
+ insertPrinterCartridge,
17997
+ updatePrinterCartridge,
17998
+ removePrinterCartridge,
17999
+ installPrinterCartridge,
18000
+ //
17959
18001
  getNotesByIdDevice
17960
18002
  };
17961
18003
  // end of source
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.229",
7
+ "version": "3.0.230",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",