Patch level : 10.0

Files correlati     : ba1.exe ba1600a.msk
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione variazione OEM in sede di patch di un modulo


git-svn-id: svn://10.65.10.50/branches/R_10_00@20955 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-10-06 13:30:06 +00:00
parent 815b64014a
commit c5fea50d86
6 changed files with 65 additions and 110 deletions

View File

@ -730,22 +730,6 @@ void TAttivazione_moduli::print_request()
str = active ? TR("*ATTIVO*") : "";
codice.set(str);
str = _im->get_name(module);
real full, assist;
ini.prices(str, users, full, assist);
if (active)
{
real old_full, old_assist;
ini.prices(str, ::dongle().max_users(), old_full, old_assist);
full -= old_full;
assist -= old_assist;
}
else
assist = 0.0;
price.set(full.string());
manut.set(assist.string());
form.print(-1);
}

View File

@ -384,57 +384,6 @@ void TInstall_ini::version_info(const char* module,int& year, int& release,int&
}
}
bool TInstall_ini::update_prices(const char* from)
{
CHECK(fexist(from), "Can't find listino prezzi");
TConfig from_ini(from);
from_ini.write_protect();
const TDate curr_date(get("Listino","Main"));
const TDate from_date(from_ini.get("Listino","Main"));
if (from_date < curr_date)
return false;
set("Listino", from_date);
TString_array modules;
from_ini.list_paragraphs(modules);
FOR_EACH_ARRAY_ROW_BACK(modules, r, row) if (row->len() == 2)
{
TAssoc_array& prices = from_ini.list_variables(*row);
set_paragraph(*row);
FOR_EACH_ASSOC_STRING(prices, obj, key, str)
{
const TFixed_string price(key);
if (price.compare("Prezzo", 6, true) == 0)
set(key, str);
}
}
return true;
}
void TInstall_ini::prices(const char* module, word users, real& full, real& assist, bool correct_ass)
{
real last_pac, last_ass;
full = assist = 0.0;
for (word u = 1; u <= users; u++)
{
TAuto_token_string prezzi = get("Prezzo", module, int(u));
if (prezzi.not_empty())
{
last_pac = prezzi.get(0);
if (last_pac < 50000.0)
last_pac *= 1000.0;
last_ass = prezzi.get();
if (last_ass < 50000.0)
last_ass *= 1000.0;
const int mese = TDate(TODAY).month();
last_ass = last_ass * (correct_ass ? (12-mese) / 12 : 1);
last_ass.round(-3);
}
full += last_pac;
assist += last_ass;
}
}
#ifdef __FCONV__
///////////////////////////////////////////////////////////
@ -1397,7 +1346,7 @@ bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
const bool dirty_module= m.field(S_DATE).dirty() ||
m.field(S_PREPROCESS).dirty() ||
m.field(S_POSTPROCESS).dirty() ||
m.field(S_EXTERN).dirty();
m.field(S_EXTERN).dirty() || m.field(S_OEM).dirty();
const bool dirty_version= m.field(S_VERSION).dirty() ||
m.field(S_PATCHLEVEL).dirty();
if (dirty_version || dirty_module)
@ -1411,6 +1360,7 @@ bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
ini.set("Moduli", m.get(S_EXTERN));
ini.set("PreProcess", m.get(S_PREPROCESS));
ini.set("PostProcess", m.get(S_POSTPROCESS));
ini.set("OEM", m.get(S_OEM));
// sottomoduli
if (dirty_version)
{
@ -1762,6 +1712,9 @@ void TCreadischi_mask::load()
tmp = ini.get("PostProcess");
row.add(tmp);
tmp = ini.get("OEM");
row.add(tmp);
}
}
}
@ -1813,6 +1766,9 @@ void TFascicolator_mask::save()
tmp = row->get();
ini.set("PostProcess", tmp);
tmp = row->get();
ini.set("OEM", tmp);
}
}
}
@ -2241,6 +2197,7 @@ TFascicolator_mask::TFascicolator_mask()
s.enable_column(S_EXTERN,true);
s.enable_column(S_PREPROCESS,true);
s.enable_column(S_POSTPROCESS,true);
s.enable_column(S_OEM,true);
}
///////////////////////////////////////////////////////////

View File

@ -23,8 +23,6 @@ public:
int patch(const char* module);
void version_info(const char* module,
int& year, int& release, int& tag, int& patch);
bool update_prices(const char* src_ini);
void prices(const char* module, word users, real& full, real& manut, bool correct_ass=TRUE);
static const char* default_name() { return "install.ini"; }

View File

@ -20,6 +20,7 @@
#define S_EXTERN 106
#define S_PREPROCESS 107
#define S_POSTPROCESS 108
#define S_OEM 109
#define S_LIST 100
#define S_CREATEZIP 151

View File

@ -32,6 +32,7 @@ BEGIN
ITEM "Moduli esterni@30"
ITEM "Pre-processing@25"
ITEM "Post-processing@25"
ITEM "OEMs@16"
END
ENDPAGE
@ -40,7 +41,7 @@ ENDMASK
PAGE "Riga" -1 -1 80 10
STRING 101 36
STRING 101 52
BEGIN
PROMPT 14 1 ""
FLAGS "D"
@ -73,14 +74,19 @@ BEGIN
PROMPT 1 3 "Esterni "
END
STRING S_PREPROCESS 50 33
STRING S_PREPROCESS 50
BEGIN
PROMPT 1 4 "Pre-processing "
PROMPT 1 5 "Pre-processing "
END
STRING S_POSTPROCESS 50 33
STRING S_POSTPROCESS 50
BEGIN
PROMPT 1 5 "Post-processing "
PROMPT 1 6 "Post-processing "
END
STRING S_OEM 50
BEGIN
PROMPT 1 8 "Lista OEM (CSV) "
END
ENDPAGE

View File

@ -26,7 +26,7 @@
#define C_CURRDATAREL 8
#define C_ISPATCH 9
#define C_BASEPATCH 10
#define C_OEM 11
///////////////////////////////////////////////////////
// Metodi di utility
@ -164,39 +164,46 @@ public:
TInstaller_mask* TInstaller_mask::_curr_mask = NULL;
bool TInstaller_mask::is_visible_patch(TConfig& ini) const
{
bool yes = true;
const TString& module = ini.get_paragraph();
CHECKS(module.len() == 2, "Invalid module ", (const char*)module);
const int mod = dongle().module_name2code(module);
if (mod > BAAUT && mod < ENDAUT)
TAuto_token_string oem = ini.get("OEM");
if (oem.blank())
{
TAuto_token_string oem = ini.get("OEM");
if (oem.blank())
const TString& module = ini.get_paragraph();
CHECKS(module.len() == 2, "Invalid module ", (const char*)module);
const int mod = dongle().module_name2code(module);
if (mod > BAAUT && mod < ENDAUT)
{
// Pezza temporanea: assegno OEM noti
// Pezza temporanea: assegno OEM noti eventualmente assenti dalla patch
switch (mod)
{
case LVAUT: oem = "2"; break;
case PEAUT: oem = "3"; break;
case COAUT: oem = "5"; break;
case COAUT: oem = "5"; break;
case HAAUT: oem = "0,3"; break;
case LVAUT: oem = "2,4"; break;
case PEAUT: oem = "3"; break;
case RIAUT: oem = "0,6"; break;
default: break;
};
}
if (oem.full())
yes = oem.get_pos(dongle().oem()) >= 0;
else
{
// Pezza temporanea: Ee significava AGA only
const bool ee = ini.get_bool("Ee");
if (ee && dongle().oem() != 0)
yes = false;
}
}
}
if (oem.full())
{
const int my_oem = dongle().oem();
yes = oem.get_pos(my_oem) >= 0;
if (!yes)
{
// Stando alla patch non sarei visibile ma devo controllare anche l'install.ini locale
// in modo da permettere l'aggiunta e la rimozione di nuovi OEM alla lista
const TString& module = ini.get_paragraph();
const TString& loc_oem = ini_get_string(CONFIG_GENERAL, module, "OEM");
if (loc_oem != oem)
ini_set_string(CONFIG_GENERAL, module, "OEM", oem);
}
}
return yes;
}
@ -224,6 +231,8 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch
row.add(strpatch);
row.add(ini.get("Data"));
row.add(patch ? "X" : " ", C_ISPATCH);
row.add(ini.get("OEM"), C_OEM);
if (pos < 0)
add(row);
else
@ -250,7 +259,7 @@ bool TInstaller_mask::add_header(TConfig& ini, const TString& module)
bool TInstaller_mask::should_precheck_module(int modnumber) const
{
bool ok = modnumber == 0;
bool ok = modnumber == BAAUT;
if (!ok)
{
@ -292,7 +301,7 @@ int TInstaller_mask::test_station_type() const
if (type < 1 || type > 3)
{
const bool testdb = ini.get_bool("TestDatabase");
const bool testprg = ini.get_bool("TestPrograms");
//const bool testprg = ini.get_bool("TestPrograms");
if (testdb)
{
if (dongle().hardware() == _dongle_network) //se usa un server di chiavi->server
@ -322,14 +331,14 @@ int TInstaller_mask::precheck_modules(bool only_newer)
{
TToken_string& rigar = *row;
cod_module = rigar.get(C_CODE);
modnumber = get_module_number(cod_module);
release = rigar.get(C_RELEASE);
patchlevel = rigar.get_int(C_PATCH);
currrelease = rigar.get(C_CURRRELEASE);
currpatch = rigar.get_int(C_CURRPATCH);
modnumber = get_module_number(cod_module);
if (modnumber >= 0 && should_precheck_module(modnumber) && release.full() &&
((release > currrelease) ||
(release == currrelease && (only_newer ? patchlevel > currpatch : patchlevel >= currpatch) ))
if (modnumber >= BAAUT && should_precheck_module(modnumber) &&
release.full() && ((release > currrelease) ||
(release == currrelease && (only_newer ? patchlevel > currpatch : patchlevel >= currpatch) ))
)
{
// spunta il modulo o la patch se ho installata la stessa versione
@ -622,8 +631,8 @@ bool TInstaller_mask::autoload()
const int patchlevel = ini.get_int("Patch");
TToken_string& row = mask_rows.row(r);
const TString16 release(row.get(C_RELEASE));
if (patchversion.mid(4) == release.mid(4) // se le versioni corrispondono ...
&& patchlevel > row.get_int(C_PATCH)) // ..e il patchlevel è superiore
if (patchversion.mid(4) == release.mid(4) && // se le versioni corrispondono ...
patchlevel > row.get_int(C_PATCH)) // ..e il patchlevel è superiore
{
TString4 patch; patch.format("%04d", patchlevel); //aggiunge zeri per avere 3 cifre sempre
row.add(patch, C_PATCH); // aggiorna il patchlevel mostrato per il modulo
@ -635,6 +644,7 @@ bool TInstaller_mask::autoload()
}
if (release < patchversion)
row.add(patchversion, C_RELEASE);
row.add(ini.get("OEM"), C_OEM);
}
}
else
@ -1305,7 +1315,6 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
{
TInstall_ini ini;
ini.set("Data", TDate(TODAY), module);
ini.update_prices(remote_ininame);
}
// Non togliere le parentesi graffe soprastanti per permettere l'aggiornamento fisico del .ini (CON LA CHIAMATA DEL DISTRUTTORE)
update_version();
@ -1390,7 +1399,7 @@ bool TInstaller_mask::install_patches(const TString& module, const TString& last
ininame.lower();
const int pos = ininame.find("a.ini");
CHECKS(pos >= 6, "Invalid installation configuration: ", (const char*)ininame);
const TString16 patchmodule = ininame.mid(pos-6, 2);
const TString4 patchmodule = ininame.mid(pos-6, 2);
TConfig ini(ininame, patchmodule);
const int patchlevel = ini.get_int("Patch");
const TString16 patchversion = ini.get("Versione");
@ -1534,7 +1543,7 @@ void TInstaller_mask::install_selection()
if (compare_version(oldver, 0, newver, 0)) //controlla SOLO la versione indipendentemente dall'anno!
ok = error_box(FR("Il modulo '%s' installato ha versione %s:\nimpossibile installare le patch della versione %s"),(const char *)modulo,(const char *)oldver,(const char *)newver);
} else
if (newpatch < oldpatch)
if (newpatch < oldpatch)
{
TString256 msg;
msg.format(FR("Si desidera ritornare alla patch %s.%d del modulo '%s' ?\nAttenzione: non e' garantito il corretto\nfunzionamento di tutti i programmi!"), (const char*)newver, newpatch, (const char*)modesc);
@ -1768,7 +1777,7 @@ bool TInstaller_mask::is_program_dir(const TFilename& path)
TInstaller_mask::TInstaller_mask()
: TArray_sheet(0, 0, 0, 0, TR("Installazione"),
HR("@1|Modulo@32|Cod.@3|Versione da\ninstallare@11|Liv.\nPatch@6|Data\nRilascio@10|Versione\nInstallata@10|Liv.\nPatch@6|Data\nInstallazione@13|Aggiornamento|Patch Base"),
HR("@1|Modulo@32|Cod.@3|Versione da\ninstallare@11|Liv.\nPatch@6|Data\nRilascio@10|Versione\nInstallata@10|Liv.\nPatch@6|Data\nInstallazione@13|Aggiornamento|Patch Base|OEM@10"),
0x18, 4)
{
add_button(F_INSTALL, TR("Installa"), '\0', TOOL_ELABORA); // NON mettere 'I'