alsmanager_lib 1.0.64 → 1.0.66

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.
@@ -575,15 +575,6 @@ CREATE TABLE IF NOT EXISTS "device_acquisto" (
575
575
  "id_sap" TEXT,
576
576
  PRIMARY KEY("id" AUTOINCREMENT)
577
577
  );
578
- CREATE TABLE IF NOT EXISTS "device_doc" (
579
- "id" INTEGER,
580
- "id_device" INTEGER,
581
- "id_doc" INTEGER,
582
- "d1" TEXT,
583
- "d2" TEXT,
584
- "d3" TEXT,
585
- PRIMARY KEY("id")
586
- );
587
578
  CREATE TABLE IF NOT EXISTS "devices" (
588
579
  "id" INTEGER,
589
580
  "inv_ict3_number" TEXT,
@@ -633,15 +624,6 @@ CREATE TABLE IF NOT EXISTS "device_projector" (
633
624
  "lamp_hours" INTEGER,
634
625
  "max_lamp_hours" INTEGER
635
626
  );
636
- CREATE TABLE IF NOT EXISTS "device_usage" (
637
- "id" INTEGER,
638
- "date_status" TEXT,
639
- "date_end" TEXT,
640
- "id_device" INTEGER,
641
- "status" INTEGER,
642
- "note" TEXT,
643
- PRIMARY KEY("id" AUTOINCREMENT)
644
- );
645
627
  CREATE TABLE IF NOT EXISTS "set_connections" (
646
628
  "id" INTEGER,
647
629
  "id_set" INTEGER,
@@ -841,22 +823,6 @@ CREATE TABLE IF NOT EXISTS "map_points" (
841
823
  "id_site" INTEGER,
842
824
  PRIMARY KEY("id" AUTOINCREMENT)
843
825
  );
844
- CREATE TABLE IF NOT EXISTS "dismissione_docs" (
845
- "id" INTEGER,
846
- "id_dismissione" INTEGER,
847
- "id_documento" INTEGER,
848
- PRIMARY KEY("id" AUTOINCREMENT)
849
- );
850
- CREATE TABLE IF NOT EXISTS "Dismissioni2025" (
851
- "Inventario" TEXT,
852
- "Serial_no" TEXT,
853
- "inv_com" TEXT,
854
- "inv_tndigit" TEXT,
855
- "tipo" TEXT,
856
- "marca" TEXT,
857
- "field7" TEXT,
858
- "field8" TEXT
859
- );
860
826
  CREATE TABLE IF NOT EXISTS "documenti" (
861
827
  "id" INTEGER,
862
828
  "tipo" TEXT,
@@ -873,17 +839,6 @@ CREATE TABLE IF NOT EXISTS "dismissione_gestori" (
873
839
  "id_gestore" INTEGER,
874
840
  "note" TEXT
875
841
  );
876
- CREATE TABLE IF NOT EXISTS "device_storages" (
877
- "id" INTEGER,
878
- "id_device" INTEGER,
879
- "storage_type" INTEGER,
880
- "storage_totsize" REAL,
881
- "storage_available" REAL,
882
- "storage_size_unit" TEXT,
883
- "storage_manifacturer" TEXT,
884
- "storage_model" TEXT,
885
- PRIMARY KEY("id" AUTOINCREMENT)
886
- );
887
842
  CREATE TABLE IF NOT EXISTS "dismissioni" (
888
843
  "id" INTEGER,
889
844
  "data" TEXT,
@@ -905,4 +860,76 @@ CREATE TABLE IF NOT EXISTS "device_dismissioni" (
905
860
  "motivo" INTEGER,
906
861
  PRIMARY KEY("id")
907
862
  );
863
+ CREATE TABLE IF NOT EXISTS "ImportDismissioni2025" (
864
+ "Inventario" TEXT,
865
+ "Serial_no" TEXT,
866
+ "inv_com" TEXT,
867
+ "inv_tndigit" TEXT,
868
+ "tipo" TEXT,
869
+ "marca" TEXT,
870
+ "modello" TEXT,
871
+ "field8" TEXT,
872
+ "manual_input" INTEGER
873
+ );
874
+ CREATE TABLE IF NOT EXISTS "documento_types" (
875
+ "tipo" TEXT,
876
+ "descrizione" TEXT
877
+ );
878
+ CREATE TABLE IF NOT EXISTS "documento_scopo" (
879
+ "scopo" TEXT,
880
+ "descrizione" TEXT
881
+ );
882
+ CREATE TABLE IF NOT EXISTS "temp_devdocs" (
883
+ "id" INT,
884
+ "id_device" INT,
885
+ "id_doc" INT,
886
+ "is_acquisto" INT,
887
+ "is_collaudo" INT,
888
+ "is_dismissione" INT
889
+ );
890
+ CREATE TABLE IF NOT EXISTS "device_doc" (
891
+ "id" INTEGER,
892
+ "id_device" INTEGER,
893
+ "id_doc" INTEGER,
894
+ "is_acquisto" INTEGER,
895
+ "is_collaudo" INTEGER,
896
+ "is_dismissione" INTEGER,
897
+ PRIMARY KEY("id" AUTOINCREMENT)
898
+ );
899
+ CREATE TABLE IF NOT EXISTS "device_storages" (
900
+ "id" INTEGER,
901
+ "id_device" INTEGER,
902
+ "storage_type" INTEGER,
903
+ "storage_totsize" REAL,
904
+ "storage_available" REAL,
905
+ "storage_size_unit" TEXT,
906
+ "storage_manifacturer" TEXT,
907
+ "storage_model" TEXT,
908
+ "is_replaced" INTEGER,
909
+ "date_replaced" TEXT,
910
+ PRIMARY KEY("id" AUTOINCREMENT)
911
+ );
912
+ CREATE TABLE IF NOT EXISTS "device_bmark" (
913
+ "id_device" INTEGER,
914
+ "total_ref" INTEGER,
915
+ "evaluation_perfs" INTEGER
916
+ );
917
+ CREATE TABLE IF NOT EXISTS "device_usage" (
918
+ "id" INTEGER,
919
+ "id_device" INTEGER,
920
+ "date_status" TEXT,
921
+ "status" INTEGER,
922
+ "note" TEXT,
923
+ PRIMARY KEY("id" AUTOINCREMENT)
924
+ );
925
+ CREATE TABLE IF NOT EXISTS "device_config" (
926
+ "id" INTEGER,
927
+ "id_device" INTEGER,
928
+ "date_conf" TEXT,
929
+ "id_storage" INTEGER,
930
+ "id_network" INTEGER,
931
+ "id_addon" INTEGER,
932
+ "note" TEXT,
933
+ PRIMARY KEY("id" AUTOINCREMENT)
934
+ );
908
935
  COMMIT;
package/lib/modules.js CHANGED
@@ -617,6 +617,83 @@ function removeAddOn(db_used, id_device, addon_obj) {
617
617
  return query;
618
618
  }
619
619
  //End Manage AddOns
620
+ // Device configurations
621
+ function getDeviceConfigurationsSQLite(id_device, date_ref) {
622
+ var query = "select id, id_device, date_conf, id_storage, id_network, id_addon, ";
623
+ /*
624
+ CREATE TABLE "device_config" (
625
+ "id" INTEGER,
626
+ "id_device" INTEGER,
627
+ "date_conf" TEXT,
628
+ "id_storage" INTEGER,
629
+ "id_network" INTEGER,
630
+ "id_addon" INTEGER,
631
+ "note" TEXT,
632
+ PRIMARY KEY("id" AUTOINCREMENT)
633
+ )
634
+ */
635
+ }
636
+ function getDeviceConfigurationsMySQL(id_device, date_ref) {
637
+
638
+ }
639
+ function getDeviceConfigurations(db_used, id_device, date_ref) {
640
+ var query = "";
641
+ if (db_used) {
642
+ switch (db_used) {
643
+ case 'SQLITE':
644
+ query = getDeviceConfigurationsSQLite(id_device, date_ref);
645
+ break;
646
+ case 'MYSQL':
647
+ query = getDeviceConfigurationsMySQL(id_device, date_ref);
648
+ break;
649
+ }
650
+ }
651
+ return query;
652
+ }
653
+
654
+ function setDeviceConfigurationsSQLite(id_device, date_ref) {
655
+
656
+ }
657
+ function setDeviceConfigurationsMySQL(id_device, date_ref) {
658
+
659
+ }
660
+ function setDeviceConfigurations(db_used, id_device, date_ref) {
661
+ var query = "";
662
+ if (db_used) {
663
+ switch (db_used) {
664
+ case 'SQLITE':
665
+ query = setDeviceConfigurationsSQLite(id_device, date_ref);
666
+ break;
667
+ case 'MYSQL':
668
+ query = setDeviceConfigurationsMySQL(id_device, date_ref);
669
+ break;
670
+ }
671
+ }
672
+ return query;
673
+ }
674
+
675
+ function removeDeviceConfigurationsSQLite(id_device, date_ref) {
676
+
677
+ }
678
+ function removeDeviceConfigurationsMySQL(id_device, date_ref) {
679
+
680
+ }
681
+ function removeDeviceConfigurations(db_used, id_device, date_ref) {
682
+ var query = "";
683
+ if (db_used) {
684
+ switch (db_used) {
685
+ case 'SQLITE':
686
+ query = removeDeviceConfigurationsSQLite(id_device, date_ref);
687
+ break;
688
+ case 'MYSQL':
689
+ query = removeDeviceConfigurationsMySQL(id_device, date_ref);
690
+ break;
691
+ }
692
+ }
693
+ return query;
694
+ }
695
+ //End Device configurations
696
+
620
697
  //Manage PC Properties
621
698
  function existsPCPropertiesSQLite(id_device) {
622
699
  var query = "select count(*) as num from device_pc ";
@@ -1492,7 +1569,7 @@ function queryDeviceByIdentificativo(db_used, identificativo) {
1492
1569
 
1493
1570
  //Get Device Status
1494
1571
  function queryDeviceStatusSQLite(id_device, date_ref) {
1495
- var query = "select case when status is null then 0 else status end as stato, MAX(date_status), count(*) as num from device_usage du ";
1572
+ var query = "select case when status is null then 0 else status end as stato, date_status from device_usage du ";
1496
1573
  query += "where du.id_device = " + id_device + " ";
1497
1574
  if (date_ref) {
1498
1575
  switch (date_ref) {
@@ -1509,7 +1586,7 @@ function queryDeviceStatusSQLite(id_device, date_ref) {
1509
1586
  return query;
1510
1587
  }
1511
1588
  function queryDeviceStatusMySQL(id_device, date_ref) {
1512
- var query = "select case when status is null then 0 else status end as stato, MAX(date_status), count(*) as num from device_usage du ";
1589
+ var query = "select case when status is null then 0 else status end as stato, date_status from device_usage du ";
1513
1590
  query += "where du.id_device = :id_device ";
1514
1591
  if (date_ref) {
1515
1592
  switch (date_ref) {
@@ -7813,6 +7890,35 @@ function getPackageJsVersion() {
7813
7890
  var pjson = require('../package.json');
7814
7891
  return pjson.version;
7815
7892
  }
7893
+
7894
+ // Export DB
7895
+
7896
+ function exportDBSQLSQLite(dump_path, dump_source, dump_date) {
7897
+ var path = require('path');
7898
+ var fileOut = path.join(dump_path, "ALSnr_" + dump_source + dump_date + ".sql");
7899
+ var query = ".output " + fileOut + ";";
7900
+ query += ".dump;";
7901
+ query += ".exit;";
7902
+ return query;
7903
+ }
7904
+ function exportDBSQLMySQL(dump_path, dump_source, dump_date) {
7905
+
7906
+ }
7907
+ function exportDBSQL(db_used, dump_path, dump_source, dump_date) {
7908
+ var query = "";
7909
+ if (db_used) {
7910
+ switch (db_used) {
7911
+ case 'SQLITE':
7912
+ query = exportDBSQLSQLite(dump_path, dump_source, dump_date);
7913
+ break;
7914
+ case 'MYSQL':
7915
+ query = exportDBSQLMySQL(dump_path, dump_source, dump_date);
7916
+ break;
7917
+ }
7918
+ }
7919
+ return query;
7920
+ }
7921
+ //end ExportDB
7816
7922
  // Exports
7817
7923
 
7818
7924
  module.exports = {
@@ -7900,6 +8006,10 @@ module.exports = {
7900
8006
  updateAddOn,
7901
8007
  removeAddOn,
7902
8008
  //
8009
+ getDeviceConfigurations,
8010
+ setDeviceConfigurations,
8011
+ removeDeviceConfigurations,
8012
+ //
7903
8013
  selectBeneDaInventario,
7904
8014
  getDevicesSelectForInventarioRaw,
7905
8015
  getDevicesSelectForInventarioRawById,
@@ -8041,6 +8151,8 @@ module.exports = {
8041
8151
  getOpSystemFromBLOB,
8042
8152
  getAllPropertiesFromBLOB,
8043
8153
  getDatiAcquistoDevice,
8044
- getPackageJsVersion
8154
+ //
8155
+ getPackageJsVersion,
8156
+ exportDBSQL
8045
8157
  };
8046
8158
  // end of source
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",