diff --git a/Programe/oproceduri_autopass.prg b/Programe/oproceduri_autopass.prg index 19726ba..cb15408 100644 --- a/Programe/oproceduri_autopass.prg +++ b/Programe/oproceduri_autopass.prg @@ -713,8 +713,8 @@ DEFINE CLASS AutopassClient AS Custom AddProperty(loRezItem, 'valid', This.GetProprietate(m.loElem, 'valid', .F.)) AddProperty(loRezItem, 'status_estimat', This.GetProprietate(m.loElem, 'status_estimat', '')) AddProperty(loRezItem, 'rar_env', This.GetProprietate(m.loElem, 'rar_env', '')) - AddProperty(loRezItem, 'erori', This.GetProprietate(m.loElem, 'erori', .Null.)) - AddProperty(loRezItem, 'nemapate', This.GetProprietate(m.loElem, 'nemapate', .Null.)) + This.CopiazaListaProprietate(loRezItem, 'erori', m.loElem, 'erori') + This.CopiazaListaProprietate(loRezItem, 'nemapate', m.loElem, 'nemapate') Else * POST /v1/prezentari (raspuns implicit 'minim', SubmissionResultMinim din app/models.py): * index, submission_id, vehicul, status, motiv, id_prezentare @@ -1000,6 +1000,39 @@ DEFINE CLASS AutopassClient AS Custom Endproc + *------------------------------------------------------------------- + Procedure CopiazaListaProprietate + *------------------------------------------------------------------- + * Copiaza pe un obiect-empty destinatie o proprietate a unui obiect-sursa parsat + * de nfjson care poate fi ARRAY (erori[]/nemapate[] din raspunsul Valideaza), + * PASTRAND tot array-ul. GetProprietate NU merge aici: pe un array intoarce doar + * element(1) (o functie VFP nu poate intoarce un array). Array gol (conventie nfjson + * '_EMPTY_ARRAY_FLAG_') sau proprietate lipsa/scalara -> proprietate .Null. pe + * destinatie (consumatorul verifica TYPE(...) = 'A' inainte de a itera). Inversul + * practic al AsignaListaProprietate. + Lparameters toDest, tcPropDest, toSursa, tcPropSursa + + Local lnCount + + If Vartype(m.toSursa) # 'O' Or Type('toSursa.' + m.tcPropSursa + '(1)') = 'U' + *-- proprietate lipsa sau scalara (nu se poate indexa cu (1)) -> nimic de copiat + AddProperty(m.toDest, m.tcPropDest, .Null.) + Return + Endif + + If Type('toSursa.' + m.tcPropSursa + '(1)') = 'C' ; + And toSursa.&tcPropSursa(1) == '_EMPTY_ARRAY_FLAG_' + *-- array gol semnalat de nfjson + AddProperty(m.toDest, m.tcPropDest, .Null.) + Return + Endif + + lnCount = Alen(m.toSursa.&tcPropSursa, 1) + AddProperty(m.toDest, m.tcPropDest + '(' + Transform(m.lnCount) + ')') + Acopy(m.toSursa.&tcPropSursa, toDest.&tcPropDest) + Endproc + + *------------------------------------------------------------------- Procedure GetNumarElemente *-------------------------------------------------------------------