|
@@ -1,34 +1,34 @@
|
1
|
1
|
<?php
|
2
|
2
|
defined('BASEPATH') or exit('No direct script access allowed');
|
3
|
3
|
|
4
|
|
-/**
|
5
|
|
- *
|
6
|
|
- * Libraries Parserdatabaselimpio
|
7
|
|
- *
|
8
|
|
- * This Libraries for ...
|
9
|
|
- *
|
10
|
|
- * @package CodeIgniter
|
11
|
|
- * @category Libraries
|
12
|
|
- * @author Setiawan Jodi <jodisetiawan@fisip-untirta.ac.id>
|
13
|
|
- * @link https://github.com/setdjod/myci-extension/
|
14
|
|
- * @param ...
|
15
|
|
- * @return ...
|
16
|
|
- *
|
17
|
|
- */
|
18
|
|
-
|
19
|
4
|
class Parserdatabaselimpio
|
20
|
5
|
{
|
21
|
6
|
|
|
7
|
+ //TODO: Vincular nombre de columnas en bruto con nombres de columnas en maestros
|
22
|
8
|
protected $CI;
|
23
|
9
|
|
24
|
10
|
public function __construct()
|
25
|
11
|
{
|
26
|
12
|
$this->CI = &get_instance();
|
|
13
|
+ $this->CI->load->model("Parser_model");
|
27
|
14
|
}
|
28
|
15
|
|
29
|
16
|
public function index()
|
30
|
17
|
{
|
|
18
|
+ $now = date("Y-m-d_H-i-s");
|
|
19
|
+ $tablasInsert = $this->CI->Parser_model->getMapaTablas();
|
|
20
|
+
|
|
21
|
+ if ($tablasInsert['num_rows'] > 0) {
|
|
22
|
+
|
|
23
|
+ foreach ($tablasInsert['datos'] as $row) {
|
|
24
|
+
|
|
25
|
+ $datosTablaToInsert = $this->CI->Parser_model->getDatosBrutos($row->tabla_sucia);
|
31
|
26
|
|
|
27
|
+ if ($datosTablaToInsert['num_rows'] > 0) {
|
|
28
|
+ insertBucleDuplicateOnKey($datosTablaToInsert['datos'], $row->tabla_maestra, "brutoToMaestro_" . $now);
|
|
29
|
+ }
|
|
30
|
+ }
|
|
31
|
+ }
|
32
|
32
|
}
|
33
|
33
|
|
34
|
34
|
}
|