Merge remote-tracking branch 'origin/R_10_00' into R_10_00

This commit is contained in:
Mattia Tollari 2019-06-11 15:13:31 +02:00
commit f417fee58f
8 changed files with 357 additions and 60 deletions

5
cd/test/ve0820.txt Normal file
View File

@ -0,0 +1,5 @@
ve5.exe
ve5100a.msk
Scarico e ripristino documenti:
Aggiunta archiviazione su File oltre al Floppy

130
cd/test/ve0820a.ini Normal file
View File

@ -0,0 +1,130 @@
[Main]
Demo=0
[ve1]
File(86) = ve5.exe|X
File(87) = ve5100a.msk|X
Patch = 0820
Versione = 21511200
[ve99]
Kill(0) = batbcld.msk|x
Kill(1) = bastspp.rep|x
Kill(2) = baststd.rep|x
Kill(3) = bastbnp.rep|x
Kill(4) = ve7400a.msk|x
Kill(5) = bastfrd.msk|x
Kill(6) = bastprs.rep|x
Kill(7) = basttip.msk|x
Kill(8) = bastcaa.rep|x
Kill(9) = efstbnp.msk|x
Kill(10) = batbprs.msk|x
Kill(11) = batbabe.msk|x
Kill(12) = bastgca.msk|x
Kill(13) = batbgmc.msk|x
Kill(14) = bastcau.rep|x
Kill(15) = bastcra.msk|x
Kill(16) = bastspp.msk|x
Kill(17) = basttag.rep|x
Kill(18) = batbcau.msk|x
Kill(19) = bastctr.rep|x
Kill(20) = ve7500a.msk|x
Kill(21) = bastasf.rep|x
Kill(22) = bastums.rep|x
Kill(23) = bastfrr.msk|x
Kill(24) = basteld.rep|x
Kill(25) = batbprv.msk|x
Kill(26) = ve7200a.msk|x
Kill(27) = batbgca.msk|x
Kill(28) = batbmre.msk|x
Kill(29) = bastcaa.msk|x
Kill(30) = ve7700a.msk|x
Kill(31) = batbtri.msk|x
Kill(32) = basttip.rep|x
Kill(33) = efstbnp.rep|x
Kill(34) = baststd.msk|x
Kill(35) = batbasf.msk|x
Kill(36) = bastimb.msk|x
Kill(37) = batbrfa.msk|x
Kill(38) = ve7300a.msk|x
Kill(39) = ve7600a.msk|x
Kill(40) = batbspt.msk|x
Kill(41) = bastfca.rep|x
Kill(42) = bastrfc.msk|x
Kill(43) = bastprs.msk|x
Kill(44) = bastgcg.msk|x
Kill(45) = batbspp.msk|x
Kill(46) = batbgcg.msk|x
Kill(47) = bastnum.rep|x
Kill(48) = bastgmc.msk|x
Kill(49) = batbrfc.msk|x
Kill(50) = bastubi.msk|x
Kill(51) = batbtag.msk|x
Kill(52) = ve7400a.ini|x
Kill(53) = bastrfa.msk|x
Kill(54) = bastabe.rep|x
Kill(55) = bastubi.rep|x
Kill(56) = bastasf.msk|x
Kill(57) = batbctr.msk|x
Kill(58) = ve7100a.msk|x
Kill(59) = batbcaa.msk|x
Kill(60) = batbfid.msk|x
Kill(61) = ve7300a.frm|x
Kill(62) = bastfrr.rep|x
Kill(63) = bastums.msk|x
Kill(64) = basttri.rep|x
Kill(65) = bastrfa.rep|x
Kill(66) = bastcau.msk|x
Kill(67) = batbtip.msk|x
Kill(68) = batbubi.msk|x
Kill(69) = basttag.msk|x
Kill(70) = basteld.msk|x
Kill(71) = bastimb.rep|x
Kill(72) = bastrfc.rep|x
Kill(73) = ve7.exe|x
Kill(74) = ve7200a.frm|x
Kill(75) = batbfrr.msk|x
Kill(76) = bastfca.msk|x
Kill(77) = batbfrd.msk|x
Kill(78) = bastctr.msk|x
Kill(79) = batbpro.msk|x
Kill(80) = ve7400conf.ini|x
Kill(81) = bastfrm.rep|x
Kill(82) = batbbnp.msk|x
Kill(83) = bastgca.rep|x
Kill(84) = batbstd.msk|x
Kill(85) = ve7701a.ini|x
Kill(86) = batbfsa.msk|x
Kill(87) = batbnum.msk|x
Kill(88) = bastabe.msk|x
Kill(89) = eftbbnp.msk|x
Kill(90) = batbfca.msk|x
Kill(91) = bastgcg.rep|x
Kill(92) = batbgsa.msk|x
Kill(93) = bastfrm.msk|x
Kill(94) = bastbnp.msk|x
Kill(95) = bastgmc.rep|x
Kill(96) = bastcra.rep|x
Kill(97) = bastfrd.rep|x
Kill(98) = batbacr.msk|x
Kill(99) = batbimb.msk|x
Kill(100) = basttri.msk|x
Kill(101) = bastnum.msk|x
Kill(102) = batbeld.msk|x
Kill(103) = batbums.msk|x
Kill(104) = batbcra.msk|x
Kill(105) = batbfrm.msk|x
[ve]
Data = 11-06-2019
Descrizione = Vendite
Dischi = 1
Moduli = ba,cg9,pr9,mg9,sv9,in9,ef9
OEM =
Patch = 820
PostProcess = bainst -0 VE
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/ve0820a1.zip Normal file

Binary file not shown.

View File

@ -338,42 +338,13 @@ bool TArchive::zip(
// @comm Il parametro <p pr_set> e' utilizzato per evitare errori di riaperture di files.
{
safely_close_closeable_isamfiles();
{
const TFilename workdir = dir;
const TString name = workdir.name();
// Nome del file compresso
TFilename work; work.tempdir(); work.add(name); work.ext("zip");
DIRECTORY currdir, newdir;
xvt_fsys_get_curr_dir( &currdir); //memorizza la directory dove e'
xvt_fsys_convert_str_to_dir(dir, &newdir); //converte il nome della directory
xvt_fsys_set_dir( &newdir); //passa alla directory dir che gli viene passata
const TFilename workdir = dir;
const TString name = workdir.name();
// Nome del file compresso
TFilename work; work.tempdir(); work.add(name); work.ext("zip");
TString title(TR("Archiviazione")); title << ' ' << workdir;
TIndwin waitw(100,title,FALSE,FALSE);
TWait_cursor hourglass;
TString_array filenames;
list_files("*.*", filenames);
// Crea il file con la lista dei file da comprimere
const char* const ZIPLIST = "ziplist.txt";
FILE* flist = fopen(ZIPLIST, "w");
FOR_EACH_ARRAY_ROW(filenames, r, row)
fprintf(flist, "%s\n",(const char *)*row);
fclose(flist);
bool ok = ::aga_zip_filelist(ZIPLIST, work);
remove(ZIPLIST); //elimina il file di testo con la lista dei files
xvt_fsys_set_dir( &currdir); //torna a posizionarsi nella directory iniziale
bool ok = zip(dir, work);
if (ok)
ok = fsplit_zip(work, floppy, desc);
@ -383,6 +354,43 @@ bool TArchive::zip(
return ok;
}
bool TArchive::zip(const char* dir, const TFilename& work)
{
safely_close_closeable_isamfiles();
DIRECTORY currdir, newdir;
xvt_fsys_get_curr_dir(&currdir); //memorizza la directory dove e'
xvt_fsys_convert_str_to_dir(dir, &newdir); //converte il nome della directory
xvt_fsys_set_dir(&newdir); //passa alla directory dir che gli viene passata
const TFilename workdir = dir;
TString title(TR("Archiviazione")); title << ' ' << workdir;
TIndwin waitw(100, title, FALSE, FALSE);
TWait_cursor hourglass;
TString_array filenames;
list_files("*.*", filenames);
// Crea il file con la lista dei file da comprimere
const char* const ZIPLIST = "ziplist.txt";
FILE* flist = fopen(ZIPLIST, "w");
FOR_EACH_ARRAY_ROW(filenames, r, row)
fprintf(flist, "%s\n", (const char *)*row);
fclose(flist);
bool ok = ::aga_zip_filelist(ZIPLIST, work);
remove(ZIPLIST); //elimina il file di testo con la lista dei files
xvt_fsys_set_dir(&currdir); //torna a posizionarsi nella directory iniziale
return ok;
}
bool TArchive::zip(int mode, long firm, char floppy, const char* desc)
{
TString_array fl;
@ -494,6 +502,77 @@ bool TArchive::unzip(
return ok;
}
bool TArchive::unzip(
const char* dir, // @parm Directory di cui effettuare il restore
const char* fromdir, // @parm percorso da cui leggere i dati
bool tmp) // @parm Directory temporanea da utilizzare
// @syntax bool restore(const char* dir, char floppy, bool temp, bool pr_set);
// @syntax bool restore(long firm, char floppy, bool temp, bool pr_set);
// @comm Il parametro <p pr_set> e' utilizzato per evitare errori di riaperture di files.
{
TFilename work;
if (tmp)
work.tempdir();
else
work = dir;
TFilename output(dir);
output = output.name();
output.ext("zip");
TFilename dest; dest << fromdir;
if (!yesno_box(FR("Attenzione l'archivio %s\\%s verra' ripristinato\n"
"nel direttorio %s. Continuare?"),
fromdir, (const char*)output, (const char*)work))
return FALSE;
bool ok = work.exist();
if (!ok)
{
ok = yesno_box(FR("Non esiste il direttorio %s: si desidera crearlo?"), (const char*)work);
if (ok)
{
make_dir(work);
ok = work.exist();
}
if (!ok)
return error_box(FR("Impossibile accedere a %s"), (const char*)work);
}
TString title(TR("Ripristino")); title << ' ' << output;
TIndwin waitw(100, title, FALSE, FALSE);
safely_close_closeable_isamfiles();
TFilename restored;
restored.tempdir();
restored.add(output.name());
restored.ext("zip");
TFilename src;
src << fromdir << SLASH;
src << output.name();
src.ext("zip");
while (!src.exist())
{
if (!yesno_box("Impossibile aprire il file %s:\nSi desidera ritentare?",
(const char *)src))
break;
}
if (src.exist())
{
fcopy(src, restored);
}
ok = ::aga_unzip(restored, work);
if (ok)
remove(restored);
return ok;
}
bool TArchive::unzip(int mode, long firm, char floppy, bool temp)
{
TString_array fl;
@ -513,6 +592,12 @@ bool TArchive::backup(const char* dir, char floppy, const char* desc, bool)
return zip(dir, floppy, desc);
}
bool TArchive::backup(const char* dir, const char* dirdest, const char* desc, bool) const
{
TFilename work; work << dirdest; work.add(TFilename(dir).name()); work.ext("zip");
return zip(dir, work);
}
bool TArchive::backup(int mode, long firm, char floppy, const char* desc, bool)
{
return zip(mode, firm, floppy, desc);
@ -522,6 +607,11 @@ bool TArchive::restore(const char* dir, char floppy, bool tmp, bool)
{
return unzip(dir, floppy, tmp);
}
bool TArchive::restore(const char* dir, const char* fromdir, bool tmp, bool)
{
return unzip(dir, fromdir, tmp);
}
bool TArchive::restore(int mode, long firm, char floppy, bool tmp, bool)
{

View File

@ -50,21 +50,29 @@ public:
// @cmember Effettua il backup della directory
bool backup(const char* dir, char floppy, const char* desc, bool dummy = FALSE);
// @cmember Effettua il backup della directory in un percorso specificato
bool backup(const char* dir, const char* dirdest, const char* desc, bool dummy = FALSE) const;
// @cmember Effettua il backup della ditta
bool backup(int mode, long firm, char floppy, const char* desc, bool pr_set=TRUE);
// @cmember Effettua il restore della directory
bool restore(const char* dir, char floppy, bool temp, bool dummy = FALSE);
// @cmember Effettua il restore della directory
bool restore(const char* dir, const char* fromdir, bool temp, bool dummy = FALSE);
// @cmember Effettua il restore della ditta
bool restore(int mode, long firm, char floppy, bool temp, bool pr_set=TRUE);
// @cmember Effettua il backup della directory
bool zip(const char* dir, char floppy, const char* desc);
// @cmember Effettua il backup della directory su percorso specificato nel file
static bool zip(const char* dir, const TFilename& work);
// @cmember Effettua il backup della ditta
bool zip(int mode, long firm, char floppy, const char* desc);
// @cmember Effettua il restore della directory
bool unzip(const char* dir, char floppy, bool temp);
// @cmember Effettua il restore della directory
bool unzip(const char* dir, const char* fromdir, bool temp);
// @cmember Effettua il restore della ditta
bool unzip(int mode, long firm, char floppy, bool temp);

View File

@ -19,10 +19,12 @@ class TDeletedoc_app : public TSkeleton_application
TString _desc, _last_std;
TString16 _num;
int _anno;
char _unit;
char _unit;
TString _dirdest;
TFilename _tmp_dir;
TIsamtempfile *_tdoc,*_trdoc;
bool _floppy;
protected:
void backup_delete_doc(int op, int who, bool pack_rows); // Backup e cancellazione dei documenti da eliminare
@ -33,7 +35,9 @@ protected:
virtual bool destroy();
virtual void main_loop();
static bool state_handler(TMask& m, KEY k);
static bool state_handler(TMask& m, KEY k);
static void enable_supports(TMask& m, bool enable = true);
static bool op_handler(TMask_field& field, KEY k);
public:
@ -49,6 +53,38 @@ bool TDeletedoc_app::state_handler(TMask& m, KEY k)
return TRUE;
}
void TDeletedoc_app::enable_supports(TMask& m, bool enable)
{
if(!enable)
{
m.field(F_UNIT).disable();
m.field(F_DESTDIR).disable();
}
else
{
if(m.get(F_SALVA) == "F")
{
m.field(F_UNIT).enable();
m.field(F_DESTDIR).disable();
}
else
{
m.field(F_UNIT).disable();
m.field(F_DESTDIR).enable();
}
}
}
bool TDeletedoc_app::op_handler(TMask_field& field, KEY k)
{
TMask& m = field.mask();
if (m.get_int(F_OPERAZIONE) == 1)
enable_supports(m, false);
else
enable_supports(m);
return true;
}
void TDeletedoc_app::backup_delete_doc(int op, int who, bool pack_rows)
{
@ -176,7 +212,10 @@ void TDeletedoc_app::backup_delete_doc(int op, int who, bool pack_rows)
movmag.close(); rmovmag.close();
const char * dir = &_tmp_dir[1];
delete_tmp_files(FALSE); //Close tmp files only
rt = _arc.backup(dir,_unit,_desc, FALSE);// Backup dei documenti da eliminare, prefix unnecessary
if(_floppy)
rt = _arc.backup(dir, _unit, _desc, FALSE); // Backup dei documenti da eliminare, prefix unnecessary
else
rt = _arc.backup(dir, _dirdest, _desc, FALSE); // Backup dei documenti da eliminare, prefix unnecessary
create_tmp_files(FALSE); // Reopen tmp files.
doc.open(_excllock); rdoc.open(); clifo.open();
cfven.open(); tab.open(); occas.open();
@ -251,7 +290,12 @@ void TDeletedoc_app::restore_doc()
return ;
}
const char* dir =& _tmp_dir[1]; // Cut out % sign
if (_arc.restore(dir,_unit,FALSE, FALSE))
bool ok;
if(_floppy)
ok = _arc.restore(dir, _unit, FALSE, FALSE);
else
ok = _arc.restore(dir, _dirdest, FALSE, FALSE);
if (ok)
{
create_tmp_files(FALSE); // In realta' ci sono gia'
const TRecnotype items = _tdoc->items() + _trdoc->items();
@ -335,13 +379,17 @@ void TDeletedoc_app::main_loop()
{
TMask m("ve5100a");
m.set_handler(state_handler);
m.set_handler(F_OPERAZIONE, op_handler);
m.set_handler(F_SALVA, op_handler);
m.set(F_STATUS,_last_std);
while (m.run() != K_QUIT)
{
_unit = m.get(F_UNIT)[0];
_dirdest = m.get(F_DESTDIR);
_desc = m.get(F_DESC);
_unit = m.get(F_UNIT)[0];
_floppy = m.get(F_SALVA) == "F";
const int scelta = m.get_int(F_OPERAZIONE);
const int cosa = m.get_int(F_DOCUMENTI);
const bool pack_rows = m.get_bool(F_COMPATTA);

View File

@ -1,11 +1,13 @@
#define F_STATUS 101
#define F_DESC 102
#define F_UNIT 103
#define F_STADESC 104
#define F_OPERAZIONE 105
#define F_DOCUMENTI 106
#define F_COMPATTA 107
#define F_ANNO 108
#define F_CODNUM 109
#define F_DESNUM 110
#define F_DESTDIR 104
#define F_STADESC 105
#define F_OPERAZIONE 106
#define F_SALVA 107
#define F_DOCUMENTI 108
#define F_COMPATTA 109
#define F_ANNO 110
#define F_CODNUM 111
#define F_DESNUM 112

View File

@ -10,13 +10,13 @@ RADIOBUTTON F_OPERAZIONE 1 34
BEGIN
PROMPT 1 1 "Operazione"
ITEM "1|Eliminazione"
MESSAGE DISABLE,F_DESC|DISABLE,F_UNIT|ENABLE,F_ANNO|ENABLE,F_CODNUM
MESSAGE DISABLE,F_DESC|ENABLE,F_ANNO|ENABLE,F_CODNUM
ITEM "2|Archiviazione"
MESSAGE ENABLE,F_DESC|ENABLE,F_UNIT|ENABLE,F_ANNO|ENABLE,F_CODNUM
MESSAGE ENABLE,F_DESC|ENABLE,F_ANNO|ENABLE,F_CODNUM
ITEM "3|Eliminazione e archiviazione"
MESSAGE ENABLE,F_DESC|ENABLE,F_UNIT|ENABLE,F_ANNO|ENABLE,F_CODNUM
MESSAGE ENABLE,F_DESC|ENABLE,F_ANNO|ENABLE,F_CODNUM
ITEM "4|Ripristino"
MESSAGE DISABLE,F_DESC|ENABLE,F_UNIT|CLEAR,F_ANNO|CLEAR,F_CODNUM
MESSAGE DISABLE,F_DESC|CLEAR,F_ANNO|CLEAR,F_CODNUM
END
RADIOBUTTON F_DOCUMENTI 1 24
@ -30,21 +30,35 @@ BEGIN
MESSAGE ENABLE,F_COMPATTA
END
RADIOBUTTON F_SALVA 2 24
BEGIN
PROMPT 1 7 "Salvare su "
ITEM "F|Floppy"
ITEM "D|File "
FLAGS "Z"
END
LIST F_UNIT 2
BEGIN
PROMPT 38 6 "Unita' di backup "
PROMPT 30 9 "Unita' di backup"
ITEM "A|A:"
ITEM "B|B:"
END
STRING F_DESTDIR 250 36
BEGIN
PROMPT 2 10 "Percorso di backup "
DSELECT
END
STRING F_DESC 50 36
BEGIN
PROMPT 2 7 "Descrizione backup "
PROMPT 2 11 "Descrizione backup "
END
STRING F_STATUS 1
BEGIN
PROMPT 2 8 "Stato eliminabile "
PROMPT 2 12 "Stato eliminabile "
USE %STD
INPUT CODTAB F_STATUS
DISPLAY "Stato documento" CODTAB
@ -58,25 +72,25 @@ END
STRING F_STADESC 32
BEGIN
PROMPT 27 8 ""
PROMPT 27 12 ""
FLAGS "D"
END
BOOELAN F_COMPATTA
BEGIN
PROMPT 2 9 "Elimina la righe evase"
PROMPT 2 13 "Elimina la righe evase"
END
NUMBER F_ANNO 4
BEGIN
PROMPT 2 10 "Esercizio "
PROMPT 2 14 "Esercizio "
FIELD ANNO
WARNING "Inserire un anno valido"
END
STRING F_CODNUM 4
BEGIN
PROMPT 2 11 "Numerazione "
PROMPT 2 15 "Numerazione "
FIELD CODNUM
HELP "Codice numerazione"
USE %NUM
@ -92,7 +106,7 @@ END
STRING F_DESNUM 50 42
BEGIN
PROMPT 15 12 ""
PROMPT 15 16 ""
HELP "Descrizione numerazione"
USE %NUM KEY 2
INPUT S0 F_DESNUM