Teste headless: verificare ANAF la alegerea clientului cu contract activ
Harness ROAACNPRO-specific (gcAppPath propriu, spre deosebire de test_init_env_auto.prg care e fixat pe ROACONT), shadow pentru cauta_alfa() si testul care reproduce/confirma label-ul ANAF pe caut_client_contract_activ(), plus repro pentru scoping-ul gresit al lui poDate in do_cauta_partener (Thisform.poDate vs poDate PRIVATE).
This commit is contained in:
52
utile/Teste/mock_cauta_alfa_anaf_label.prg
Normal file
52
utile/Teste/mock_cauta_alfa_anaf_label.prg
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
* mock_cauta_alfa_anaf_label.prg - inlocuieste DOAR PROCEDURE cauta_alfa (COMUN\programe\cauta_alfa.prg,
|
||||||
|
* linia 16), la fel ca mock_cauta_alfa_dialog.prg (vezi acolo motivatia completa: CursorFill() cere
|
||||||
|
* conexiune reala, Show() modal blocheaza headless). Aici NU se simuleaza alegerea unui rand -
|
||||||
|
* scopul e sa verifice DOAR daca label-ul ANAF (lb_anaf, anaf_verif_cautare din ocautare.prg) e
|
||||||
|
* activat de apelantul real (caut_partener / caut_client_contract_activ), replicand liniile 211-220
|
||||||
|
* din cauta_alfa.prg (poVerifAlegere.Activeaza/Dezactiveaza), fara sa mai deschida formularul.
|
||||||
|
*
|
||||||
|
* Trebuie incarcat PRIMUL (inaintea "SET PROCEDURE TO cauta_alfa ADDITIVE" din test_init_env_auto.prg) -
|
||||||
|
* la nume duplicat de procedura VFP foloseste fisierul incarcat PRIMUL.
|
||||||
|
*
|
||||||
|
* Control test: goDlgTest - formularul REAL cauta_alfa_form, PRE-CONSTRUIT in scriptul principal
|
||||||
|
* (capcana l, docs/testare-ui-vfp.md: CREATEOBJECT dintr-o procedura intoarce obiect stricat headless).
|
||||||
|
* Rezultat expus: gcTestAnafActivat, gcTestAnafLabelType, gcTestAnafLabelVisible, gcTestAnafLabelCaption
|
||||||
|
|
||||||
|
Procedure cauta_alfa
|
||||||
|
Parameters tcselect,tcfiltru,tcschema,tcorder,tccoloana,tcTitlu,tcTitluColoane, ;
|
||||||
|
tcNume_Proc,tl_AllInList,tcFiltruOriginal,tcPrimaColoana, tnPornire, tnTipReturn, ;
|
||||||
|
tcIdColumn, tlDesktop, tcGroup, tcGridDynamicBackColor, tcGridToolTip, tlModParam, tcStringCriterii, ;
|
||||||
|
tcProceduraVerifica, tcProceduraCopiaza,tcLocate
|
||||||
|
|
||||||
|
LOCAL oForm_cautare, oReturnScattObj
|
||||||
|
oForm_cautare = goDlgTest
|
||||||
|
|
||||||
|
gcTestDiag = 'Type(tlVerificaANAF)=' + TYPE('tlVerificaANAF') + ' val=' + TRANSFORM(IIF(TYPE('tlVerificaANAF')='L', tlVerificaANAF, '?')) + ;
|
||||||
|
' Type(tdDataDoc)=' + TYPE('tdDataDoc') + ' Type(poVerifAlegere)=' + TYPE('poVerifAlegere') + ;
|
||||||
|
' Type(lnNivelANAF)=' + TYPE('lnNivelANAF')
|
||||||
|
|
||||||
|
gcTestAnafActivat = .F.
|
||||||
|
gcTestAnafLabelType = 'N/A (poVerifAlegere neinstantiat)'
|
||||||
|
gcTestAnafLabelVisible = .F.
|
||||||
|
gcTestAnafLabelCaption = ''
|
||||||
|
|
||||||
|
IF TYPE('poVerifAlegere') = 'O' AND !ISNULL(poVerifAlegere)
|
||||||
|
gcTestAnafActivat = .T.
|
||||||
|
ADDPROPERTY(oForm_cautare, 'oVerifAlegere', poVerifAlegere)
|
||||||
|
poVerifAlegere.Activeaza(oForm_cautare)
|
||||||
|
poVerifAlegere.VerificaRand(.T.)
|
||||||
|
gcTestAnafLabelType = TYPE('oForm_cautare.lb_anaf')
|
||||||
|
IF gcTestAnafLabelType == 'O'
|
||||||
|
gcTestAnafLabelVisible = oForm_cautare.lb_anaf.Visible
|
||||||
|
gcTestAnafLabelCaption = oForm_cautare.lb_anaf.Caption
|
||||||
|
ENDIF
|
||||||
|
poVerifAlegere.Dezactiveaza()
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
*-- raspuns minimal: butonul Renunta (testul verifica doar label-ul, nu alegerea unui rand)
|
||||||
|
gnButon = 0
|
||||||
|
SELECT (oForm_cautare.crs_cursor)
|
||||||
|
SCATTER NAME oReturnScattObj BLANK
|
||||||
|
RETURN oReturnScattObj
|
||||||
|
|
||||||
|
Endproc && cauta_alfa (shadow test - label ANAF)
|
||||||
271
utile/Teste/test_init_env_auto_acnpro.prg
Normal file
271
utile/Teste/test_init_env_auto_acnpro.prg
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
* test_init_env_auto_acnpro.prg
|
||||||
|
* Varianta ROAACNPRO a test_init_env_auto.prg (COMUN\utile\Teste): acela seteaza gcAppPath fix pe
|
||||||
|
* D:\ROA\ROACONT\ (harness scris pentru ROACONT), deci nu poate testa cod din COMUN\ asa cum e
|
||||||
|
* editat in checkout-ul ROAACNPRO (fiecare aplicatie are propriul working copy SVN al COMUN\).
|
||||||
|
* Identic altfel, minus class libs/proceduri specifice ROACONT (contabilitate) care nu exista sub
|
||||||
|
* ROAACNPRO\COMUN sau ROAACNPRO\Clase.
|
||||||
|
*
|
||||||
|
* Utilizare: DO test_init_env_auto_acnpro WITH 'CENTRAL', 'MARIUSM_AUTO', 'parola'
|
||||||
|
* ATENTIE: mentine sincronizat cu test_init_env_auto.prg pentru partea comuna.
|
||||||
|
|
||||||
|
LPARAMETERS tcHost, tcSchema, tcPassword, tnAn, tnLuna
|
||||||
|
|
||||||
|
tcHost = IIF(EMPTY(tcHost), 'CENTRAL', tcHost)
|
||||||
|
tcSchema = IIF(EMPTY(tcSchema), 'MARIUSM_AUTO', tcSchema)
|
||||||
|
tcPassword = IIF(EMPTY(tcPassword), 'ROMFASTSOFT', tcPassword)
|
||||||
|
|
||||||
|
SET DELETED ON
|
||||||
|
SET ANSI ON
|
||||||
|
SET EXACT ON
|
||||||
|
SET SAFETY OFF
|
||||||
|
CLOSE DATABASES
|
||||||
|
SET CENTURY ON
|
||||||
|
SET DATE DMY
|
||||||
|
SET NULLDISPLAY TO ''
|
||||||
|
|
||||||
|
PUBLIC CT_SUCCES, CT_INSUCCES, crlf, gnAn, gnLuna, gnIdUtil, glEMama, gnIdFirma, gcCondSucursala, ;
|
||||||
|
gnIdSucursala, gcS, gcFirma, gcUserName, gcNumeProgram, gcAppName, glLunaInchisa, ;
|
||||||
|
buton, gnButon, pnButon, gl406, gcAcces
|
||||||
|
CT_SUCCES = 1
|
||||||
|
CT_INSUCCES = -1
|
||||||
|
crlf = CHR(13) + CHR(10)
|
||||||
|
gnAn = IIF(EMPTY(tnAn), YEAR(DATE()), tnAn)
|
||||||
|
gnLuna = IIF(EMPTY(tnLuna), MONTH(DATE()), tnLuna)
|
||||||
|
gnIdUtil = -3
|
||||||
|
gnIdFirma = 110
|
||||||
|
gcCondSucursala = []
|
||||||
|
gnIdSucursala = m.gnIdFirma
|
||||||
|
gcS = UPPER(ALLTRIM(tcSchema))
|
||||||
|
gcFirma = m.gcS
|
||||||
|
gcUserName = m.gcS
|
||||||
|
gcNumeProgram = [ROAACNPRO]
|
||||||
|
gcAppName = [ROAACNPRO]
|
||||||
|
glLunaInchisa = .F.
|
||||||
|
glEMama = .F.
|
||||||
|
gl406 = .F.
|
||||||
|
PUBLIC nror(65000)
|
||||||
|
buton = 1
|
||||||
|
gnButon = 1
|
||||||
|
pnButon = 1
|
||||||
|
|
||||||
|
LOCAL lcPath
|
||||||
|
PUBLIC gcAppPath, DIRGEN, gcBasePath, gcTempPath, gcGeneralIniFile, gcSettingsFile
|
||||||
|
gcAppPath = [D:\ROA\ROAACNPRO\]
|
||||||
|
Set Default To (gcAppPath)
|
||||||
|
lcPath = gcAppPath + 'Date;' + ;
|
||||||
|
gcAppPath + 'Include;' + ;
|
||||||
|
gcAppPath + 'FERESTRE;' + ;
|
||||||
|
gcAppPath + 'GRAFICE;' + ;
|
||||||
|
gcAppPath + 'CLASE;' + ;
|
||||||
|
gcAppPath + 'MENIURI;' + ;
|
||||||
|
gcAppPath + 'PROGRAME;' + ;
|
||||||
|
gcAppPath + 'RAPOARTE;' + ;
|
||||||
|
gcAppPath + 'COMUN\CLASE;' + ;
|
||||||
|
gcAppPath + 'COMUN\FERESTRE;' + ;
|
||||||
|
gcAppPath + 'COMUN\PROGRAME;' + ;
|
||||||
|
gcAppPath + 'COMUN\GRAFICE;' + ;
|
||||||
|
gcAppPath + 'COMUN\RAPOARTE;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\CALENDAR;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\CTL32;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\HPDF;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\HPDF\REPORTOUTPUT;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\WEB;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\NFJSON;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\NFXML;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\EXCEL;' + ;
|
||||||
|
gcAppPath + 'COMUN\UTILE\GRIDEXTRAS;' + ;
|
||||||
|
Addbs(Substr(gcAppPath,1,Rat([\],gcAppPath,2)))+[COMUNROA\]
|
||||||
|
SET PATH TO &lcPath ADDITIVE
|
||||||
|
|
||||||
|
Set Classlib To appwiz Additive
|
||||||
|
Set Classlib To CAUT Additive
|
||||||
|
Set Classlib To BAZA Additive
|
||||||
|
Set Classlib To comun Additive
|
||||||
|
Set Classlib To registry Additive
|
||||||
|
Set Classlib To cauta_alfa_forms.vcx Additive
|
||||||
|
Set Classlib To obalanta Additive
|
||||||
|
Set Classlib To ocriterii.vcx Additive
|
||||||
|
Set Classlib To ctl32_statusbar.vcx Additive
|
||||||
|
Set Classlib To ctl32_common.vcx Additive
|
||||||
|
Set Classlib To ctl32_structs.vcx Additive
|
||||||
|
Set Classlib To ctl32_progressbar.vcx Additive
|
||||||
|
|
||||||
|
Set Procedure To PROCEDURI Additive
|
||||||
|
Set Procedure To pmenu Additive
|
||||||
|
Set Procedure To proceduri_comune Additive
|
||||||
|
Set Procedure To mesaje Additive
|
||||||
|
Set Procedure To acces_meniu Additive
|
||||||
|
Set Procedure To quitapp Additive
|
||||||
|
Set Procedure To init_program Additive
|
||||||
|
Set Procedure To oproceduri_maintenance.PRG Additive
|
||||||
|
Set Procedure To gridproc Additive
|
||||||
|
Set Procedure To proceduri_excel Additive
|
||||||
|
Set Procedure To oserii_numere.PRG Additive
|
||||||
|
Set Procedure To cauta_alfa Additive
|
||||||
|
Set Procedure To oproceduri_parteneri Additive
|
||||||
|
Set Procedure To wwconfig Additive
|
||||||
|
Set Procedure To oexport Additive
|
||||||
|
SET PROCEDURE TO ocasabanca ADDITIVE
|
||||||
|
SET PROCEDURE TO importfromxlsx ADDITIVE
|
||||||
|
SET PROCEDURE TO appendfromxlsx.prg ADDITIVE
|
||||||
|
SET PROCEDURE TO overificari.prg ADDITIVE
|
||||||
|
SET PROCEDURE TO onomenclatoare.prg ADDITIVE
|
||||||
|
SET PROCEDURE TO excelxml.prg ADDITIVE
|
||||||
|
|
||||||
|
Set Classlib To DECABAZA Additive
|
||||||
|
Set Classlib To onomenclatoare Additive
|
||||||
|
Set Classlib To oparteneri Additive
|
||||||
|
Set Classlib To OCASABANCA Additive
|
||||||
|
Set Classlib To oCompensari Additive
|
||||||
|
Set Classlib To oRapoarte_cont Additive
|
||||||
|
Set Classlib To overificari Additive
|
||||||
|
Set Classlib To omodificari Additive
|
||||||
|
Set Classlib To ooptiuni Additive
|
||||||
|
Set Classlib To onote_contabile Additive
|
||||||
|
Set Classlib To odebcred Additive
|
||||||
|
Set Classlib To ferestre_oracle Additive
|
||||||
|
Set Classlib To caut_ora Additive
|
||||||
|
Set Classlib To otoolbar Additive
|
||||||
|
Set Classlib To serii_numere Additive
|
||||||
|
Set Classlib To anaf_efactura Additive
|
||||||
|
|
||||||
|
Set Classlib To Messagebox Additive
|
||||||
|
SET CLASSLIB TO wwdialogs ADDITIVE
|
||||||
|
SET CLASSLIB TO orapoarte.vcx additive
|
||||||
|
SET CLASSLIB TO accessibility.vcx ADDITIVE
|
||||||
|
SET CLASSLIB TO _calendar.vcx ADDITIVE
|
||||||
|
SET CLASSLIB TO orapoarte_comun.vcx ADDITIVE
|
||||||
|
|
||||||
|
Set Procedure To GENCURSOR.PRG Additive
|
||||||
|
Set Procedure To OPROCEDURI_COMUNE.PRG Additive
|
||||||
|
Set Procedure To OINIT_OPTIUNI.PRG Additive
|
||||||
|
Set Procedure To updateserver.PRG Additive
|
||||||
|
Set Procedure To oCompensari.PRG Additive
|
||||||
|
Set Procedure To oOperatii_comune.PRG Additive
|
||||||
|
Set Procedure To OPROCEDURI_aMS.PRG Additive
|
||||||
|
Set Procedure To oparteneri.PRG Additive
|
||||||
|
Set Procedure To orapoarte.PRG Additive
|
||||||
|
Set Procedure To ocautare Additive
|
||||||
|
Set Procedure To omeniu_initializari Additive
|
||||||
|
Set Procedure To osecurity Additive
|
||||||
|
Set Procedure To oheader Additive
|
||||||
|
Set Procedure To orefaceri Additive
|
||||||
|
Set Procedure To oproceduri_casademarcat Additive
|
||||||
|
Set Procedure To controllerecr Additive
|
||||||
|
Set Procedure To oproceduri_comune_imob.PRG Additive
|
||||||
|
Set Procedure To odocumente.PRG Additive
|
||||||
|
SET PROCEDURE TO orapoarte_dinamice.prg additive
|
||||||
|
SET PROCEDURE TO update_imob.prg ADDITIVE
|
||||||
|
Set Procedure To wwutils.PRG Additive
|
||||||
|
Set Procedure To wwxmlhttp.PRG Additive
|
||||||
|
Set Procedure To ini.PRG Additive
|
||||||
|
Set Procedure To regex.PRG Additive
|
||||||
|
Set Procedure To validare.PRG Additive
|
||||||
|
Set Procedure To oproceduri_evolutie Additive
|
||||||
|
Set Procedure To proceduri_rapoarte.PRG Additive
|
||||||
|
SET PROCEDURE TO anaf_efactura.prg ADDITIVE
|
||||||
|
SET PROCEDURE TO iniacces.prg ADDITIVE
|
||||||
|
SET PROCEDURE TO oupdate.prg additive
|
||||||
|
SET PROCEDURE TO procese.prg additive
|
||||||
|
SET PROCEDURE TO version.prg additive
|
||||||
|
SET PROCEDURE TO xmlaccess.prg additive
|
||||||
|
SET PROCEDURE TO xmlparser.prg additive
|
||||||
|
SET PROCEDURE TO filebringer.prg additive
|
||||||
|
SET PROCEDURE TO wwcodeupdate.prg additive
|
||||||
|
SET PROCEDURE TO wwhttp.prg ADDITIVE
|
||||||
|
SET PROCEDURE TO wwapi.prg ADDITIVE
|
||||||
|
|
||||||
|
Declare Integer GetPrivateProfileString In WIN32API ;
|
||||||
|
string, String, String, String @, Integer, String
|
||||||
|
Declare Integer WritePrivateProfileString In Win32Api ;
|
||||||
|
string, String, String, String
|
||||||
|
Declare Integer CopyFile In WIN32API ;
|
||||||
|
STRING lpExistingFileName, STRING lpNewFileName, INTEGER bFailIfExists
|
||||||
|
Declare Integer PathFileExists In shlwapi STRING pszPath
|
||||||
|
|
||||||
|
If Type('goApi') = 'U'
|
||||||
|
Public goApi
|
||||||
|
goApi = Newobject("wwAPI", "wwAPI.prg")
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
set procedure to oinit_optiuni.prg additive
|
||||||
|
set procedure to oproceduri_comune.prg additive
|
||||||
|
|
||||||
|
PUBLIC gnHandle, goExecutor, goConn, goFirma, goCalendar, poLog, goLog, goApp
|
||||||
|
DIRGEN = [D:\ROA\]
|
||||||
|
gcBasePath = dirgen
|
||||||
|
gcGeneralIniFile = DIRGEN + "settings.ini"
|
||||||
|
gcSettingsFile = m.gcGeneralIniFile
|
||||||
|
gcTempPath = Addbs(shortpath(goApi.GetTempPath())) + gcS + [\]
|
||||||
|
If !Directory(gcTempPath)
|
||||||
|
Md (gcTempPath)
|
||||||
|
Endif
|
||||||
|
gcAcces = [1;2;3;4;5;6;7;8;]
|
||||||
|
|
||||||
|
poLog = Newobject("Log_Mesaje","Log_Mesaje.prg")
|
||||||
|
goLog = poLog
|
||||||
|
goApp = Createobject("wzApplication")
|
||||||
|
gnHandle = 0
|
||||||
|
goExecutor = createobject("oExecutor")
|
||||||
|
goConn = createobject("oConn")
|
||||||
|
goConn.Connect(m.tcHost, m.tcSchema, m.tcPassword)
|
||||||
|
IF m.gnHandle <= 0
|
||||||
|
RETURN .F.
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
LOCAL llSucces, lcSql
|
||||||
|
goFirma = null
|
||||||
|
llSucces = goExecutor.oExecuta("select * from syn_v_nom_firme where schema = ?gcS", "cFirma")
|
||||||
|
IF m.llSucces
|
||||||
|
SELECT cFirma
|
||||||
|
gnIdFirma = id_firma
|
||||||
|
gnIdSucursala = null
|
||||||
|
gcFirma = ALLTRIM(firma)
|
||||||
|
SCATTER NAME goFirma
|
||||||
|
IF TYPE('goFirma.codfiscalfro') = 'U'
|
||||||
|
ADDPROPERTY(goFirma, 'codfiscalfro', ALLTRIM(STRTRAN(ALLTRIM(NVL(goFirma.cod_fiscal, '')), 'RO', '')))
|
||||||
|
ENDIF
|
||||||
|
ELSE
|
||||||
|
goFirma = CREATEOBJECT('custom')
|
||||||
|
goFirma.addproperty('cod_fiscal', '')
|
||||||
|
goFirma.addproperty('schema', m.gcS)
|
||||||
|
goFirma.addproperty('firma', m.gcS)
|
||||||
|
goFirma.addproperty('codfiscalfro', '')
|
||||||
|
ENDIF
|
||||||
|
USE IN (SELECT('cFirma'))
|
||||||
|
|
||||||
|
goCalendar = null
|
||||||
|
llSucces = goExecutor.oExecuta('SELECT anul, luna, tva_incasare FROM calendar WHERE an*12+luna = (select MAX(an*12+luna) FROM calendar)', 'cCalendar')
|
||||||
|
IF m.llSucces
|
||||||
|
SELECT cCalendar
|
||||||
|
GO TOP
|
||||||
|
IF EMPTY(m.tnAn)
|
||||||
|
gnAn = anul
|
||||||
|
gnLuna = luna
|
||||||
|
ENDIF
|
||||||
|
SCATTER NAME goCalendar
|
||||||
|
ENDIF
|
||||||
|
USE IN (SELECT('cCalendar'))
|
||||||
|
|
||||||
|
CREATE CURSOR dual (dummy c(10))
|
||||||
|
INSERT INTO dual (dummy) VALUES ("")
|
||||||
|
|
||||||
|
actualizeaza_optiuni()
|
||||||
|
Do optiuni_firma IN oinit_optiuni.prg
|
||||||
|
|
||||||
|
lcSql = [begin pack_sesiune.set_Id_Util(?gnIdUtil); end;]
|
||||||
|
llSucces = goExecutor.oExecuta(lcSql)
|
||||||
|
lcSql = [begin pack_sesiune.setluna(?gnLuna); pack_sesiune.setan(?gnAn); end;]
|
||||||
|
llSucces = goExecutor.oExecuta(lcSql)
|
||||||
|
lcSql = [begin pack_sesiune.setlunabal(?gnLuna); pack_sesiune.setanbal(?gnAn); end;]
|
||||||
|
llSucces = goExecutor.oExecuta(lcSql)
|
||||||
|
lcSql = [begin pack_contafin.SET_DATA_RON(?gcS); end;]
|
||||||
|
llSucces = goExecutor.oExecuta(lcSql)
|
||||||
|
lcSql = [begin pack_sesiune.set_data_ron(?gcS); end;]
|
||||||
|
llSucces = goExecutor.oExecuta(lcSql)
|
||||||
|
lcSql = [begin pack_contafin.set_id_sucursala(?gnIdSucursala); end;]
|
||||||
|
llSucces = goExecutor.oExecuta(lcSql)
|
||||||
|
lcSql = [begin pack_contafin.set_id_firma(?gnIdFirma); end;]
|
||||||
|
llSucces = goExecutor.oExecuta(lcSql)
|
||||||
|
|
||||||
|
RETURN .T.
|
||||||
130
utile/Teste/test_repro_anaf_label_client_contract.prg
Normal file
130
utile/Teste/test_repro_anaf_label_client_contract.prg
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
* test_repro_anaf_label_client_contract.prg
|
||||||
|
* Reproduce raportul utilizatorului (Marius, 03.08.2026): la alegerea clientului pe factura
|
||||||
|
* (ROAACNPRO, frm_factura.do_cauta_partener), nu apare label-ul de verificare ANAF a codului
|
||||||
|
* fiscal, desi acesta a fost adaugat in COMUN (ocautare.prg: clasa anaf_verif_cautare, activata
|
||||||
|
* de caut_partener() prin parametrul tlVerificaANAF). Cauza: frm_factura foloseste in schimb
|
||||||
|
* caut_client_contract_activ() (ocautare.prg), care nu are deloc acest parametru.
|
||||||
|
*
|
||||||
|
* Testeaza DOAR mecanismul comun (caut_client_contract_activ + anaf_verif_cautare.Activeaza),
|
||||||
|
* nu UI-ul ROAACNPRO: inlocuieste cauta_alfa() cu un shadow (mock_cauta_alfa_anaf_label.prg) care
|
||||||
|
* replica liniile 211-220 din cauta_alfa.prg (poVerifAlegere.Activeaza/Dezactiveaza) pe un formular
|
||||||
|
* REAL cauta_alfa_form, PRE-CONSTRUIT in acest script (capcana l), fara sa mai deschida fereastra
|
||||||
|
* (Show() modal ar bloca headless). Foloseste un partener REAL din nom_parteneri, ca verificarea
|
||||||
|
* ANAF (goExecutor + serviciul ANAF/cache) sa ruleze pe fluxul real.
|
||||||
|
*
|
||||||
|
* Rulare: vfp9.exe -A -T "test_repro_anaf_label_client_contract.prg"
|
||||||
|
* Verdict in gcUILog. Ruleaza INAINTE de fix (astept gcTestAnafActivat=.F.) si DUPA fix (astept .T.
|
||||||
|
* + label populat), cu semnatura caut_client_contract_activ() ajustata mai jos (tlVerificaANAF).
|
||||||
|
|
||||||
|
SET SAFETY OFF
|
||||||
|
SET TALK OFF
|
||||||
|
SET DELETED ON
|
||||||
|
SET EXACT ON
|
||||||
|
SET CENTURY ON
|
||||||
|
SET DATE DMY
|
||||||
|
SET NULLDISPLAY TO ''
|
||||||
|
CLOSE DATABASES
|
||||||
|
|
||||||
|
PUBLIC gcUILog
|
||||||
|
gcUILog = "D:\ROA\ROAACNPRO\COMUN\utile\Teste\test_repro_anaf_label_client_contract_log.txt"
|
||||||
|
STRTOFILE("START " + TTOC(DATETIME()) + CHR(13)+CHR(10), gcUILog)
|
||||||
|
|
||||||
|
ON ERROR DO PrErrLocal WITH ERROR(), MESSAGE(), PROGRAM(), LINENO()
|
||||||
|
ON SHUTDOWN QUIT
|
||||||
|
|
||||||
|
TRY
|
||||||
|
*-- shadow-ul TREBUIE incarcat PRIMUL, inainte ca test_init_env_auto sa incarce cauta_alfa real
|
||||||
|
SET PROCEDURE TO "D:\ROA\ROAACNPRO\COMUN\utile\Teste\mock_cauta_alfa_anaf_label.prg" ADDITIVE
|
||||||
|
DO PrLogLocal WITH 'shadow cauta_alfa incarcat'
|
||||||
|
|
||||||
|
PUBLIC gnButon
|
||||||
|
gnButon = 0
|
||||||
|
|
||||||
|
DO "D:\ROA\ROAACNPRO\COMUN\utile\Teste\test_init_env_auto_acnpro.prg" WITH 'CENTRAL', 'MARIUSM_AUTO', 'ROMFASTSOFT'
|
||||||
|
IF gnHandle <= 0
|
||||||
|
DO PrLogLocal WITH 'FAIL: conectare Oracle esuata (gnHandle=' + TRANSFORM(gnHandle) + ')'
|
||||||
|
QUIT
|
||||||
|
ENDIF
|
||||||
|
DO PrLogLocal WITH 'mediu initializat, gnHandle=' + TRANSFORM(gnHandle)
|
||||||
|
|
||||||
|
*-- un partener real, cu cod fiscal completat, pentru fluxul ANAF real
|
||||||
|
LOCAL lcSelPart, lnSuccesPart
|
||||||
|
IF USED('crsPartTest')
|
||||||
|
USE IN ('crsPartTest')
|
||||||
|
ENDIF
|
||||||
|
lcSelPart = "SELECT * FROM (SELECT id_part, denumire, cod_fiscal, tip_persoana FROM nom_parteneri " + ;
|
||||||
|
"WHERE sters = 0 AND inactiv = 0 AND cod_fiscal IS NOT NULL AND LENGTH(TRIM(cod_fiscal)) > 0 " + ;
|
||||||
|
"ORDER BY id_part) WHERE ROWNUM = 1"
|
||||||
|
lnSuccesPart = goExecutor.oExecute(lcSelPart, "crsPartTest")
|
||||||
|
IF lnSuccesPart < 0 OR RECCOUNT('crsPartTest') = 0
|
||||||
|
DO PrLogLocal WITH 'FAIL: nu am gasit niciun partener cu cod fiscal pentru test'
|
||||||
|
QUIT
|
||||||
|
ENDIF
|
||||||
|
SELECT crsPartTest
|
||||||
|
LOCAL lnIdPartTest, lcCodFiscalTest, lcDenumireTest
|
||||||
|
lnIdPartTest = id_part
|
||||||
|
lcCodFiscalTest = ALLTRIM(cod_fiscal)
|
||||||
|
lcDenumireTest = ALLTRIM(denumire)
|
||||||
|
USE IN ('crsPartTest')
|
||||||
|
DO PrLogLocal WITH 'partener test: id_part=' + TRANSFORM(lnIdPartTest) + ' cod_fiscal=' + lcCodFiscalTest + ' denumire=' + lcDenumireTest
|
||||||
|
|
||||||
|
*-- cursorul cu FORMA EXACTA produsa de caut_client_contract_activ (ocautare.prg ~4054-4060):
|
||||||
|
*-- id_ctr, id_part, denumire, cod_fiscal, data, numar, data_inceput, data_sfarsit, nr_zile_scadenta, tip_curs
|
||||||
|
LOCAL lcCurTest
|
||||||
|
lcCurTest = SYS(2015)
|
||||||
|
IF USED(lcCurTest)
|
||||||
|
USE IN (lcCurTest)
|
||||||
|
ENDIF
|
||||||
|
CREATE CURSOR (lcCurTest) (id_ctr N(10), id_part N(10), denumire C(100), cod_fiscal C(50), ;
|
||||||
|
data D, numar C(100), data_inceput D, data_sfarsit D, nr_zile_scadenta N(10), tip_curs N(10))
|
||||||
|
INSERT INTO (lcCurTest) (id_part, denumire, cod_fiscal) VALUES (lnIdPartTest, lcDenumireTest, lcCodFiscalTest)
|
||||||
|
GO TOP IN (lcCurTest)
|
||||||
|
|
||||||
|
*-- goDlgTest: formularul REAL cauta_alfa_form, PRE-CONSTRUIT aici (capcana l: CREATEOBJECT
|
||||||
|
*-- dintr-o procedura intoarce obiect stricat in acest runtime headless)
|
||||||
|
PUBLIC goDlgTest
|
||||||
|
goDlgTest = CREATEOBJECT('cauta_alfa_form', lcCurTest, '', ;
|
||||||
|
'Denumire,Cod fiscal,Contract,Data', 'denumire,cod_fiscal,numar,data', .F., 'denumire', 1)
|
||||||
|
goDlgTest.crs_cursor = lcCurTest
|
||||||
|
goDlgTest.WindowType = 0
|
||||||
|
DO PrLogLocal WITH 'goDlgTest construit (cauta_alfa_form real, cursor=' + lcCurTest + ')'
|
||||||
|
|
||||||
|
PUBLIC gcTestAnafActivat, gcTestAnafLabelType, gcTestAnafLabelVisible, gcTestAnafLabelCaption, gcTestDiag
|
||||||
|
|
||||||
|
*-- ================= apelul real testat =================
|
||||||
|
LOCAL loCauta
|
||||||
|
loCauta = caut_client_contract_activ('', 0, 0, .T., DATE())
|
||||||
|
|
||||||
|
DO PrLogLocal WITH 'caut_client_contract_activ() finalizat'
|
||||||
|
DO PrLogLocal WITH 'DIAG: ' + gcTestDiag
|
||||||
|
DO PrLogLocal WITH 'gcTestAnafActivat=' + TRANSFORM(gcTestAnafActivat) + ;
|
||||||
|
' gcTestAnafLabelType=' + gcTestAnafLabelType + ;
|
||||||
|
' gcTestAnafLabelVisible=' + TRANSFORM(gcTestAnafLabelVisible) + ;
|
||||||
|
' gcTestAnafLabelCaption=[' + gcTestAnafLabelCaption + ']'
|
||||||
|
|
||||||
|
IF gcTestAnafActivat AND gcTestAnafLabelType == 'O'
|
||||||
|
DO PrLogLocal WITH 'PASS: label-ul ANAF (lb_anaf) e creat si activat de caut_client_contract_activ'
|
||||||
|
ELSE
|
||||||
|
DO PrLogLocal WITH 'FAIL (asteptat inainte de fix): label-ul ANAF NU e creat - caut_client_contract_activ nu instantiaza poVerifAlegere'
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
DO PrLogLocal WITH 'GATA'
|
||||||
|
CATCH TO loExcMain
|
||||||
|
DO PrLogLocal WITH 'CATCH ErrorNo=' + TRANSFORM(loExcMain.ErrorNo) + ' Message=' + loExcMain.Message + ;
|
||||||
|
' Proc=' + loExcMain.Procedure + ' Line=' + TRANSFORM(loExcMain.LineNo) + ' [' + loExcMain.LineContents + ']'
|
||||||
|
ENDTRY
|
||||||
|
|
||||||
|
QUIT
|
||||||
|
|
||||||
|
PROCEDURE PrErrLocal
|
||||||
|
LPARAMETERS tnErr, tcMsg, tcProg, tnLine
|
||||||
|
DO PrLogLocal WITH 'ON ERROR ' + TRANSFORM(tnErr) + ' [' + tcProg + ':' + TRANSFORM(tnLine) + '] ' + tcMsg
|
||||||
|
ENDPROC
|
||||||
|
|
||||||
|
PROCEDURE PrLogLocal
|
||||||
|
LPARAMETERS tcMsg
|
||||||
|
SET SAFETY OFF
|
||||||
|
LOCAL lcL
|
||||||
|
lcL = IIF(FILE(gcUILog), FILETOSTR(gcUILog), '')
|
||||||
|
STRTOFILE(lcL + tcMsg + CHR(13)+CHR(10), gcUILog)
|
||||||
|
ENDPROC
|
||||||
84
utile/Teste/test_repro_podate_unknown_member.prg
Normal file
84
utile/Teste/test_repro_podate_unknown_member.prg
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
* test_repro_podate_unknown_member.prg
|
||||||
|
* Reproduce eroarea raportata de utilizator (03.08.2026): "Unknown member PODATE" in
|
||||||
|
* FRM_FACTURA.DO_CAUTA_PARTENER, la clic pe but_cautare_client, in fluxul FACTURA_ACN.
|
||||||
|
*
|
||||||
|
* Cauza: fix-ul anterior a scris "Thisform.poDate.dataact", dar poDate NU e proprietate a
|
||||||
|
* formularului - e variabila PRIVATE declarata in factura_acn() (proceduri_acnpro.prg:3072),
|
||||||
|
* vizibila fara calificator in toate metodele frm_factura (folosita bar asa in ~30 de locuri:
|
||||||
|
* oacnpro.vc2 liniile 7542,7719,7747,8059 etc). Thisform.poDate nu exista => "Unknown member".
|
||||||
|
*
|
||||||
|
* Testeaza DOAR mecanismul de scoping (fara sa instantieze tot frm_factura/crsCapFactura):
|
||||||
|
* replica exact contextul - o procedura apelanta declara PRIVATE poDate, apoi o subprocedura
|
||||||
|
* (analoaga cu metoda do_cauta_partener) foloseste expresia. Verifica intai ca varianta veche
|
||||||
|
* (Thisform.poDate) DA eroarea raportata, apoi ca varianta noua (poDate bare) NU da eroare.
|
||||||
|
*
|
||||||
|
* Rulare: vfp9.exe -A -T "test_repro_podate_unknown_member.prg"
|
||||||
|
|
||||||
|
SET SAFETY OFF
|
||||||
|
SET TALK OFF
|
||||||
|
|
||||||
|
PUBLIC gcUILog
|
||||||
|
gcUILog = "D:\ROA\ROAACNPRO\COMUN\utile\Teste\test_repro_podate_unknown_member_log.txt"
|
||||||
|
STRTOFILE("START" + CHR(13)+CHR(10), gcUILog)
|
||||||
|
|
||||||
|
DO test_apelant_factura_acn
|
||||||
|
|
||||||
|
QUIT
|
||||||
|
|
||||||
|
PROCEDURE test_apelant_factura_acn
|
||||||
|
*-- replica factura_acn(): PRIVATE poDate, ramane in scop pentru tot ce se apeleaza mai jos
|
||||||
|
PRIVATE poDate
|
||||||
|
poDate = CREATEOBJECT('Empty')
|
||||||
|
ADDPROPERTY(poDate, 'dataact', DATE())
|
||||||
|
|
||||||
|
*-- instantiez un obiect minimal, cu o metoda care replica STRICT do_cauta_partener
|
||||||
|
PUBLIC goFormTest
|
||||||
|
goFormTest = CREATEOBJECT('formtest_do_cauta_partener')
|
||||||
|
|
||||||
|
*-- varianta VECHE (bug reportat): Thisform.poDate - poDate nu e proprietate a obiectului
|
||||||
|
LOCAL lcRezVechi
|
||||||
|
lcRezVechi = goFormTest.do_cauta_partener_vechi()
|
||||||
|
DO PrLogLocal WITH 'VARIANTA VECHE (Thisform.poDate): ' + lcRezVechi
|
||||||
|
|
||||||
|
*-- varianta NOUA (fix aplicat): poDate bare, gasit ca PRIVATE in call stack
|
||||||
|
LOCAL lcRezNou
|
||||||
|
lcRezNou = goFormTest.do_cauta_partener_nou()
|
||||||
|
DO PrLogLocal WITH 'VARIANTA NOUA (poDate bare): ' + lcRezNou
|
||||||
|
|
||||||
|
DO PrLogLocal WITH 'GATA'
|
||||||
|
ENDPROC
|
||||||
|
|
||||||
|
DEFINE CLASS formtest_do_cauta_partener AS Form
|
||||||
|
PROCEDURE do_cauta_partener_vechi
|
||||||
|
LOCAL lcRes
|
||||||
|
lcRes = 'NEASTEPTAT: nu a aruncat eroare'
|
||||||
|
TRY
|
||||||
|
LOCAL ldDataTest
|
||||||
|
ldDataTest = Thisform.poDate.dataact
|
||||||
|
lcRes = 'NEASTEPTAT: Thisform.poDate.dataact a functionat, data=' + TRANSFORM(m.ldDataTest)
|
||||||
|
CATCH TO loExc
|
||||||
|
lcRes = 'EROARE REPRODUSA: ErrorNo=' + TRANSFORM(loExc.ErrorNo) + ' Message=' + loExc.Message
|
||||||
|
ENDTRY
|
||||||
|
RETURN m.lcRes
|
||||||
|
ENDPROC
|
||||||
|
|
||||||
|
PROCEDURE do_cauta_partener_nou
|
||||||
|
LOCAL lcRes
|
||||||
|
lcRes = 'NEASTEPTAT: nu s-a putut evalua'
|
||||||
|
TRY
|
||||||
|
LOCAL ldDataTest
|
||||||
|
ldDataTest = poDate.dataact
|
||||||
|
lcRes = 'OK: poDate.dataact rezolvat, data=' + TRANSFORM(m.ldDataTest)
|
||||||
|
CATCH TO loExc
|
||||||
|
lcRes = 'FAIL: ErrorNo=' + TRANSFORM(loExc.ErrorNo) + ' Message=' + loExc.Message
|
||||||
|
ENDTRY
|
||||||
|
RETURN m.lcRes
|
||||||
|
ENDPROC
|
||||||
|
ENDDEFINE
|
||||||
|
|
||||||
|
PROCEDURE PrLogLocal
|
||||||
|
LPARAMETERS tcMsg
|
||||||
|
LOCAL lcL
|
||||||
|
lcL = IIF(FILE(gcUILog), FILETOSTR(gcUILog), '')
|
||||||
|
STRTOFILE(lcL + tcMsg + CHR(13)+CHR(10), gcUILog)
|
||||||
|
ENDPROC
|
||||||
Reference in New Issue
Block a user