Ejemplo n.º 1
0
 private function test_models()
 {
     $last_errores = array();
     switch ($this->informe['model']) {
         default:
             /// tablas
             $this->test_tablas();
             break;
         case 'asiento':
             $asiento = new asiento();
             $asientos = $asiento->all($this->informe['offset']);
             if ($asientos) {
                 if ($this->informe['offset'] == 0) {
                     foreach ($this->check_partidas_erroneas() as $err) {
                         $last_errores[] = $err;
                     }
                 }
                 foreach ($asientos as $asi) {
                     if ($asi->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$asi->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $asi->codejercicio, 'id' => $asi->numero, 'url' => $asi->url(), 'fecha' => $asi->fecha, 'fix' => $asi->fix());
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura cliente':
             $factura = new factura_cliente();
             $facturas = $factura->all($this->informe['offset']);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura proveedor':
             $factura = new factura_proveedor();
             $facturas = $factura->all($this->informe['offset']);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran cliente':
             $albaran = new albaran_cliente();
             $albaranes = $albaran->all($this->informe['offset']);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran proveedor':
             $albaran = new albaran_proveedor();
             $albaranes = $albaran->all($this->informe['offset']);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         $this->informe['model'] = 'fin';
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 $this->informe['model'] = 'dirclientes';
                 $this->informe['offset'] = 0;
             }
             break;
         case 'dirclientes':
             $dircli0 = new direccion_cliente();
             $direcciones = $dircli0->all($this->informe['offset']);
             if ($direcciones) {
                 foreach ($direcciones as $dir) {
                     /// simplemente guardamos para que se eliminen espacios de ciudades, provincias, etc...
                     $dir->save();
                 }
                 $this->informe['offset'] += FS_ITEM_LIMIT;
             } else {
                 $this->informe['model'] = 'fin';
                 $this->informe['offset'] = 0;
             }
             break;
         case 'fin':
             break;
     }
     return $last_errores;
 }
Ejemplo n.º 2
0
 private function test_models()
 {
     $mpp = 100;
     $last_errores = array();
     switch ($this->informe['model']) {
         default:
             /// tablas
             $this->test_tablas();
             break;
         case 'asiento':
             $asiento = new asiento();
             $asientos = $asiento->all($this->informe['offset'], $mpp);
             if ($asientos) {
                 if ($this->informe['offset'] == 0) {
                     foreach ($this->check_partidas_erroneas() as $err) {
                         $last_errores[] = $err;
                     }
                 }
                 foreach ($asientos as $asi) {
                     if ($asi->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$asi->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $asi->codejercicio, 'id' => $asi->numero, 'url' => $asi->url(), 'fecha' => $asi->fecha, 'fix' => $asi->fix());
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura cliente':
             $factura = new factura_cliente();
             $facturas = $factura->all($this->informe['offset'], $mpp);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'factura proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'factura proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'factura proveedor':
             $factura = new factura_proveedor();
             $facturas = $factura->all($this->informe['offset'], $mpp);
             if ($facturas) {
                 foreach ($facturas as $fac) {
                     if ($fac->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran cliente';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$fac->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $fac->codejercicio, 'id' => $fac->codigo, 'url' => $fac->url(), 'fecha' => $fac->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran cliente';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran cliente':
             $albaran = new albaran_cliente();
             $albaranes = $albaran->all($this->informe['offset'], $mpp);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         if ($this->informe['all']) {
                             $this->informe['model'] = 'albaran proveedor';
                         } else {
                             $this->informe['model'] = 'fin';
                         }
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 if ($this->informe['all']) {
                     $this->informe['model'] = 'albaran proveedor';
                     $this->informe['offset'] = 0;
                 } else {
                     $this->informe['model'] = 'fin';
                     $this->informe['offset'] = 0;
                 }
             }
             break;
         case 'albaran proveedor':
             $albaran = new albaran_proveedor();
             $albaranes = $albaran->all($this->informe['offset'], $mpp);
             if ($albaranes) {
                 foreach ($albaranes as $alb) {
                     if ($alb->codejercicio == $this->informe['ejercicio']) {
                         $this->informe['model'] = 'fin';
                         $this->informe['offset'] = 0;
                         break;
                     } else {
                         if (!$alb->full_test($this->informe['duplicados'])) {
                             $last_errores[] = array('error' => 'Fallo en full_test()', 'model' => $this->informe['model'], 'ejercicio' => $alb->codejercicio, 'id' => $alb->codigo, 'url' => $alb->url(), 'fecha' => $alb->fecha, 'fix' => FALSE);
                         }
                     }
                 }
                 $this->informe['offset'] += $mpp;
             } else {
                 $this->informe['model'] = 'fin';
                 $this->informe['offset'] = 0;
             }
             break;
         case 'fin':
             break;
     }
     return $last_errores;
 }