Patch level : 12.0

Files correlati     : tp0101.cpp

Commento:

La stringa AgentCode non veniva trimmata ed a volte succedeva che mandasse in palla la query se il dato contenuto al suo interno conteneva spazi bianchi sporchi
This commit is contained in:
smen 2023-01-09 12:37:31 +01:00
parent 19aebf416c
commit 650c1dfcf6

View File

@ -173,11 +173,13 @@ const TString& TPack_clifo::decode_agente(const long codforn)
const TString& TPack_clifo::get_agente()
{
const TString& code = get_str("AgentCode");
TString code = get_str("AgentCode");
code.strip_spaces();
if (code.full())
{
TString query = query_header();
query << "SELECT CodContab FROM Customers_Suppliers WHERE (FlagCustSupp='A') AND (CustSuppCode=#CODCF)";
query << "SELECT CodContab FROM Customers_Suppliers WHERE (FlagCustSupp='A') AND (CustSuppCode='" << code <<"')";
TODBC_recordset clifo(query);
clifo.set_var("#CODCF", TVariant(code));
if (clifo.move_first())
@ -356,7 +358,9 @@ bool TPack_clifo::trasferisci()
const char tipocf = (flagcustsupp == 'C' ? 'C': 'F'); // C -> C (S,A) -> F
long codcf = get_long("CodContab");
bool needs_creation = codcf <= 0;
bool good = true;
if (!needs_creation)
{
@ -603,15 +607,16 @@ TPack_clifo::~TPack_clifo()
bool TPack_indsped::get_clifo(char& tipocf, long& codcf)
{
const TVariant& code = recordset().get("CustSuppRefCode");
const TString& code_str = recordset().get_string("CustSuppRefCode");
bool ok = !code.is_empty();
if (ok)
{
TString query = query_header();
query << "SELECT CodContab,FlagCustSupp FROM Customers_Suppliers WHERE CustSuppCode=#CODCF";
query << "SELECT CodContab,FlagCustSupp FROM Customers_Suppliers WHERE CustSuppRefCode='" << code_str<<"'";
TODBC_recordset clifo(query);
clifo.set_var("#CODCF", code);
//clifo.set_var("#CODCF", code);
ok = clifo.move_first();
if (ok)