Bläddra i källkod

vincular perfil a las tablas y a los logs

Nermosis 3 år sedan
förälder
incheckning
c6255e07a8

+ 1 - 1
application/controllers/Parser.php Visa fil

43
 
43
 
44
                         $this->downloadProcess($row->url_descarga);
44
                         $this->downloadProcess($row->url_descarga);
45
 
45
 
46
-                        $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta);
46
+                        $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row);
47
                     }
47
                     }
48
                 }
48
                 }
49
             } else {
49
             } else {

+ 28 - 25
application/libraries/ParserDatabaseBruto.php Visa fil

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
 
10
 
10
     public function __construct()
11
     public function __construct()
11
     {
12
     {
13
         $this->CI->load->model("Parser_model");
14
         $this->CI->load->model("Parser_model");
14
     }
15
     }
15
 
16
 
16
-    public function setDatosParser($arrayDatosSucios, $fecha)
17
+    public function setDatosParser($arrayDatosSucios, $fecha, $datosPerfil)
17
     {
18
     {
18
         $this->fechaInicioParser = $fecha;
19
         $this->fechaInicioParser = $fecha;
20
+        $this->nombreLog .= $datosPerfil->prefijos_tablas . "__" . $this->fechaInicioParser;
21
+
19
         if (!empty($arrayDatosSucios)) {
22
         if (!empty($arrayDatosSucios)) {
20
 
23
 
21
             foreach ($arrayDatosSucios as $nombreArchivo => $datosArchivo) {
24
             foreach ($arrayDatosSucios as $nombreArchivo => $datosArchivo) {
22
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, "ARCHIVO ---" . $nombreArchivo, false);
25
+                guardar_log($this->nombreLog, "ARCHIVO ---" . $nombreArchivo, false);
23
 
26
 
24
                 foreach ($datosArchivo as $row) {
27
                 foreach ($datosArchivo as $row) {
25
                     $idLicitacion = $this->setInicioLicitacion($row['general']);
28
                     $idLicitacion = $this->setInicioLicitacion($row['general']);
68
 
71
 
69
         if ($insertLicitacion) {
72
         if ($insertLicitacion) {
70
             $result = array("result" => true, "id" => $insertLicitacion);
73
             $result = array("result" => true, "id" => $insertLicitacion);
71
-            guardar_log("setLicitacion_" . $this->fechaInicioParser, "Licitacion ID " . $datosInicioLicitacion['id_licitacion'] . " - BBDD Licitación ID " . $insertLicitacion, "false");
74
+            guardar_log($this->nombreLog, "Licitacion ID " . $datosInicioLicitacion['id_licitacion'] . " - BBDD Licitación ID " . $insertLicitacion, "false");
72
         } else {
75
         } else {
73
             $result = array("result" => true, "id" => 0);
76
             $result = array("result" => true, "id" => 0);
74
-            guardar_log("setLicitacion_" . $this->fechaInicioParser, "Licitacion ID " . $datosInicioLicitacion['id_licitacion'], "false", 2);
77
+            guardar_log($this->nombreLog, "Licitacion ID " . $datosInicioLicitacion['id_licitacion'], "false", 2);
75
         }
78
         }
76
 
79
 
77
         return $result;
80
         return $result;
113
                 unset($setInsert[$aux]['itemClassification']);
116
                 unset($setInsert[$aux]['itemClassification']);
114
 
117
 
115
                 if (!empty($setInsert)) {
118
                 if (!empty($setInsert)) {
116
-                    $resultInsert = insertBucle($setInsert, "BRUTO_procurement_project_lot", "setLicitacion_" . $this->fechaInicioParser);
119
+                    $resultInsert = insertBucle($setInsert, "BRUTO_procurement_project_lot", $this->nombreLog);
117
                     if (array_key_exists('itemClassification', $row)) {
120
                     if (array_key_exists('itemClassification', $row)) {
118
                         $this->setDatosMultiples($row, "itemClassification", "BRUTO_procurement_project_lot_item", $resultInsert, "ProcurementLotItem");
121
                         $this->setDatosMultiples($row, "itemClassification", "BRUTO_procurement_project_lot_item", $resultInsert, "ProcurementLotItem");
119
                     }
122
                     }
123
 
126
 
124
             if ($resultInsert) {
127
             if ($resultInsert) {
125
                 $result = array("result" => true);
128
                 $result = array("result" => true);
126
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, "ProcurementLot Finalizada Inserción", "false");
129
+                guardar_log($this->nombreLog, "ProcurementLot Finalizada Inserción", "false");
127
             } else {
130
             } else {
128
                 $result = array("result" => true, "id" => 0);
131
                 $result = array("result" => true, "id" => 0);
129
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, "ProcurementLot Fallida", "false", 2);
132
+                guardar_log($this->nombreLog, "ProcurementLot Fallida", "false", 2);
130
             }
133
             }
131
         } else {
134
         } else {
132
-            guardar_log("setLicitacion_" . $this->fechaInicioParser, "ProcurementLot vacio", "false");
135
+            guardar_log($this->nombreLog, "ProcurementLot vacio", "false");
133
         }
136
         }
134
     }
137
     }
135
 
138
 
145
             $setInsert['tenderingTerms'][0]['id_ajena'] = $this->idLicitacion;
148
             $setInsert['tenderingTerms'][0]['id_ajena'] = $this->idLicitacion;
146
 
149
 
147
             if (!empty($setInsert)) {
150
             if (!empty($setInsert)) {
148
-                $resultInsert = insertBucle($setInsert['tenderingTerms'], "BRUTO_tendering_terms", "setLicitacion_" . $this->fechaInicioParser);
151
+                $resultInsert = insertBucle($setInsert['tenderingTerms'], "BRUTO_tendering_terms", $this->nombreLog);
149
 
152
 
150
                 if ($resultInsert > 0) {
153
                 if ($resultInsert > 0) {
151
                     $this->setDatosMultiples($tenderingTermsInfo, 1, "BRUTO_tendering_terms_awarding_terms", $resultInsert, "TenderingTermsAwardingTerms");
154
                     $this->setDatosMultiples($tenderingTermsInfo, 1, "BRUTO_tendering_terms_awarding_terms", $resultInsert, "TenderingTermsAwardingTerms");
160
 
163
 
161
             if ($resultInsert) {
164
             if ($resultInsert) {
162
                 $result = array("result" => true);
165
                 $result = array("result" => true);
163
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, "TenderingTerms Finalizada Inserción", "false");
166
+                guardar_log($this->nombreLog, "TenderingTerms Finalizada Inserción", "false");
164
             } else {
167
             } else {
165
                 $result = array("result" => true, "id" => 0);
168
                 $result = array("result" => true, "id" => 0);
166
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, "TenderingTerms Fallida", "false", 2);
169
+                guardar_log($this->nombreLog, "TenderingTerms Fallida", "false", 2);
167
             }
170
             }
168
         } else {
171
         } else {
169
-            guardar_log("setLicitacion_" . $this->fechaInicioParser, "TenderingTerms vacio", "false");
172
+            guardar_log($this->nombreLog, "TenderingTerms vacio", "false");
170
         }
173
         }
171
     }
174
     }
172
 
175
 
186
                 unset($setInsert[$aux]['fechas']);
189
                 unset($setInsert[$aux]['fechas']);
187
 
190
 
188
                 if (!empty($setInsert)) {
191
                 if (!empty($setInsert)) {
189
-                    $resultInsert = insertBucle($setInsert, "BRUTO_valid_notice_info", "setLicitacion_" . $this->fechaInicioParser);
192
+                    $resultInsert = insertBucle($setInsert, "BRUTO_valid_notice_info", $this->nombreLog);
190
 
193
 
191
                     if ($resultInsert > 0) {
194
                     if ($resultInsert > 0) {
192
                         $this->setDatosMultiples($row, "documento", "BRUTO_valid_notice_info_documento", $resultInsert, "validNoticeInfoFechas");
195
                         $this->setDatosMultiples($row, "documento", "BRUTO_valid_notice_info_documento", $resultInsert, "validNoticeInfoFechas");
199
 
202
 
200
             if ($resultInsert) {
203
             if ($resultInsert) {
201
                 $result = array("result" => true);
204
                 $result = array("result" => true);
202
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, "validNoticeInfo Finalizada Inserción", "false");
205
+                guardar_log($this->nombreLog, "validNoticeInfo Finalizada Inserción", "false");
203
             } else {
206
             } else {
204
                 $result = array("result" => true, "id" => 0);
207
                 $result = array("result" => true, "id" => 0);
205
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, "validNoticeInfo Fallida", "false", 2);
208
+                guardar_log($this->nombreLog, "validNoticeInfo Fallida", "false", 2);
206
             }
209
             }
207
         } else {
210
         } else {
208
-            guardar_log("setLicitacion_" . $this->fechaInicioParser, "validNoticeInfo vacio", "false");
211
+            guardar_log($this->nombreLog, "validNoticeInfo vacio", "false");
209
         }
212
         }
210
     }
213
     }
211
 
214
 
221
                 $arrayInsertar[0]['id_ajena'] = $idAjena;
224
                 $arrayInsertar[0]['id_ajena'] = $idAjena;
222
             }
225
             }
223
 
226
 
224
-            $insertedId = insertBucle($arrayInsertar, $tabla, "setLicitacion_" . $this->fechaInicioParser);
227
+            $insertedId = insertBucle($arrayInsertar, $tabla, $this->nombreLog);
225
 
228
 
226
             if ($insertedId == 0) {
229
             if ($insertedId == 0) {
227
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Fallido", "false");
230
+                guardar_log($this->nombreLog, $nodoLog . " Fallido", "false");
228
             } else {
231
             } else {
229
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Finalizada Inserción", "false");
232
+                guardar_log($this->nombreLog, $nodoLog . " Finalizada Inserción", "false");
230
             }
233
             }
231
         } else {
234
         } else {
232
-            guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");
235
+            guardar_log($this->nombreLog, $nodoLog . " vacio", "false");
233
         }
236
         }
234
 
237
 
235
         return $insertedId;
238
         return $insertedId;
254
                 }
257
                 }
255
 
258
 
256
                 if (!empty($setInsert)) {
259
                 if (!empty($setInsert)) {
257
-                    $resultInsert = insertBucle($setInsert, $tabla, "setLicitacion_" . $this->fechaInicioParser);
260
+                    $resultInsert = insertBucle($setInsert, $tabla, $this->nombreLog);
258
                 }
261
                 }
259
 
262
 
260
                 if ($resultInsert) {
263
                 if ($resultInsert) {
261
                     $result = array("result" => true);
264
                     $result = array("result" => true);
262
-                    guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Finalizada Inserción", "false");
265
+                    guardar_log($this->nombreLog, $nodoLog . " Finalizada Inserción", "false");
263
                 } else {
266
                 } else {
264
                     $result = array("result" => true, "id" => 0);
267
                     $result = array("result" => true, "id" => 0);
265
-                    guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " Fallida", "false", 2);
268
+                    guardar_log($this->nombreLog, $nodoLog . " Fallida", "false", 2);
266
                 }
269
                 }
267
             } else {
270
             } else {
268
-                guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");
271
+                guardar_log($this->nombreLog, $nodoLog . " vacio", "false");
269
             }
272
             }
270
         } else {
273
         } else {
271
-            guardar_log("setLicitacion_" . $this->fechaInicioParser, $nodoLog . " vacio", "false");
274
+            guardar_log($this->nombreLog, $nodoLog . " vacio", "false");
272
         }
275
         }
273
     }
276
     }
274
 
277
 

+ 6 - 6
application/libraries/ParserFile.php Visa fil

17
         $this->CI->load->library('parserdatabasebruto');
17
         $this->CI->load->library('parserdatabasebruto');
18
     }
18
     }
19
 
19
 
20
-    public function index($rutaDiariaDownloader, $fechaInicioParser)
20
+    public function index($rutaDiariaDownloader, $fechaInicioParser, $datosPerfil)
21
     {
21
     {
22
         $this->rutaDiaria = $rutaDiariaDownloader . "/format/";
22
         $this->rutaDiaria = $rutaDiariaDownloader . "/format/";
23
         $files = get_filenames($this->rutaDiaria, true);
23
         $files = get_filenames($this->rutaDiaria, true);
24
 
24
 
25
-        guardar_log("setLicitacion_" . $fechaInicioParser, "----------------------------------", false);
25
+        guardar_log("setLicitacion__" . $datosPerfil->prefijos_tablas . "__" . $fechaInicioParser, "----------------------------------", false);
26
 
26
 
27
         $resultEntries = array();
27
         $resultEntries = array();
28
         foreach ($files as $file) {
28
         foreach ($files as $file) {
34
             foreach ($xml->entry as $clave => $row) {
34
             foreach ($xml->entry as $clave => $row) {
35
                 $arrayDeletedEntries = $xml->children('at', true);
35
                 $arrayDeletedEntries = $xml->children('at', true);
36
 
36
 
37
-                $resultEntries[$filename][$aux]['general'] = $this->nodoEntry($row);
37
+                $resultEntries[$filename][$aux]['general'] = $this->nodoEntry($row, $datosPerfil->id);
38
 
38
 
39
                 $resultEntries[$filename][$aux]['contractInfo'] = $this->nodoContractFolderStatus($row); //
39
                 $resultEntries[$filename][$aux]['contractInfo'] = $this->nodoContractFolderStatus($row); //
40
 
40
 
70
             file_put_contents($this->rutaDiaria . "/text_" . $filename . ".txt", $str);
70
             file_put_contents($this->rutaDiaria . "/text_" . $filename . ".txt", $str);
71
         }
71
         }
72
 
72
 
73
-        $this->CI->parserdatabasebruto->setDatosParser($resultEntries, $fechaInicioParser);
73
+        $this->CI->parserdatabasebruto->setDatosParser($resultEntries, $fechaInicioParser, $datosPerfil);
74
 
74
 
75
         return;
75
         return;
76
     }
76
     }
77
 
77
 
78
-    private function nodoEntry($xml)
78
+    private function nodoEntry($xml, $tipoPerfil)
79
     {
79
     {
80
         $resultEntries = array();
80
         $resultEntries = array();
81
 
81
 
85
         $resultEntries['summary'] = (string) $xml->summary;
85
         $resultEntries['summary'] = (string) $xml->summary;
86
         $resultEntries['title'] = (string) $xml->title;
86
         $resultEntries['title'] = (string) $xml->title;
87
         $resultEntries['updated'] = (string) $xml->updated;
87
         $resultEntries['updated'] = (string) $xml->updated;
88
-        $resultEntries['tipo_perfil_licitacion'] = 1;
88
+        $resultEntries['tipo_perfil_licitacion'] = $tipoPerfil;
89
         return $resultEntries;
89
         return $resultEntries;
90
     }
90
     }
91
 
91