Browse Source

anyadir el string de la clave ajena para transferirlo a las tablas maestras

Nermosis 3 years ago
parent
commit
953b327cef
1 changed files with 29 additions and 29 deletions
  1. 29 29
      application/libraries/ParserDatabaseBruto.php

+ 29 - 29
application/libraries/ParserDatabaseBruto.php View File

6
     protected $idLicitacion = 0;
6
     protected $idLicitacion = 0;
7
     protected $fechaInicioParser = "";
7
     protected $fechaInicioParser = "";
8
     protected $CI;
8
     protected $CI;
9
-    protected $nombreLog = "setLicitacion__";
9
+    protected $nombreLog = "";
10
 
10
 
11
     public function __construct()
11
     public function __construct()
12
     {
12
     {
17
     public function setDatosParser($arrayDatosSucios, $fecha, $datosPerfil)
17
     public function setDatosParser($arrayDatosSucios, $fecha, $datosPerfil)
18
     {
18
     {
19
         $this->fechaInicioParser = $fecha;
19
         $this->fechaInicioParser = $fecha;
20
-        $this->nombreLog .= $datosPerfil->prefijos_tablas . "__" . $this->fechaInicioParser;
20
+        $this->nombreLog = "setLicitacion__" . $datosPerfil->prefijos_tablas . "__" . $this->fechaInicioParser;
21
 
21
 
22
         if (!empty($arrayDatosSucios)) {
22
         if (!empty($arrayDatosSucios)) {
23
 
23
 
30
                     if ($idLicitacion['result']) {
30
                     if ($idLicitacion['result']) {
31
                         $this->idLicitacion = $idLicitacion['id'];
31
                         $this->idLicitacion = $idLicitacion['id'];
32
 
32
 
33
-                        $this->setDatosSingular($row, "contractInfo", "BRUTO_contract_folder", $this->idLicitacion, "ContractInfo");
33
+                        $this->setDatosSingular($row, "contractInfo", "BRUTO_contract_folder", $this->idLicitacion, "ContractInfo", "id_ajena_licitacion");
34
 
34
 
35
-                        $this->setDatosSingular($row, "tenderingProcess", "BRUTO_tendering_process", $this->idLicitacion, "TenderingProcess");
35
+                        $this->setDatosSingular($row, "tenderingProcess", "BRUTO_tendering_process", $this->idLicitacion, "TenderingProcess", "id_ajena_licitacion");
36
 
36
 
37
                         $this->setProcurementProject($row['procurementProject']);
37
                         $this->setProcurementProject($row['procurementProject']);
38
 
38
 
46
 
46
 
47
                         $this->setValidNoticeInfo($row['validNoticeInfo']);
47
                         $this->setValidNoticeInfo($row['validNoticeInfo']);
48
 
48
 
49
-                        $this->setDatosMultiples($row, "tenderingResult", "BRUTO_tender_result", $this->idLicitacion, "TenderResult");
49
+                        $this->setDatosMultiples($row, "tenderingResult", "BRUTO_tender_result", $this->idLicitacion, "TenderResult", "id_ajena_licitacion");
50
 
50
 
51
-                        $this->setDatosMultiples($row, "legalDocs", "BRUTO_legal_documents", $this->idLicitacion, "LegalDocs");
51
+                        $this->setDatosMultiples($row, "legalDocs", "BRUTO_legal_documents", $this->idLicitacion, "LegalDocs", 'id_ajena_licitacion');
52
 
52
 
53
-                        $this->setDatosMultiples($row, "technicalDocs", "BRUTO_technical_documents", $this->idLicitacion, "TechnicalDocs");
53
+                        $this->setDatosMultiples($row, "technicalDocs", "BRUTO_technical_documents", $this->idLicitacion, "TechnicalDocs", "id_ajena_licitacion");
54
 
54
 
55
-                        $this->setDatosMultiples($row, "generalDocs", "BRUTO_general_documents", $this->idLicitacion, "GeneralDocs");
55
+                        $this->setDatosMultiples($row, "generalDocs", "BRUTO_general_documents", $this->idLicitacion, "GeneralDocs", "id_ajena_licitacion");
56
 
56
 
57
-                        $this->setDatosMultiples($row, "additionalDocs", "BRUTO_additional_documents", $this->idLicitacion, "AdditionalDocs");
57
+                        $this->setDatosMultiples($row, "additionalDocs", "BRUTO_additional_documents", $this->idLicitacion, "AdditionalDocs", "id_ajena_licitacion");
58
                     }
58
                     }
59
                 }
59
                 }
60
             }
60
             }
82
 
82
 
83
     private function setLocatedContractingParty($contractInfo): void
83
     private function setLocatedContractingParty($contractInfo): void
84
     {
84
     {
85
-        $locatedContractingPartyId = $this->setDatosSingular($contractInfo, "locatedContractingParty", "BRUTO_located_contracting_party", $this->idLicitacion, "locatedContractingParty");
85
+        $locatedContractingPartyId = $this->setDatosSingular($contractInfo, "locatedContractingParty", "BRUTO_located_contracting_party", $this->idLicitacion, "locatedContractingParty", "id_ajena_licitacion");
86
 
86
 
87
-        $this->setDatosMultiples($contractInfo, "activity", "BRUTO_located_contracting_party_activity", $locatedContractingPartyId, "locatedContractingParty_Activity");
87
+        $this->setDatosMultiples($contractInfo, "activity", "BRUTO_located_contracting_party_activity", $locatedContractingPartyId, "locatedContractingParty_Activity", "id_ajena_lcp");
88
 
88
 
89
     }
89
     }
90
 
90
 
91
     private function setParty($partyInfo): void
91
     private function setParty($partyInfo): void
92
     {
92
     {
93
-        $partyId = $this->setDatosSingular($partyInfo, "party", "BRUTO_party", $this->idLicitacion, "PartyInfo");
93
+        $partyId = $this->setDatosSingular($partyInfo, "party", "BRUTO_party", $this->idLicitacion, "PartyInfo", "id_ajena_licitacion");
94
 
94
 
95
-        $this->setDatosMultiples($partyInfo, "partyIdentification", "BRUTO_party_party_idenfitication", $partyId, "PartyInfo_PartyIdentification");
95
+        $this->setDatosMultiples($partyInfo, "partyIdentification", "BRUTO_party_party_idenfitication", $partyId, "PartyInfo_PartyIdentification", "id_ajena_party");
96
 
96
 
97
     }
97
     }
98
 
98
 
99
     private function setProcurementProject($procurementInfo): void
99
     private function setProcurementProject($procurementInfo): void
100
     {
100
     {
101
-        $procurementProjectId = $this->setDatosSingular($procurementInfo, "budget", "BRUTO_procurement_project", $this->idLicitacion, "ProcurementProject");
101
+        $procurementProjectId = $this->setDatosSingular($procurementInfo, "budget", "BRUTO_procurement_project", $this->idLicitacion, "ProcurementProject", "id_ajena_licitacion");
102
 
102
 
103
-        $this->setDatosMultiples($procurementInfo, "itemClass", "BRUTO_procurement_project_itemClass", $procurementProjectId, "ProcurementProject_ItemClass");
103
+        $this->setDatosMultiples($procurementInfo, "itemClass", "BRUTO_procurement_project_itemClass", $procurementProjectId, "ProcurementProject_ItemClass", "id_ajena_pp");
104
     }
104
     }
105
 
105
 
106
     private function setProcurementProjectLot($procurementLotInfo): void
106
     private function setProcurementProjectLot($procurementLotInfo): void
112
             foreach ($procurementLotInfo as $row) {
112
             foreach ($procurementLotInfo as $row) {
113
                 $setInsert = array();
113
                 $setInsert = array();
114
                 $setInsert[$aux] = $row;
114
                 $setInsert[$aux] = $row;
115
-                $setInsert[$aux]['id_ajena'] = $this->idLicitacion;
115
+                $setInsert[$aux]['id_ajena_licitacion'] = $this->idLicitacion;
116
                 unset($setInsert[$aux]['itemClassification']);
116
                 unset($setInsert[$aux]['itemClassification']);
117
 
117
 
118
                 if (!empty($setInsert)) {
118
                 if (!empty($setInsert)) {
119
                     $resultInsert = insertBucle($setInsert, "BRUTO_procurement_project_lot", $this->nombreLog);
119
                     $resultInsert = insertBucle($setInsert, "BRUTO_procurement_project_lot", $this->nombreLog);
120
                     if (array_key_exists('itemClassification', $row)) {
120
                     if (array_key_exists('itemClassification', $row)) {
121
-                        $this->setDatosMultiples($row, "itemClassification", "BRUTO_procurement_project_lot_item", $resultInsert, "ProcurementLotItem");
121
+                        $this->setDatosMultiples($row, "itemClassification", "BRUTO_procurement_project_lot_item", $resultInsert, "ProcurementLotItem", "id_ajena_ppl");
122
                     }
122
                     }
123
                 }
123
                 }
124
                 $aux++;
124
                 $aux++;
145
 
145
 
146
             $setInsert = array();
146
             $setInsert = array();
147
             $setInsert['tenderingTerms'][0] = $tenderingTermsInfo[0];
147
             $setInsert['tenderingTerms'][0] = $tenderingTermsInfo[0];
148
-            $setInsert['tenderingTerms'][0]['id_ajena'] = $this->idLicitacion;
148
+            $setInsert['tenderingTerms'][0]['id_ajena_licitacion'] = $this->idLicitacion;
149
 
149
 
150
             if (!empty($setInsert)) {
150
             if (!empty($setInsert)) {
151
                 $resultInsert = insertBucle($setInsert['tenderingTerms'], "BRUTO_tendering_terms", $this->nombreLog);
151
                 $resultInsert = insertBucle($setInsert['tenderingTerms'], "BRUTO_tendering_terms", $this->nombreLog);
152
 
152
 
153
                 if ($resultInsert > 0) {
153
                 if ($resultInsert > 0) {
154
-                    $this->setDatosMultiples($tenderingTermsInfo, 1, "BRUTO_tendering_terms_awarding_terms", $resultInsert, "TenderingTermsAwardingTerms");
154
+                    $this->setDatosMultiples($tenderingTermsInfo, 1, "BRUTO_tendering_terms_awarding_terms", $resultInsert, "TenderingTermsAwardingTerms", "id_ajena_tt");
155
 
155
 
156
-                    $this->setDatosMultiples($tenderingTermsInfo, 2, "BRUTO_tendering_terms_qualification_request", $resultInsert, "TenderingTermsQualificationRequest");
156
+                    $this->setDatosMultiples($tenderingTermsInfo, 2, "BRUTO_tendering_terms_qualification_request", $resultInsert, "TenderingTermsQualificationRequest", "id_ajena_tt");
157
 
157
 
158
-                    $this->setDatosMultiples($tenderingTermsInfo, 3, "BRUTO_tendering_terms_financial_evaluation", $resultInsert, "TenderingTermsFinancialEvaluation");
158
+                    $this->setDatosMultiples($tenderingTermsInfo, 3, "BRUTO_tendering_terms_financial_evaluation", $resultInsert, "TenderingTermsFinancialEvaluation", "id_ajena_ttfe");
159
 
159
 
160
-                    $this->setDatosMultiples($tenderingTermsInfo, 4, "BRUTO_tendering_terms_specific_terms", $resultInsert, "TenderingTermsSpecificRequirement");
160
+                    $this->setDatosMultiples($tenderingTermsInfo, 4, "BRUTO_tendering_terms_specific_terms", $resultInsert, "TenderingTermsSpecificRequirement", "id_ajena_tt");
161
                 }
161
                 }
162
             }
162
             }
163
 
163
 
183
             foreach ($validNoticeInfo as $row) {
183
             foreach ($validNoticeInfo as $row) {
184
                 $setInsert = array();
184
                 $setInsert = array();
185
                 $setInsert[$aux] = $row;
185
                 $setInsert[$aux] = $row;
186
-                $setInsert[$aux]['id_ajena'] = $this->idLicitacion;
186
+                $setInsert[$aux]['id_ajena_licitacion'] = $this->idLicitacion;
187
 
187
 
188
                 unset($setInsert[$aux]['documento']);
188
                 unset($setInsert[$aux]['documento']);
189
                 unset($setInsert[$aux]['fechas']);
189
                 unset($setInsert[$aux]['fechas']);
192
                     $resultInsert = insertBucle($setInsert, "BRUTO_valid_notice_info", $this->nombreLog);
192
                     $resultInsert = insertBucle($setInsert, "BRUTO_valid_notice_info", $this->nombreLog);
193
 
193
 
194
                     if ($resultInsert > 0) {
194
                     if ($resultInsert > 0) {
195
-                        $this->setDatosMultiples($row, "documento", "BRUTO_valid_notice_info_documento", $resultInsert, "validNoticeInfoFechas");
195
+                        $this->setDatosMultiples($row, "documento", "BRUTO_valid_notice_info_documento", $resultInsert, "validNoticeInfoFechas", "id_ajena_vni");
196
 
196
 
197
-                        $this->setDatosMultiples($row, "fechas", "BRUTO_valid_notice_info_fecha", $resultInsert, "validNoticeInfoDocumento");
197
+                        $this->setDatosMultiples($row, "fechas", "BRUTO_valid_notice_info_fecha", $resultInsert, "validNoticeInfoDocumento", "id_ajena_vni");
198
                     }
198
                     }
199
                 }
199
                 }
200
                 $aux++;
200
                 $aux++;
212
         }
212
         }
213
     }
213
     }
214
 
214
 
215
-    private function setDatosSingular($arrayDatos, $arrayKey, $tabla, $idAjena = 0, $nodoLog): int
215
+    private function setDatosSingular($arrayDatos, $arrayKey, $tabla, $idAjena = 0, $nodoLog, $txtIdAjena): int
216
     {
216
     {
217
         $insertedId = 0;
217
         $insertedId = 0;
218
         if (!empty($arrayDatos) && array_key_exists($arrayKey, $arrayDatos)) {
218
         if (!empty($arrayDatos) && array_key_exists($arrayKey, $arrayDatos)) {
221
             $arrayInsertar[0] = $arrayDatos[$arrayKey];
221
             $arrayInsertar[0] = $arrayDatos[$arrayKey];
222
 
222
 
223
             if ($idAjena > 0) {
223
             if ($idAjena > 0) {
224
-                $arrayInsertar[0]['id_ajena'] = $idAjena;
224
+                $arrayInsertar[0][$txtIdAjena] = $idAjena;
225
             }
225
             }
226
 
226
 
227
             $insertedId = insertBucle($arrayInsertar, $tabla, $this->nombreLog);
227
             $insertedId = insertBucle($arrayInsertar, $tabla, $this->nombreLog);
238
         return $insertedId;
238
         return $insertedId;
239
     }
239
     }
240
 
240
 
241
-    private function setDatosMultiples($arrayDatos, $arrayKey, $tabla, $idAjena = 0, $nodoLog): void
241
+    private function setDatosMultiples($arrayDatos, $arrayKey, $tabla, $idAjena = 0, $nodoLog, $txtIdAjena): void
242
     {
242
     {
243
         $setInsert = array();
243
         $setInsert = array();
244
         $resultInsert = 0;
244
         $resultInsert = 0;
250
                     $setInsert[$aux] = $row;
250
                     $setInsert[$aux] = $row;
251
 
251
 
252
                     if ($idAjena > 0) {
252
                     if ($idAjena > 0) {
253
-                        $setInsert[$aux]['id_ajena'] = $idAjena;
253
+                        $setInsert[$aux][$txtIdAjena] = $idAjena;
254
                     }
254
                     }
255
 
255
 
256
                     $aux++;
256
                     $aux++;