alsmanager_lib 1.0.65 → 1.0.67

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 ";
@@ -7813,6 +7890,57 @@ function getPackageJsVersion() {
7813
7890
  var pjson = require('../package.json');
7814
7891
  return pjson.version;
7815
7892
  }
7893
+
7894
+ // Export DB
7895
+
7896
+ function exportDBSQLSQLite(db_path, dump_path, dump_source, dump_date) {
7897
+ var datestring = "";
7898
+ if (!dump_date) {
7899
+ datestring = d.getFullYear() + ("0" + d.getDate()).slice(-2) + ("0"+(d.getMonth()+1)).slice(-2) +
7900
+ "_" + ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2);
7901
+ }
7902
+ else {
7903
+ datestring = dump_date;
7904
+ }
7905
+
7906
+ var path = require('path');
7907
+ var fileOut = path.join(dump_path, "ALSnr_" + dump_source + datestring + ".sql");
7908
+ var query = ".output " + fileOut + ";";
7909
+ query += ".dump;";
7910
+ query += ".exit;";
7911
+
7912
+ let cmd = "sqlite3 " + db_path + "\"" + query + "\"";
7913
+
7914
+ const exec = require('child_process').exec;
7915
+ const child = exec(cmd,
7916
+ (error, stdout, stderr) => {
7917
+ console.log(`stdout: ${stdout}`);
7918
+ console.log(`stderr: ${stderr}`);
7919
+ if (error !== null) {
7920
+ console.log(`exec error: ${error}`);
7921
+ }
7922
+ });
7923
+
7924
+ return query;
7925
+ }
7926
+ function exportDBSQLMySQL(db_path, dump_path, dump_source, dump_date) {
7927
+
7928
+ }
7929
+ function exportDBSQL(db_used, db_path, dump_path, dump_source, dump_date) {
7930
+ var query = "";
7931
+ if (db_used) {
7932
+ switch (db_used) {
7933
+ case 'SQLITE':
7934
+ query = exportDBSQLSQLite(db_path, dump_path, dump_source, dump_date);
7935
+ break;
7936
+ case 'MYSQL':
7937
+ query = exportDBSQLMySQL(db_path, dump_path, dump_source, dump_date);
7938
+ break;
7939
+ }
7940
+ }
7941
+ return query;
7942
+ }
7943
+ //end ExportDB
7816
7944
  // Exports
7817
7945
 
7818
7946
  module.exports = {
@@ -7900,6 +8028,10 @@ module.exports = {
7900
8028
  updateAddOn,
7901
8029
  removeAddOn,
7902
8030
  //
8031
+ getDeviceConfigurations,
8032
+ setDeviceConfigurations,
8033
+ removeDeviceConfigurations,
8034
+ //
7903
8035
  selectBeneDaInventario,
7904
8036
  getDevicesSelectForInventarioRaw,
7905
8037
  getDevicesSelectForInventarioRawById,
@@ -8041,6 +8173,8 @@ module.exports = {
8041
8173
  getOpSystemFromBLOB,
8042
8174
  getAllPropertiesFromBLOB,
8043
8175
  getDatiAcquistoDevice,
8044
- getPackageJsVersion
8176
+ //
8177
+ getPackageJsVersion,
8178
+ exportDBSQL
8045
8179
  };
8046
8180
  // end of source
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",