Migliorato supporto per extra modules.

Ora i programmi di CA, se si possiede il module CM, mostrano nel titolo "Gestione Commesse" invece di "Contabilità analitica"



git-svn-id: svn://10.65.10.50/branches/R_10_00@22694 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-07-10 13:47:05 +00:00
parent 081be4b720
commit 59d2c2c657
5 changed files with 31 additions and 45 deletions

View File

@ -334,7 +334,7 @@ const char* TApplication::get_module_name() const
module = d.module_code2desc(aut); module = d.module_code2desc(aut);
bool ok = module.full(); bool ok = module.full();
if (ok && aut > 0 && check_autorization()) if (ok && aut > 0 && check_autorization())
ok = dongle().login(modname); ok = has_module(aut) && dongle().login(modname);
if (!ok) if (!ok)
{ {
@ -344,8 +344,19 @@ const char* TApplication::get_module_name() const
if (!em.empty_items()) if (!em.empty_items())
{ {
ok = em == "*"; ok = em == "*";
FOR_EACH_TOKEN(em, cod) if (!ok) if (!ok)
ok = dongle().login(cod); {
FOR_EACH_TOKEN(em, cod)
{
const word codice = d.module_name2code(cod);
ok = has_module(codice) && dongle().login(cod);
if (ok)
{
module = d.module_code2desc(codice);
break;
}
}
}
} }
if (!ok) if (!ok)
{ {

View File

@ -1178,7 +1178,7 @@ int Tdninst::test_cmdline(const TString& cmdline, bool key_must_exist, TString&
const long serno = don.number(); const long serno = don.number();
if (serno == 0) if (serno == 0)
{ {
if (is_power_reseller(true)) if (is_power_station())
return 0; // Solo chiavi per uso interno aga return 0; // Solo chiavi per uso interno aga
msg = TR("Chiave di sviluppo non autorizzata"); msg = TR("Chiave di sviluppo non autorizzata");
return 1; return 1;

View File

@ -801,23 +801,6 @@ const char* TBaseisamfile::module() const
curr().get_relapp(app); curr().get_relapp(app);
if (app.full()) if (app.full())
return app.left(2); return app.left(2);
switch (num())
{
case LF_CLIFO:
case LF_CAUSALI:
case LF_RCAUSALI:
case LF_MOV:
case LF_RMOV:
case LF_RMOVIVA:
return "cg";
case LF_ANAMAG:
case LF_DOC:
case LF_RIGHEDOC:
return "ve";
default: break;
}
return "ba"; return "ba";
} }

View File

@ -1432,7 +1432,7 @@ bool TPrint_application::print_one (
_PrintfRef *pr = (_PrintfRef *) t; _PrintfRef *pr = (_PrintfRef *) t;
TString ps; TString ps;
TParagraph_string * para_str = NULL; TParagraph_string * para_str = NULL;
bool islong = (pr->_fmt).find ('l') != -1; const bool islong = (pr->_fmt).find ('l') >= 0;
switch (pr->_type) switch (pr->_type)
{ {
case 'd': case 'd':
@ -1450,7 +1450,7 @@ bool TPrint_application::print_one (
*((float *) (pr->_what))); *((float *) (pr->_what)));
break; break;
case 'c': case 'c':
ps.format (pr->_fmt, *((char *) (pr->_what))); ps.format (pr->_fmt, *((const char*) (pr->_what)));
break; break;
case 's': case 's':
ps.format (pr->_fmt, (char *) (pr->_what)); ps.format (pr->_fmt, (char *) (pr->_what));

View File

@ -211,25 +211,17 @@ int list_files(
bool input_filename(TFilename& file) bool input_filename(TFilename& file)
{ {
DIRECTORY dir; DIRECTORY dir; xvt_fsys_get_dir(&dir);
FILE_SPEC fs; FILE_SPEC fs;
xvt_fsys_convert_str_to_fspec(file, &fs);
xvt_fsys_get_dir(&dir);
xvt_fsys_get_dir(&fs.dir);
strcpy(fs.type, file.ext());
strcpy(fs.name, file);
strcpy(fs.creator, "AGA");
const bool good = xvt_dm_post_file_open(&fs, TR("Selezionare il file")) == FL_OK; const bool good = xvt_dm_post_file_open(&fs, TR("Selezionare il file")) == FL_OK;
xvt_fsys_set_dir(&dir); xvt_fsys_set_dir(&dir);
if (good) if (good)
{ xvt_fsys_convert_fspec_to_str(&fs, file.get_buffer(), file.size());
char buf[_MAX_PATH];
xvt_fsys_convert_dir_to_str(&fs.dir, buf, sizeof(buf));
file = buf;
file.add(fs.name);
}
return good; return good;
} }
@ -551,7 +543,7 @@ istream & eatwhite(istream & i)
const TString& get_hostname() const TString& get_hostname()
{ {
TString& tmp = get_tmp_string(80); TString& tmp = get_tmp_string(50);
xvt_sys_get_host_name(tmp.get_buffer(), tmp.size()); xvt_sys_get_host_name(tmp.get_buffer(), tmp.size());
return tmp; return tmp;
} }
@ -565,7 +557,7 @@ long daytime()
// DON'T cache this bool because hostname can be local or server // DON'T cache this bool because hostname can be local or server
static bool is_aga_station(const char* hostname) static bool is_aga_station(const char* hostname)
{ {
const char* const ranger[] = { "BATMOBILE", "KIRK", "MOBILE", "PCTRUFFELLI", "SPOCK", NULL }; const char* const ranger[] = { "BATMOBILE", "KIRK", "KLINGON", "MOBILE", "PCTRUFFELLI", "SPOCK", NULL };
for (int i = 0; ranger[i]; i++) for (int i = 0; ranger[i]; i++)
if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0) if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0)
return true; return true;
@ -578,7 +570,8 @@ bool is_power_station()
if (ps < 0) if (ps < 0)
{ {
const TDongle& d = dongle(); const TDongle& d = dongle();
if ((d.local() && (d.number() == 0 || d.number()==1045)) || (d.network() && is_aga_station(d.server_name()))) if ((d.local() && (d.number() == 0 || d.number()==1045)) ||
(d.network() && is_aga_station(d.server_name())))
ps = is_aga_station(get_hostname()); ps = is_aga_station(get_hostname());
else else
ps = FALSE; ps = FALSE;
@ -588,10 +581,9 @@ bool is_power_station()
bool is_power_reseller(bool power_user_only) bool is_power_reseller(bool power_user_only)
{ {
bool yes = xvt_sys_get_oem_int("OEM", -1) == 0; if (power_user_only && !is_power_station())
if (yes && power_user_only) return false;
yes = is_power_station(); return xvt_sys_get_oem_int("OEM", 1) == 0;
return yes;
} }
bool expand_sys_vars(TString& str) bool expand_sys_vars(TString& str)