diff --git a/src/ps/ps6362100.cpp b/src/ps/ps6362100.cpp index 7c62f4dc3..be797b07c 100644 --- a/src/ps/ps6362100.cpp +++ b/src/ps/ps6362100.cpp @@ -10,6 +10,7 @@ #include "progind.h" // TProgress_monitor #include "flexform_xml.h" +#include "clifo.h" /////////////////////////////////////////////////////////// @@ -51,24 +52,42 @@ void TMajor_export_mask::save_all() const void TMajor_export_mask::load_all() { - TFilename dir; - PWSTR szPath[MAX_PATH]; - char dest[MAX_PATH]; - if ((HRESULT)SHGetKnownFolderPath(FOLDERID_Desktop, 0, NULL, szPath) >= 0) + TFilename dir = ini_get_string(CONFIG_DITTA, "ps6362", "flddest", ""); + if (dir.empty()) { - size_t size; - wcstombs_s(&size, dest, MAX_PATH, szPath[0], MAX_PATH); - dir = dest; + PWSTR szPath[MAX_PATH]; + char dest[MAX_PATH]; + if ((HRESULT)SHGetKnownFolderPath(FOLDERID_Desktop, 0, NULL, szPath) >= 0) + { + size_t size; + wcstombs_s(&size, dest, MAX_PATH, szPath[0], MAX_PATH); + dir = dest; + } + else + dir.tempdir(); } - else - dir.tempdir(); + TString y; y << TDate(TODAY).year(); - set(F_FLDDEST, ini_get_string(CONFIG_DITTA, "ps6362", "flddest", dir)); + + TString cod_flexform(ini_get_string(CONFIG_DITTA, "ps6362", "codcf", "")); + if (cod_flexform.empty()) + { + TLocalisamfile clifo(LF_CLIFO); + clifo.setkey(2); + clifo.put(CLI_TIPOCF, "C"); + clifo.put(CLI_RAGSOC, "FLEXFORM"); + if (clifo.read(_isgteq) == NOERR && clifo.get(CLI_RAGSOC).starts_with("FLEXFORM")) + cod_flexform = clifo.get(CLI_CODCF); + else + cod_flexform = "12"; + } + + set(F_FLDDEST, dir); set(F_SUBFLD, ini_get_bool (CONFIG_DITTA, "ps6362", "fldroot_b", true)); set(F_ANNO_ELAB, ini_get_string(CONFIG_DITTA, "ps6362", "fldyear", y)); set(F_NUMDDT, ini_get_string(CONFIG_DITTA, "ps6362", "numddt", "")); set(F_NUMORD, ini_get_string(CONFIG_DITTA, "ps6362", "numord", "")); - set(F_CODCF, ini_get_string(CONFIG_DITTA, "ps6362", "codcf", "12")); + set(F_CODCF, cod_flexform); set(F_NUMDDT_DA, ini_get_string(CONFIG_DITTA, "ps6362", "num_da", "")); set(F_NUMDDT_A, ini_get_string(CONFIG_DITTA, "ps6362", "num_a", "")); if(get(F_NUMDDT).empty() || get(F_NUMORD).empty())