Parserdatabaselimpio.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. defined('BASEPATH') or exit('No direct script access allowed');
  3. class Parserdatabaselimpio
  4. {
  5. protected $CI;
  6. public function __construct()
  7. {
  8. $this->CI = &get_instance();
  9. $this->CI->load->model("Parser_model");
  10. }
  11. public function index()
  12. {
  13. $now = date("Y-m-d_H-i-s");
  14. $tablasInsert = $this->CI->Parser_model->getMapaTablas();
  15. if ($tablasInsert['num_rows'] > 0) {
  16. $licitacionDeleteCascada = $this->CI->Parser_model->getLicitacionesNuevasBruto();
  17. if ($licitacionDeleteCascada['num_rows'] > 0) {
  18. $this->CI->Parser_model->deleteCascadaNuevasLicitaciones();
  19. foreach ($tablasInsert['datos'] as $row) {
  20. $datosTablaToInsert = $this->CI->Parser_model->getDatosBrutos($row->tabla_sucia);
  21. if ($datosTablaToInsert['num_rows'] > 0) {
  22. if ($row->tabla_maestra == "maestro_datos_iniciales_licitacion") {
  23. foreach ($datosTablaToInsert['datos'] as $datos) {
  24. unset($datos->id);
  25. }
  26. }
  27. insertBucleDuplicateOnKey($datosTablaToInsert['datos'], $row->tabla_maestra, "brutoToMaestro_" . $now);
  28. }
  29. }
  30. }
  31. }
  32. }
  33. }
  34. /* End of file Parserdatabaselimpio.php */
  35. /* Location: ./application/libraries/Parserdatabaselimpio.php */