소스 검색

parametrizar funciones de insercion para los 3 archivos. Tests

Nermosis 3 년 전
부모
커밋
687b76031e
4개의 변경된 파일109개의 추가작업 그리고 116개의 파일을 삭제
  1. 4 4
      application/controllers/Parser.php
  2. 12 27
      application/helpers/funciones_helper.php
  3. 51 70
      application/libraries/ParserDatabase.php
  4. 42 15
      application/libraries/ParserFile.php

+ 4 - 4
application/controllers/Parser.php 파일 보기

24
         $fechaCarpeta = date("Y-m-d_H-i-s");
24
         $fechaCarpeta = date("Y-m-d_H-i-s");
25
         if ($this->newFolder($this->rutaDiaria . $fechaCarpeta)) {
25
         if ($this->newFolder($this->rutaDiaria . $fechaCarpeta)) {
26
             $this->rutaDiariaFecha = $this->rutaDiaria . $fechaCarpeta . "/";
26
             $this->rutaDiariaFecha = $this->rutaDiaria . $fechaCarpeta . "/";
27
-            $this->downloadProcess();
27
+            $this->downloadProcess(URL_DIARIA_CONTRATOS_MENORES_PERFILES_CONTRATANES);
28
             $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta);
28
             $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta);
29
         }
29
         }
30
     }
30
     }
31
 
31
 
32
-    private function downloadProcess()
32
+    private function downloadProcess($urlXML)
33
     {
33
     {
34
-        $fileName = basename(URL_DIARIA);
35
-        $this->downloadFile($fileName, URL_DIARIA, $this->rutaDiariaFecha);
34
+        $fileName = basename($urlXML);
35
+        $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
36
 
36
 
37
         $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
37
         $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
38
         $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
38
         $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);

+ 12 - 27
application/helpers/funciones_helper.php 파일 보기

152
 
152
 
153
         $CI->load->library('email');
153
         $CI->load->library('email');
154
 
154
 
155
-        $config = array();
156
-        if ($_SERVER["SERVER_NAME"] == "rielchyc.test") {
157
-            $config['protocol'] = 'smtp';
158
-            $config['smtp_host'] = 'smtp.gmail.com';
159
-            $config['smtp_user'] = 'chcalvoleon@mindden.com';
160
-            $config['smtp_pass'] = '';
161
-            $config['smtp_crypto'] = 'ssl';
162
-            $config['smtp_port'] = 465;
163
-            $config['mailtype'] = 'html';
164
-            $config['wordwrap'] = 'TRUE';
165
-            $config['newline'] = "\r\n";
166
-            $config['priority'] = 5;
167
-            $config['crlf'] = "\r\n";
168
-        } else {
169
-            $config['protocol'] = 'smtp';
170
-            $config['smtp_host'] = 'b2b.rielchyc.es';
171
-            $config['smtp_user'] = 'webmaster@b2b.rielchyc.es';
172
-            $config['smtp_pass'] = 'Mindden2021!';
173
-            $config['smtp_crypto'] = 'ssl';
174
-            $config['smtp_port'] = 465;
175
-            $config['mailtype'] = 'html';
176
-            $config['wordwrap'] = 'TRUE';
177
-            $config['newline'] = "\r\n";
178
-            $config['priority'] = 5;
179
-            $config['crlf'] = "\r\n";
180
-        }
155
+        $config['protocol'] = 'smtp';
156
+        $config['smtp_host'] = 'smtp.gmail.com';
157
+        $config['smtp_user'] = 'chcalvoleon@mindden.com';
158
+        $config['smtp_pass'] = '';
159
+        $config['smtp_crypto'] = 'ssl';
160
+        $config['smtp_port'] = 465;
161
+        $config['mailtype'] = 'html';
162
+        $config['wordwrap'] = 'TRUE';
163
+        $config['newline'] = "\r\n";
164
+        $config['priority'] = 5;
165
+        $config['crlf'] = "\r\n";
181
 
166
 
182
         $CI->email->initialize($config);
167
         $CI->email->initialize($config);
183
         $CI->email->clear(true);
168
         $CI->email->clear(true);
184
 
169
 
185
-        $CI->email->from('webmaster@b2b.rielchyc.es');
170
+        $CI->email->from('chcalvoleon@mindden.com');
186
         $CI->email->to($email_envio);
171
         $CI->email->to($email_envio);
187
         $CI->email->bcc("chcalvoleon@mindden.com");
172
         $CI->email->bcc("chcalvoleon@mindden.com");
188
         $CI->email->subject($asunto);
173
         $CI->email->subject($asunto);

+ 51 - 70
application/libraries/ParserDatabase.php 파일 보기

3
 
3
 
4
 class ParserDatabase
4
 class ParserDatabase
5
 {
5
 {
6
-
7
-    //TODO: Functions return void
8
-
9
     protected $idLicitacion = 0;
6
     protected $idLicitacion = 0;
10
     protected $fechaInicioParser = "";
7
     protected $fechaInicioParser = "";
11
 
8
 
29
                     if ($idLicitacion['result']) {
26
                     if ($idLicitacion['result']) {
30
                         $this->idLicitacion = $idLicitacion['id'];
27
                         $this->idLicitacion = $idLicitacion['id'];
31
 
28
 
32
-                        if ($row['general']['id_licitacion'] == "8500237") {
33
-                            $var = 1;
34
-                        }
35
-
36
-                        $this->setDatosSingular($row['contractInfo'], "BRUTO_contract_folder", $this->idLicitacion, "ContractInfo");
29
+                        $this->setDatosSingular($row, "contractInfo", "BRUTO_contract_folder", $this->idLicitacion, "ContractInfo");
37
 
30
 
38
-                        $this->setDatosSingular($row['tenderingProcess'], "BRUTO_tendering_process", $this->idLicitacion, "TenderingProcess");
31
+                        $this->setDatosSingular($row, "tenderingProcess", "BRUTO_tendering_process", $this->idLicitacion, "TenderingProcess");
39
 
32
 
40
                         $this->setProcurementProject($row['procurementProject']);
33
                         $this->setProcurementProject($row['procurementProject']);
41
 
34
 
49
 
42
 
50
                         $this->setValidNoticeInfo($row['validNoticeInfo']);
43
                         $this->setValidNoticeInfo($row['validNoticeInfo']);
51
 
44
 
52
-                        $this->setDatosMultiples($row['tenderingResult'], "BRUTO_tender_result", $this->idLicitacion, "TenderResult");
45
+                        $this->setDatosMultiples($row, "tenderingResult", "BRUTO_tender_result", $this->idLicitacion, "TenderResult");
53
 
46
 
54
-                        $this->setDatosMultiples($row['legalDocs'], "BRUTO_legal_documents", $this->idLicitacion, "LegalDocs");
47
+                        $this->setDatosMultiples($row, "legalDocs", "BRUTO_legal_documents", $this->idLicitacion, "LegalDocs");
55
 
48
 
56
-                        $this->setDatosMultiples($row['technicalDocs'], "BRUTO_technical_documents", $this->idLicitacion, "TechnicalDocs");
49
+                        $this->setDatosMultiples($row, "technicalDocs", "BRUTO_technical_documents", $this->idLicitacion, "TechnicalDocs");
57
 
50
 
58
-                        $this->setDatosMultiples($row['generalDocs'], "BRUTO_general_documents", $this->idLicitacion, "GeneralDocs");
59
-
60
-                        $this->setDatosMultiples($row['additionalDocs'], "BRUTO_additional_documents", $this->idLicitacion, "AdditionalDocs");
51
+                        $this->setDatosMultiples($row, "generalDocs", "BRUTO_general_documents", $this->idLicitacion, "GeneralDocs");
61
 
52
 
53
+                        $this->setDatosMultiples($row, "additionalDocs", "BRUTO_additional_documents", $this->idLicitacion, "AdditionalDocs");
62
                     }
54
                     }
63
                 }
55
                 }
64
             }
56
             }
84
 
76
 
85
     private function setLocatedContractingParty($contractInfo): void
77
     private function setLocatedContractingParty($contractInfo): void
86
     {
78
     {
87
-        $locatedContractingPartyId = $this->setDatosSingular($contractInfo['locatedContractingParty'], "BRUTO_located_contracting_party", $this->idLicitacion, "locatedContractingParty");
79
+        $locatedContractingPartyId = $this->setDatosSingular($contractInfo, "locatedContractingParty", "BRUTO_located_contracting_party", $this->idLicitacion, "locatedContractingParty");
80
+
81
+        $this->setDatosMultiples($contractInfo, "activity", "BRUTO_located_contracting_party_activity", $locatedContractingPartyId, "locatedContractingParty_Activity");
88
 
82
 
89
-        $this->setDatosMultiples($contractInfo['activity'], "BRUTO_located_contracting_party_activity", $locatedContractingPartyId, "locatedContractingParty_Activity");
90
     }
83
     }
91
 
84
 
92
     private function setParty($partyInfo): void
85
     private function setParty($partyInfo): void
93
     {
86
     {
94
-        $partyId = $this->setDatosSingular($partyInfo['party'], "BRUTO_party", $this->idLicitacion, "PartyInfo");
87
+        $partyId = $this->setDatosSingular($partyInfo, "party", "BRUTO_party", $this->idLicitacion, "PartyInfo");
88
+
89
+        $this->setDatosMultiples($partyInfo, "partyIdentification", "BRUTO_party_party_idenfitication", $partyId, "PartyInfo_PartyIdentification");
95
 
90
 
96
-        $this->setDatosMultiples($partyInfo['partyIdentification'], "BRUTO_party_party_idenfitication", $partyId, "PartyInfo_PartyIdentification");
97
     }
91
     }
98
 
92
 
99
     private function setProcurementProject($procurementInfo): void
93
     private function setProcurementProject($procurementInfo): void
100
     {
94
     {
101
-        $procurementProjectId = $this->setDatosSingular($procurementInfo['budget'], "BRUTO_procurement_project", $this->idLicitacion, "ProcurementProject");
102
-
103
-        if (array_key_exists("itemClass", $procurementInfo)) {
104
-            $this->setDatosMultiples($procurementInfo['itemClass'], "BRUTO_procurement_project_itemClass", $procurementProjectId, "ProcurementProject_ItemClass");
105
-        }
95
+        $procurementProjectId = $this->setDatosSingular($procurementInfo, "budget", "BRUTO_procurement_project", $this->idLicitacion, "ProcurementProject");
106
 
96
 
97
+        $this->setDatosMultiples($procurementInfo, "itemClass", "BRUTO_procurement_project_itemClass", $procurementProjectId, "ProcurementProject_ItemClass");
107
     }
98
     }
108
 
99
 
109
     private function setProcurementProjectLot($procurementLotInfo): void
100
     private function setProcurementProjectLot($procurementLotInfo): void
110
     {
101
     {
111
-
112
         $resultInsert = 0;
102
         $resultInsert = 0;
113
 
103
 
114
         if (!empty($procurementLotInfo)) {
104
         if (!empty($procurementLotInfo)) {
121
 
111
 
122
                 if (!empty($setInsert)) {
112
                 if (!empty($setInsert)) {
123
                     $resultInsert = insertBucle($setInsert, "BRUTO_procurement_project_lot", "setLicitacion_" . $this->fechaInicioParser);
113
                     $resultInsert = insertBucle($setInsert, "BRUTO_procurement_project_lot", "setLicitacion_" . $this->fechaInicioParser);
124
-                    if ($row['itemClassification']) {
125
-                        $this->setDatosMultiples($row['itemClassification'], "BRUTO_procurement_project_lot_item", $resultInsert, "ProcurementLotItem");
114
+                    if (array_key_exists('itemClassification', $row)) {
115
+                        $this->setDatosMultiples($row, "itemClassification", "BRUTO_procurement_project_lot_item", $resultInsert, "ProcurementLotItem");
126
                     }
116
                     }
127
                 }
117
                 }
128
                 $aux++;
118
                 $aux++;
146
         $resultInsert = 0;
136
         $resultInsert = 0;
147
 
137
 
148
         if (!empty($tenderingTermsInfo)) {
138
         if (!empty($tenderingTermsInfo)) {
149
-            $aux = 0;
150
-            //foreach ($tenderingTermsInfo as $clave => $row) {
139
+
151
             $setInsert = array();
140
             $setInsert = array();
152
             $setInsert['tenderingTerms'][0] = $tenderingTermsInfo[0];
141
             $setInsert['tenderingTerms'][0] = $tenderingTermsInfo[0];
153
             $setInsert['tenderingTerms'][0]['id_ajena'] = $this->idLicitacion;
142
             $setInsert['tenderingTerms'][0]['id_ajena'] = $this->idLicitacion;
156
                 $resultInsert = insertBucle($setInsert['tenderingTerms'], "BRUTO_tendering_terms", "setLicitacion_" . $this->fechaInicioParser);
145
                 $resultInsert = insertBucle($setInsert['tenderingTerms'], "BRUTO_tendering_terms", "setLicitacion_" . $this->fechaInicioParser);
157
 
146
 
158
                 if ($resultInsert > 0) {
147
                 if ($resultInsert > 0) {
159
-                    if (array_key_exists(1, $tenderingTermsInfo)) {
160
-                        $this->setDatosMultiples($tenderingTermsInfo[1], "BRUTO_tendering_terms_awarding_terms", $resultInsert, "TenderingTermsAwardingTerms");
161
-                    }
148
+                    $this->setDatosMultiples($tenderingTermsInfo, 1, "BRUTO_tendering_terms_awarding_terms", $resultInsert, "TenderingTermsAwardingTerms");
162
 
149
 
163
-                    if (array_key_exists(2, $tenderingTermsInfo)) {
164
-                        $this->setDatosMultiples($tenderingTermsInfo[2], "BRUTO_tendering_terms_qualification_request", $resultInsert, "TenderingTermsQualificationRequest");
165
-                    }
150
+                    $this->setDatosMultiples($tenderingTermsInfo, 2, "BRUTO_tendering_terms_qualification_request", $resultInsert, "TenderingTermsQualificationRequest");
166
 
151
 
167
-                    if (array_key_exists(3, $tenderingTermsInfo)) {
168
-                        $this->setDatosMultiples($tenderingTermsInfo[3], "BRUTO_tendering_terms_financial_evaluation", $resultInsert, "TenderingTermsFinancialEvaluation");
169
-                    }
152
+                    $this->setDatosMultiples($tenderingTermsInfo, 3, "BRUTO_tendering_terms_financial_evaluation", $resultInsert, "TenderingTermsFinancialEvaluation");
170
 
153
 
171
-                    if (array_key_exists(4, $tenderingTermsInfo)) {
172
-                        $this->setDatosMultiples($tenderingTermsInfo[4], "BRUTO_tendering_terms_specific_terms", $resultInsert, "TenderingTermsSpecificRequirement");
173
-                    }
154
+                    $this->setDatosMultiples($tenderingTermsInfo, 4, "BRUTO_tendering_terms_specific_terms", $resultInsert, "TenderingTermsSpecificRequirement");
174
                 }
155
                 }
175
             }
156
             }
176
-            //$aux++;
177
-            //}
178
 
157
 
179
             if ($resultInsert) {
158
             if ($resultInsert) {
180
                 $result = array("result" => true);
159
                 $result = array("result" => true);
205
 
184
 
206
                 if (!empty($setInsert)) {
185
                 if (!empty($setInsert)) {
207
                     $resultInsert = insertBucle($setInsert, "BRUTO_valid_notice_info", "setLicitacion_" . $this->fechaInicioParser);
186
                     $resultInsert = insertBucle($setInsert, "BRUTO_valid_notice_info", "setLicitacion_" . $this->fechaInicioParser);
208
-                    if (array_key_exists("documento", $row)) {
209
-                        $this->setDatosMultiples($row['documento'], "BRUTO_valid_notice_info_documento", $resultInsert, "validNoticeInfoFechas");
210
-                    }
211
 
187
 
212
-                    if (array_key_exists("fechas", $row)) {
213
-                        $this->setDatosMultiples($row['fechas'], "BRUTO_valid_notice_info_fecha", $resultInsert, "validNoticeInfoDocumento");
188
+                    if ($resultInsert > 0) {
189
+                        $this->setDatosMultiples($row, "documento", "BRUTO_valid_notice_info_documento", $resultInsert, "validNoticeInfoFechas");
190
+
191
+                        $this->setDatosMultiples($row, "fechas", "BRUTO_valid_notice_info_fecha", $resultInsert, "validNoticeInfoDocumento");
214
                     }
192
                     }
215
                 }
193
                 }
216
                 $aux++;
194
                 $aux++;
228
         }
206
         }
229
     }
207
     }
230
 
208
 
231
-    private function setDatosSingular($arrayDatos, $tabla, $idAjena = 0, $nodoLog): int
209
+    private function setDatosSingular($arrayDatos, $arrayKey, $tabla, $idAjena = 0, $nodoLog): int
232
     {
210
     {
233
         $insertedId = 0;
211
         $insertedId = 0;
234
-        if (!empty($arrayDatos)) {
212
+        if (!empty($arrayDatos) && array_key_exists($arrayKey, $arrayDatos)) {
235
             $arrayInsertar = array();
213
             $arrayInsertar = array();
236
 
214
 
237
-            $arrayInsertar[0] = $arrayDatos;
215
+            $arrayInsertar[0] = $arrayDatos[$arrayKey];
238
 
216
 
239
             if ($idAjena > 0) {
217
             if ($idAjena > 0) {
240
                 $arrayInsertar[0]['id_ajena'] = $idAjena;
218
                 $arrayInsertar[0]['id_ajena'] = $idAjena;
247
             } else {
225
             } else {
248
                 guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Finalizada Inserción", "false");
226
                 guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Finalizada Inserción", "false");
249
             }
227
             }
250
-
251
         } else {
228
         } else {
252
             guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");
229
             guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");
253
         }
230
         }
255
         return $insertedId;
232
         return $insertedId;
256
     }
233
     }
257
 
234
 
258
-    private function setDatosMultiples($arrayDatos, $tabla, $idAjena = 0, $nodoLog): void
235
+    private function setDatosMultiples($arrayDatos, $arrayKey, $tabla, $idAjena = 0, $nodoLog): void
259
     {
236
     {
260
         $setInsert = array();
237
         $setInsert = array();
261
         $resultInsert = 0;
238
         $resultInsert = 0;
262
 
239
 
263
-        if (!empty($arrayDatos)) {
264
-            $aux = 0;
265
-            foreach ($arrayDatos as $row) {
266
-                $setInsert[$aux] = $row;
240
+        if (array_key_exists($arrayKey, $arrayDatos)) {
241
+            if (!empty($arrayDatos[$arrayKey])) {
242
+                $aux = 0;
243
+                foreach ($arrayDatos[$arrayKey] as $row) {
244
+                    $setInsert[$aux] = $row;
267
 
245
 
268
-                if ($idAjena > 0) {
269
-                    $setInsert[$aux]['id_ajena'] = $idAjena;
270
-                }
246
+                    if ($idAjena > 0) {
247
+                        $setInsert[$aux]['id_ajena'] = $idAjena;
248
+                    }
271
 
249
 
272
-                $aux++;
273
-            }
250
+                    $aux++;
251
+                }
274
 
252
 
275
-            if (!empty($setInsert)) {
276
-                $resultInsert = insertBucle($setInsert, $tabla, "setLicitacion_" . $this->fechaInicioParser);
277
-            }
253
+                if (!empty($setInsert)) {
254
+                    $resultInsert = insertBucle($setInsert, $tabla, "setLicitacion_" . $this->fechaInicioParser);
255
+                }
278
 
256
 
279
-            if ($resultInsert) {
280
-                $result = array("result" => true);
281
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Finalizada Inserción", "false");
257
+                if ($resultInsert) {
258
+                    $result = array("result" => true);
259
+                    guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Finalizada Inserción", "false");
260
+                } else {
261
+                    $result = array("result" => true, "id" => 0);
262
+                    guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Fallida", "false", 2);
263
+                }
282
             } else {
264
             } else {
283
-                $result = array("result" => true, "id" => 0);
284
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Fallida", "false", 2);
265
+                guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");
285
             }
266
             }
286
         } else {
267
         } else {
287
             guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");
268
             guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");

+ 42 - 15
application/libraries/ParserFile.php 파일 보기

79
 
79
 
80
         $resultEntries['url_id_licitacion'] = (string) $xml->id;
80
         $resultEntries['url_id_licitacion'] = (string) $xml->id;
81
         $resultEntries['id_licitacion'] = (string) substr($xml->id, strrpos($xml->id, '/') + 1);
81
         $resultEntries['id_licitacion'] = (string) substr($xml->id, strrpos($xml->id, '/') + 1);
82
-        $resultEntries['link_licitacion'] = (string) $xml->link;
83
         $resultEntries['link_uri'] = (string) $this->existAttribute($xml, "link", "string", 'href');
82
         $resultEntries['link_uri'] = (string) $this->existAttribute($xml, "link", "string", 'href');
84
         $resultEntries['summary'] = (string) $xml->summary;
83
         $resultEntries['summary'] = (string) $xml->summary;
85
         $resultEntries['title'] = (string) $xml->title;
84
         $resultEntries['title'] = (string) $xml->title;
103
     private function nodoLocatedContractingParty($xml)
102
     private function nodoLocatedContractingParty($xml)
104
     {
103
     {
105
         $resultEntries = array();
104
         $resultEntries = array();
106
-        if (isset($xml->ContractFolderStatus->LocatedContractingParty)) {
105
+        if (isset($xml->ContractFolderStatus->LocatedContractingParty) && !empty($xml->ContractFolderStatus->LocatedContractingParty)) {
107
             $LocatedContractingParty = $xml->ContractFolderStatus->LocatedContractingParty;
106
             $LocatedContractingParty = $xml->ContractFolderStatus->LocatedContractingParty;
108
 
107
 
109
             $resultEntries['locatedContractingParty']['contractingPartyTypeCode'] = $this->existNodo($LocatedContractingParty, "ContractingPartyTypeCode", 'string');
108
             $resultEntries['locatedContractingParty']['contractingPartyTypeCode'] = $this->existNodo($LocatedContractingParty, "ContractingPartyTypeCode", 'string');
276
             }
275
             }
277
         }
276
         }
278
         //$resultFinal = $this->array_remove_empty($resultEntries);
277
         //$resultFinal = $this->array_remove_empty($resultEntries);
279
-        return $resultEntries;
278
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
279
+        return $resultFinal;
280
     }
280
     }
281
 
281
 
282
     private function nodoTenderingTerms($xml)
282
     private function nodoTenderingTerms($xml)
320
                 }
320
                 }
321
             }
321
             }
322
 
322
 
323
-            $financialEvaluationCriteria = $TenderingTerms->TendererQualificationRequest->FinancialEvaluationCriteria;
324
-            if (isset($financialEvaluationCriteria) && !empty($financialEvaluationCriteria)) {
323
+            if (isset($TenderingTerms->TendererQualificationRequest->FinancialEvaluationCriteria)
324
+                && !empty($TenderingTerms->TendererQualificationRequest->FinancialEvaluationCriteria)) {
325
+                $financialEvaluationCriteria = $TenderingTerms->TendererQualificationRequest->FinancialEvaluationCriteria;
325
                 for ($i = 0; $i < count($financialEvaluationCriteria); $i++) {
326
                 for ($i = 0; $i < count($financialEvaluationCriteria); $i++) {
326
                     $resultEntries[3][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($financialEvaluationCriteria[$i], 'EvaluationCriteriaTypeCode', 'string');
327
                     $resultEntries[3][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($financialEvaluationCriteria[$i], 'EvaluationCriteriaTypeCode', 'string');
327
                     $resultEntries[3][$i]['evaluationCriteriaTypeCode_attr'] = $this->existAttribute($financialEvaluationCriteria[$i], "EvaluationCriteriaTypeCode", "string", 'listURI');
328
                     $resultEntries[3][$i]['evaluationCriteriaTypeCode_attr'] = $this->existAttribute($financialEvaluationCriteria[$i], "EvaluationCriteriaTypeCode", "string", 'listURI');
329
                 }
330
                 }
330
             }
331
             }
331
 
332
 
332
-            $specificTendererRequirement = $TenderingTerms->TendererQualificationRequest->SpecificTendererRequirement;
333
-            if (isset($specificTendererRequirement) && !empty($specificTendererRequirement)) {
333
+            if (isset($TenderingTerms->TendererQualificationRequest->SpecificTendererRequirement)
334
+                && !empty($TenderingTerms->TendererQualificationRequest->SpecificTendererRequirement)) {
335
+                $specificTendererRequirement = $TenderingTerms->TendererQualificationRequest->SpecificTendererRequirement;
334
                 for ($i = 0; $i < count($specificTendererRequirement); $i++) {
336
                 for ($i = 0; $i < count($specificTendererRequirement); $i++) {
335
 
337
 
336
                     $resultEntries[4][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($specificTendererRequirement[$i]->SpecificTendererRequirement, 'RequirementTypeCode', 'string');
338
                     $resultEntries[4][$i]['evaluationCriteriaTypeCode'] = $this->existNodo($specificTendererRequirement[$i]->SpecificTendererRequirement, 'RequirementTypeCode', 'string');
340
 
342
 
341
             $resultEntries[0]['language'] = $this->existNodo($TenderingTerms->Language, 'ID', 'string');
343
             $resultEntries[0]['language'] = $this->existNodo($TenderingTerms->Language, 'ID', 'string');
342
         }
344
         }
345
+
343
         //$resultFinal = $this->array_remove_empty($resultEntries);
346
         //$resultFinal = $this->array_remove_empty($resultEntries);
344
-        return $resultEntries;
347
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
348
+        return $resultFinal;
345
     }
349
     }
346
 
350
 
347
     private function nodoTenderingProcess($xml)
351
     private function nodoTenderingProcess($xml)
376
             $resultEntries['documentAvailablePeriod_EndDate'] = $this->existNodo($tenderingProcess->DocumentAvailabilityPeriod, 'EndDate', 'string');
380
             $resultEntries['documentAvailablePeriod_EndDate'] = $this->existNodo($tenderingProcess->DocumentAvailabilityPeriod, 'EndDate', 'string');
377
             $resultEntries['documentAvailablePeriod_EndTime'] = $this->existNodo($tenderingProcess->DocumentAvailabilityPeriod, 'EndTime', 'string');
381
             $resultEntries['documentAvailablePeriod_EndTime'] = $this->existNodo($tenderingProcess->DocumentAvailabilityPeriod, 'EndTime', 'string');
378
         }
382
         }
379
-        $resultFinal = $this->array_remove_empty($resultEntries);
383
+        //$resultFinal = $this->array_remove_empty($resultEntries);
384
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
380
         return $resultFinal;
385
         return $resultFinal;
381
     }
386
     }
382
 
387
 
394
             }
399
             }
395
 
400
 
396
         }
401
         }
397
-        $resultFinal = $this->array_remove_empty($resultEntries);
402
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
398
         return $resultFinal;
403
         return $resultFinal;
399
     }
404
     }
400
 
405
 
412
             }
417
             }
413
 
418
 
414
         }
419
         }
415
-        $resultFinal = $this->array_remove_empty($resultEntries);
420
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
416
         return $resultFinal;
421
         return $resultFinal;
417
     }
422
     }
418
 
423
 
430
             }
435
             }
431
 
436
 
432
         }
437
         }
433
-        $resultFinal = $this->array_remove_empty($resultEntries);
438
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
434
         return $resultFinal;
439
         return $resultFinal;
435
     }
440
     }
436
 
441
 
458
             }
463
             }
459
         }
464
         }
460
 
465
 
461
-        //$resultFinal = $this->array_remove_empty($resultEntries);
466
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
462
         return $resultEntries;
467
         return $resultEntries;
463
     }
468
     }
464
 
469
 
472
             for ($i = 0; $i < count($generalDocument); $i++) {
477
             for ($i = 0; $i < count($generalDocument); $i++) {
473
                 $resultEntries[$i]['idDoc'] = $this->existNodo($generalDocument[$i], 'ID', 'string');
478
                 $resultEntries[$i]['idDoc'] = $this->existNodo($generalDocument[$i], 'ID', 'string');
474
                 $resultEntries[$i]['attachment'] = $this->existNodo($generalDocument[$i]->Attachment->ExternalReference, 'URI', 'string');
479
                 $resultEntries[$i]['attachment'] = $this->existNodo($generalDocument[$i]->Attachment->ExternalReference, 'URI', 'string');
475
-                $resultEntries[$i]['documentHash'] = $this->existNodo($generalDocument[$i]->Attachment->ExternalReference, 'DocumentHash', 'string');
480
+                $resultEntries[$i]['fileName'] = $this->existNodo($generalDocument[$i]->Attachment->ExternalReference, 'FileName', 'string');
476
             }
481
             }
477
 
482
 
478
         }
483
         }
479
-        $resultFinal = $this->array_remove_empty($resultEntries);
484
+        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
480
         return $resultFinal;
485
         return $resultFinal;
481
     }
486
     }
482
 
487
 
556
         return $haystack;
561
         return $haystack;
557
     }
562
     }
558
 
563
 
564
+    public function checkArrayValuesEmpty($arrayCheck)
565
+    {
566
+        $valuesTotales = count($arrayCheck);
567
+        $valuesVacios = 0;
568
+        foreach ($arrayCheck as $key => $value) {
569
+
570
+            if (is_array($value)) {
571
+                $arrayCheck[$key] = $this->checkArrayValuesEmpty($arrayCheck[$key]);
572
+            } else {
573
+                $value = trim($value);
574
+                if (empty($arrayCheck[$key])) {
575
+                    $valuesVacios++;
576
+                }
577
+            }
578
+
579
+        }
580
+
581
+        if ($valuesTotales == $valuesVacios) {
582
+            $this->array_remove_empty($arrayCheck);
583
+        }
584
+    }
585
+
559
 }
586
 }
560
 
587
 
561
 /* End of file ParserFile.php */
588
 /* End of file ParserFile.php */