|
@@ -38,7 +38,7 @@ class ParserFile
|
38
|
38
|
foreach ($files as $file) {
|
39
|
39
|
$resultEntries = array();
|
40
|
40
|
$entrada = file_get_contents($file);
|
41
|
|
- $xml = simplexml_load_string($entrada, "SimpleXMLElement", LIBXML_NOCDATA);
|
|
41
|
+ $xml = simplexml_load_string($entrada, "SimpleXMLElement"); //, LIBXML_NOCDATA | LIBXML_PARSEHUGE);
|
42
|
42
|
$json = json_encode($xml);
|
43
|
43
|
$array = json_decode($json, true);
|
44
|
44
|
|
|
@@ -109,11 +109,11 @@ class ParserFile
|
109
|
109
|
{
|
110
|
110
|
$resultEntries = array();
|
111
|
111
|
if (array_key_exists("ContractFolderStatus", $xml)) {
|
112
|
|
- $contractFolder = $xml['ContractFolderStatus'];
|
|
112
|
+ $contractFolder = (array) $xml['ContractFolderStatus'];
|
113
|
113
|
|
114
|
114
|
$resultEntries['ContractFolderID'] = (string) $contractFolder['ContractFolderID'];
|
115
|
115
|
$resultEntries['ContractFolderStatusCode'] = (string) $contractFolder['ContractFolderStatusCode'];
|
116
|
|
- //$resultEntries['ContractFolderStatusCodeAttr'] = $this->existAttribute($contractFolder, "ContractFolderStatusCode", "string", 'listURI');
|
|
116
|
+ $resultEntries['ContractFolderStatusCodeAttr'] = $this->existAttribute($contractFolder, "ContractFolderStatusCode", "string", 'listURI');
|
117
|
117
|
$resultEntries['id_ajena_licitacion'] = $this->idLicitacion;
|
118
|
118
|
$resultEntries['id_compuesta'] = $this->idLicitacion . "_01";
|
119
|
119
|
$resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
|
|
@@ -342,8 +342,7 @@ class ParserFile
|
342
|
342
|
}
|
343
|
343
|
|
344
|
344
|
//$resultFinal = $this->array_remove_empty($resultEntries);
|
345
|
|
- $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
|
346
|
|
- return $resultFinal;
|
|
345
|
+ return $resultEntries;
|
347
|
346
|
}
|
348
|
347
|
|
349
|
348
|
private function nodoTenderingTerms($xml)
|
|
@@ -424,9 +423,7 @@ class ParserFile
|
424
|
423
|
$resultEntries["tenderingTerm"]['language'] = $this->existNodo($TenderingTerms['Language'], 'ID', 'string');
|
425
|
424
|
}
|
426
|
425
|
|
427
|
|
- //$resultFinal = $this->array_remove_empty($resultEntries);
|
428
|
|
- $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
|
429
|
|
- return $resultFinal;
|
|
426
|
+ return $resultEntries;
|
430
|
427
|
}
|
431
|
428
|
|
432
|
429
|
private function nodoTenderingProcess($xml)
|
|
@@ -640,88 +637,6 @@ class ParserFile
|
640
|
637
|
break;
|
641
|
638
|
}
|
642
|
639
|
}
|
643
|
|
-
|
644
|
|
- /*private function recurseXML($xml, $isEntrys = false)
|
645
|
|
- {
|
646
|
|
- //TODO: 01-02-22- me he quedado acabando esto
|
647
|
|
- $idLicitacion = 0;
|
648
|
|
- $child_count = 0;
|
649
|
|
- $result = array();
|
650
|
|
- $mapaNodo = array("id", "link", "summary", "title");
|
651
|
|
- foreach ($xml as $key => $value) {
|
652
|
|
- //$child_count++;
|
653
|
|
- //TODO: Identificar que es una entry
|
654
|
|
- //TODO: Parsear por mapa y guardar en attr de clase el id de la licitacion
|
655
|
|
- //TODO: Detectar en un array si es un attributo y recoger ese valor
|
656
|
|
- if ($key == "TenderingProcess") {
|
657
|
|
- $idAjeno = $this->idLicitacion;
|
658
|
|
- $idCompuesta = $resultSet->idCompuesta;
|
659
|
|
- $result['bruto_contrato'] = array(
|
660
|
|
- array("expediente" => 1, "id_ajena" => "1892739", "idCompuesta" => 1892739_01),
|
661
|
|
- array("expediente" => 2, "id_ajena" => "123346", "idCompuesta" => 01),
|
662
|
|
- array("expediente" => 2, "id_ajena" => "678789", "idCompuesta" => 01),
|
663
|
|
- )
|
664
|
|
- $result['bruto_contrato'] = array(
|
665
|
|
- array("expediente" => 1, "id_ajena" => "1892739", "idCompuesta" => 01),
|
666
|
|
- array("expediente" => 2, "id_ajena" => "1892739", "idCompuesta" => 01),
|
667
|
|
- array("expediente" => 2, "id_ajena" => "678789", "idCompuesta" => 01),
|
668
|
|
- )
|
669
|
|
- }
|
670
|
|
- if (is_array($value)) {
|
671
|
|
- $this->recurseXML($value);
|
672
|
|
- } else {
|
673
|
|
- if ($key == "id") {
|
674
|
|
- $idLicitacion = $value;
|
675
|
|
- }
|
676
|
|
- }
|
677
|
|
- /* if ($this->RecurseXML($value, $parent . "." . $key) == 0) // no childern, aka "leaf node"
|
678
|
|
- {
|
679
|
|
- print($parent . "." . (string) $key . " = " . (string) $value . "<BR>\n");
|
680
|
|
-
|
681
|
|
- }
|
682
|
|
- }
|
683
|
|
- return $child_count;
|
684
|
|
- }*/
|
685
|
|
-
|
686
|
|
- public function array_remove_empty($haystack)
|
687
|
|
- {
|
688
|
|
- foreach ($haystack as $key => $value) {
|
689
|
|
- if (is_array($value)) {
|
690
|
|
- $haystack[$key] = $this->array_remove_empty($haystack[$key]);
|
691
|
|
- }
|
692
|
|
-
|
693
|
|
- if (empty($haystack[$key])) {
|
694
|
|
- unset($haystack[$key]);
|
695
|
|
- }
|
696
|
|
- }
|
697
|
|
-
|
698
|
|
- return $haystack;
|
699
|
|
- }
|
700
|
|
-
|
701
|
|
- public function checkArrayValuesEmpty($arrayCheck)
|
702
|
|
- {
|
703
|
|
- $valuesTotales = count($arrayCheck);
|
704
|
|
- $valuesVacios = 0;
|
705
|
|
- foreach ($arrayCheck as $key => $value) {
|
706
|
|
-
|
707
|
|
- if (is_array($value)) {
|
708
|
|
- $arrayCheck[$key] = $this->checkArrayValuesEmpty($arrayCheck[$key]);
|
709
|
|
- } else {
|
710
|
|
- $value = trim($value);
|
711
|
|
- if (empty($arrayCheck[$key])) {
|
712
|
|
- $valuesVacios++;
|
713
|
|
- }
|
714
|
|
- }
|
715
|
|
-
|
716
|
|
- }
|
717
|
|
-
|
718
|
|
- if ($valuesTotales == $valuesVacios) {
|
719
|
|
- $this->array_remove_empty($arrayCheck);
|
720
|
|
- } else {
|
721
|
|
- return $arrayCheck;
|
722
|
|
- }
|
723
|
|
- }
|
724
|
|
-
|
725
|
640
|
}
|
726
|
641
|
|
727
|
642
|
/* End of file ParserFile.php */
|