コード例 #1
0
 /**
  * @Route("terminar/")
  * @Template()
  */
 public function terminarAction(Request $request)
 {
     $id = $this->ObtenerVariable($request, 'id');
     $em = $this->getDoctrine()->getManager();
     $entity = $em->getRepository('Yacare' . $this->BundleName . 'Bundle:' . $this->EntityName)->find($id);
     if ($entity->getEstado() != 100) {
         $entity->setEstado(100);
         $entity->setFechaTerminado(new \DateTime());
         $Comprob = $this->EmitirComprobante($entity);
         if ($Comprob) {
             $Comprob->setTramiteOrigen($entity);
             $Comprob->setNumero($this->ObtenerProximoNumeroComprobante($Comprob));
             $em->persist($Comprob);
             $entity->setComprobante($Comprob);
         }
         $em->persist($entity);
         $em->flush();
         $mensaje = null;
     } else {
         $mensaje = 'El trámite ya estaba terminado.';
         $Comprob = $entity->getComprobante();
     }
     if ($Comprob) {
         $RutaComprob = \Tapir\BaseBundle\Helper\StringHelper::ObtenerRutaBase($Comprob->getComprobanteTipo()->getClase());
     } else {
         $RutaComprob = null;
     }
     return $this->ArrastrarVariables($request, array('entity' => $entity, 'mensaje' => $mensaje, 'comprob' => $Comprob, 'rutacomprob' => $RutaComprob, 'rutacomprob' => $RutaComprob));
 }
コード例 #2
0
 public function ImportarRegistro($Row)
 {
     $resultado = new ResultadoLote();
     //$resultado->Registros[] = $Row;
     $nombreBueno = StringHelper::Desoraclizar($Row['CALLE']);
     $entity = $this->em->getRepository('YacareCatastroBundle:Calle')->findOneBy(array('ImportId' => $Row['CODIGO_CALLE']));
     if (!$entity) {
         $entity = $this->em->getRepository('YacareCatastroBundle:Calle')->findOneBy(array('Nombre' => $nombreBueno));
     }
     if (!$entity) {
         $entity = $this->em->getRepository('YacareCatastroBundle:Calle')->findOneBy(array('NombreAlternativo' => $nombreBueno));
     }
     if (!$entity) {
         $entity = new \Yacare\CatastroBundle\Entity\Calle();
         $entity->setNombre($nombreBueno);
         $entity->setNombreOriginal($Row['CALLE']);
         $entity->setImportSrc('dbmunirg.TG06405');
         $entity->setImportId($Row['CODIGO_CALLE']);
         $resultado->RegistrosNuevos++;
     } else {
         $resultado->RegistrosActualizados++;
     }
     $this->em->persist($entity);
     $this->em->flush();
     return $resultado;
 }
コード例 #3
0
 public function ImportarRegistro($Row)
 {
     $resultado = new ResultadoLote();
     //$resultado->Registros[] = $Row;
     $nombreBueno = StringHelper::Desoraclizar($Row['detalle']);
     $entity = $this->em->getRepository('YacareOrganizacionBundle:Departamento')->findOneBy(array('ImportSrc' => 'rr_hh.direcciones', 'ImportId' => $Row['secretaria'] . '.' . $Row['direccion']));
     if (!$entity) {
         $nuevoId = $this->em->createQuery('SELECT MAX(r.id) FROM YacareOrganizacionBundle:Departamento r')->getSingleScalarResult();
         $entity = new \Yacare\OrganizacionBundle\Entity\Departamento();
         $entity->setId(++$nuevoId);
         $entity->setRango(50);
         $entity->setImportSrc('rr_hh.direcciones');
         $entity->setImportId($Row['secretaria'] . '.' . $Row['direccion']);
         $resultado->RegistrosNuevos++;
     } else {
         $resultado->RegistrosActualizados++;
     }
     if ($entity->getNombreOriginal() != $Row['detalle']) {
         $entity->setNombre($nombreBueno);
         $entity->setNombreOriginal($Row['detalle']);
     }
     if ($Row['fecha_baja']) {
         $entity->setSuprimido(true);
     } else {
         $entity->setSuprimido(false);
     }
     $Secre = $this->em->getRepository('YacareOrganizacionBundle:Departamento')->findOneBy(array('ImportSrc' => 'rr_hh.secretarias', 'ImportId' => $Row['secretaria']));
     $entity->setParentNode($Secre);
     $this->em->persist($entity);
     $this->em->flush();
     return $resultado;
 }
コード例 #4
0
ファイル: ConMailer.php プロジェクト: Drake86cnf/yacare
 /**
  * Agrega una novedad a un requerimiento y envía un e-mail al usuario si corresponde.
  * 
  * @param object $entidad      La novedad a notificar o el reqeurimiento.
  * @param string $vistaEmail   El nombre de la plantilla para el mensaje de e-mail. 
  */
 protected function InformarNovedad($request, $entidad, $vistaEmail = 'YacareRequerimientosBundle:Requerimiento/Mail:requerimiento_novedad.html.twig')
 {
     if (trim(get_class($entidad), '\\') == 'Yacare\\RequerimientosBundle\\Entity\\Novedad') {
         $Requerimiento = $entidad->getRequerimiento();
         $Novedad = $entidad;
     } else {
         $Requerimiento = $entidad;
         $Novedad = null;
     }
     $Destinatarios = array();
     if ($Requerimiento->getEncargado() && $Requerimiento->getEncargado()->getEmail() && filter_var($Requerimiento->getEncargado()->getEmail(), FILTER_VALIDATE_EMAIL)) {
         $Destinatarios[$Requerimiento->getEncargado()->getEmail()] = $Requerimiento->getEncargado()->NombreAmigable();
     }
     if ($Requerimiento->getUsuario() && $Requerimiento->getUsuario()->getEmail() && filter_var($Requerimiento->getUsuario()->getEmail(), FILTER_VALIDATE_EMAIL)) {
         $Destinatarios[$Requerimiento->getUsuario()->getEmail()] = $Requerimiento->getUsuario()->NombreAmigable();
     } elseif (filter_var($Requerimiento->getUsuarioEmail(), FILTER_VALIDATE_EMAIL)) {
         if ($Requerimiento->getUsuarioNombre()) {
             $Destinatarios[$Requerimiento->getUsuarioNombre()] = $Requerimiento->getUsuarioEmail();
         } else {
             $Destinatarios['Usuario anónimo'] = $Requerimiento->getUsuarioEmail();
         }
     }
     if (count($Destinatarios) > 0) {
         $res = $this->ConstruirResultado(new \Tapir\AbmBundle\Helper\Resultados\ResultadoVerAction($this), $request);
         $res->Entidad = $Requerimiento;
         $res->Novedad = $Novedad;
         $ContenidoMensaje = $this->renderView($vistaEmail, array('res' => $res));
         $Mensaje = \Swift_Message::newInstance()->setSubject('Novedades de la solicitud Nº ' . $Requerimiento->getSeguimientoNumero())->setFrom(array('*****@*****.**' => 'Municipio de Río Grande'))->setTo($Destinatarios)->setBody(\Tapir\BaseBundle\Helper\StringHelper::ObtenerTextoCuerpoHtml($ContenidoMensaje))->addPart($ContenidoMensaje, 'text/html');
         $this->get('mailer')->send($Mensaje);
     }
 }
コード例 #5
0
 /**
  * @see \Tapir\BaseBundle\Controller\BaseController::IniciarVariables() BaseController::IniciarVariables()
  */
 function IniciarVariables()
 {
     parent::IniciarVariables();
     $this->CompleteEntityName = $this->container->getParameter('tapir_usuarios_entidad');
     $PartesNombreClase = \Tapir\BaseBundle\Helper\StringHelper::ObtenerBundleYEntidad(get_class($this));
     $this->BundleName = $PartesNombreClase[0];
     $this->EntityName = $PartesNombreClase[1];
     $this->EntityLabel = 'Usuario';
     $this->BaseRouteEntityName = 'Usuario';
     $this->BuscarPor = 'NombreVisible, Username';
     $this->FormTypeName = 'Usuario';
 }
コード例 #6
0
 public function ImportarRegistro($Row)
 {
     $resultado = new ResultadoLote();
     //$resultado->Registros[] = $Row;
     if ($Row['INDIVIDUO_TIPO'] != 'PE' && $Row['INDIVIDUO_TIPO'] != 'PJ' && $Row['INDIVIDUO_TIPO'] != 'EN' && $Row['INDIVIDUO_TIPO'] != 'OT') {
         $resultado->RegistrosIgnorados++;
         return $resultado;
     }
     if ($Row['NOMBRE_IND'] != 'NRO.DE CUENTA CEMENTERIO' || $Row['NOMBRE_IND'] != 'NN' || SUBSTR($Row['NOMBRE_IND'], 0, 3) != '???') {
         $resultado->RegistrosIgnorados++;
         return $resultado;
     }
     if ((int) $Row['TRIBUTARIA_ID'] > 0 || (int) $Row['TRIBUTARIA_ID'] <= 9999) {
         $resultado->RegistrosIgnorados++;
         return $resultado;
     }
     $Documento = StringHelper::ObtenerDocumento($Row['TRIBUTARIA_ID']);
     $Apellido = StringHelper::Desoraclizar($Row['APELLIDOS']);
     $Nombre = StringHelper::Desoraclizar($Row['NOMBRES']);
     $RazonSocial = StringHelper::Desoraclizar($Row['RAZON_SOCIAL']);
     if (!$Nombre && !$Apellido && !$RazonSocial) {
         $resultado->RegistrosIgnorados++;
         return $resultado;
     }
     // echo ($Nombre .'/'. $Apellido .'/'. $RazonSocial);
     // echo "\n";
     $Row['TG06100_ID'] = (int) $Row['TG06100_ID'];
     $entity = $this->em->getRepository('YacareBaseBundle:Persona')->findOneBy(array('Tg06100Id' => $Row['TG06100_ID']));
     $Cuilt = '';
     if ($Documento[0] == 'CUIL' || $Documento[0] == 'CUIT') {
         $Cuilt = str_replace('-', '', $Documento[1]);
     }
     if ($Documento[0] == 'CUIL') {
         // Intento obtener el DNI del CUIL
         $Partes = explode('-', $Documento[1]);
         if (count($Partes) == 3) {
             $Documento[0] = 'DNI';
             $Documento[1] = (int) $Partes[1];
         }
     }
     if ($entity == null && $Cuilt) {
         $entity = $this->em->getRepository('YacareBaseBundle:Persona')->findOneBy(array('Cuilt' => $Cuilt));
     }
     if ($entity == null) {
         $entity = $this->em->getRepository('YacareBaseBundle:Persona')->findOneBy(array('DocumentoNumero' => $Documento[1]));
     }
     if ($entity == null) {
         $entity = new \Yacare\BaseBundle\Entity\Persona();
         if ($Row['TIPO_SOCIEDAD']) {
             switch ($Row['TIPO_SOCIEDAD']) {
                 case 'SA':
                     $entity->setTipoSociedad(1);
                     break;
                 case 'SRL':
                     $entity->setTipoSociedad(8);
                     break;
                 case 'SC':
                     $entity->setTipoSociedad(2);
                     break;
                 case 'SCA':
                     $entity->setTipoSociedad(4);
                     break;
                 case 'SH':
                     $entity->setTipoSociedad(3);
                     break;
                 case 'SD':
                     if (strpos($RazonSocial, 'S.A.') !== false || strpos($RazonSocial, ' SA') !== false) {
                         $entity->setTipoSociedad(1);
                     } elseif (strpos($RazonSocial, 'S.R.L.') !== false || strpos($RazonSocial, ' SRL') !== false) {
                         $entity->setTipoSociedad(8);
                     } elseif (strpos($RazonSocial, 'S/H') !== false || strpos($RazonSocial, ' S.DE H.') !== false || strpos($RazonSocial, ' S. DE H.') !== false || strpos($RazonSocial, ' S.H') !== false) {
                         $entity->setTipoSociedad(3);
                     }
                     break;
             }
         } elseif ($Row['INDIVIDUO_TIPO'] != 'EN') {
             $entity->setTipoSociedad(11);
         }
         if ($Documento[0] == 'CUIL' && (substr($Documento[1], 0, 3) == '30-' || substr($Documento[1], 0, 3) == '33-' || substr($Documento[1], 0, 3) == '34-')) {
             $Documento[0] = 'CUIT';
         }
         if (!$entity->getCuilt() && $Cuilt) {
             $entity->setCuilt($Cuilt);
         }
         if (!$entity->getDocumentoNumero()) {
             $entity->setDocumentoNumero($Documento[1]);
         }
         if (!$entity->getDocumentoTipo()) {
             $entity->setDocumentoTipo(1);
         }
         if (!$entity->getNombre()) {
             $entity->setNombre($Nombre);
         }
         if (!$entity->getApellido()) {
             $entity->setApellido($Apellido);
         }
         if (!$entity->getRazonSocial()) {
             $entity->setRazonSocial($RazonSocial);
         }
         if (!$entity->getDomicilioCodigoPostal()) {
             $entity->setDomicilioCodigoPostal('9420');
         }
         $CodigoCalle = $this->ArreglarCodigoCalle($Row['CODIGO_CALLE']);
         if ($CodigoCalle && !$entity->getDomicilioCalle()) {
             $Calle = $this->em->find('YacareCatastroBundle:Calle', $CodigoCalle);
             if ($Calle) {
                 $entity->setDomicilioCalle($Calle);
             }
         }
         if (!$entity->getDomicilioCalleNombre()) {
             $entity->setDomicilioCalleNombre(StringHelper::Desoraclizar($Row['CALLE']));
         }
         if (!$entity->getDomicilioNumero()) {
             $entity->setDomicilioNumero($Row['NUMERO']);
         }
         if (!$entity->getDomicilioPiso()) {
             $entity->setDomicilioPiso($Row['PISO']);
         }
         if (!$entity->getDomicilioPuerta()) {
             $entity->setDomicilioPuerta($Row['DEPTO']);
         }
         // Si no está en el grupo Contribuyentes, lo agrego
         // if ($entity->getGrupos()->contains($this->GrupoContribuyentes) == false) {
         // $entity->getGrupos()->add($this->GrupoContribuyentes);
         // }
         if ($Row['SEXO'] == 'F') {
             $entity->setGenero(2);
         } elseif ($Row['SEXO'] == 'M') {
             $entity->setGenero(1);
         }
         $entity->setTg06100Id($Row['TG06100_ID']);
         $resultado->RegistrosNuevos++;
     } else {
         $resultado->RegistrosActualizados++;
     }
     $entity->getNombreVisible();
     $this->em->persist($entity);
     $this->em->flush();
     return $resultado;
 }
コード例 #7
0
 /**
  * @Route("recibo/ver/")
  * @Template()
  */
 public function verAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $connHaberes = $this->get('doctrine')->getConnection('haberes');
     $id = $this->ObtenerVariable($request, 'id');
     $connHaberes->exec("ALTER SESSION SET NLS_TIME_FORMAT='HH24:MI:SS' NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'\n            NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SS' NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS TZH:TZM'");
     $ames = $this->ObtenerVariable($request, 'ames');
     $peri = $this->ObtenerVariable($request, 'peri');
     if ($id) {
         $Persona = $em->getRepository('Yacare\\BaseBundle\\Entity\\Persona')->find($id);
     } else {
         $Persona = $this->get('security.token_storage')->getToken()->getUser();
     }
     $Agente = $em->getRepository('Yacare\\RecursosHumanosBundle\\Entity\\Agente')->find($Persona->getAgenteId());
     $ConsultaResumen = $connHaberes->prepare("SELECT * FROM RESUMEN WHERE CODIGO LIKE '% " . $Agente->getId() . "/%' AND AMES='{$ames}' AND PERI='{$peri}'");
     $ConsultaResumen->execute();
     $Resumen = $ConsultaResumen->fetchAll()[0];
     $ConsultaRecibo = $connHaberes->prepare("SELECT TIPO, MONTO, COHADE, DESCITM, VO FROM RLIQUID\n                    WHERE CODIGO LIKE '% " . $Agente->getId() . "/%' AND AMES='{$ames}' AND PERI='{$peri}'\n                        AND TIPO>0 AND INFORM='N' ORDER BY TIPO, ORDEN");
     $ConsultaRecibo->execute();
     // Busco datos de la persona en REMPLESH
     // Si no está ahí, lo busco en REMPLES
     $ConsultaPersona = $connHaberes->prepare("SELECT * FROM REMPLESH WHERE CODIGO LIKE '% " . $Agente->getId() . "/%' AND AMES='{$ames}'");
     $ConsultaPersona->execute();
     $PersonaHaberes = $ConsultaPersona->fetchAll();
     if (count($PersonaHaberes) == 1) {
         $PersonaHaberes = $PersonaHaberes[0];
     } else {
         $ConsultaPersona = $connHaberes->prepare("SELECT * FROM REMPLES WHERE CODIGO LIKE '% " . $Agente->getId() . "/%'");
         $ConsultaPersona->execute();
         $PersonaHaberes = $ConsultaPersona->fetchAll()[0];
     }
     if (substr($PersonaHaberes['FECHA_RET'], 0, 5) == '3000-') {
         // Fechas de baja en el año 3000 significa sin baja
         $PersonaHaberes['FECHA_RET'] = null;
     }
     $PlantaId = $PersonaHaberes['CLASIF'];
     if ($PlantaId) {
         $Consulta = $connHaberes->prepare("SELECT DESCRIP FROM RTABLAS WHERE COTAB=11 AND CODIGO=" . $PlantaId);
         $Consulta->execute();
         $PlantaNombre = \Tapir\BaseBundle\Helper\StringHelper::Desoraclizar($Consulta->fetchAll()[0]['DESCRIP']);
     } else {
         $PlantaNombre = '';
     }
     $SecretariaId = $PersonaHaberes['UNIDAD'];
     if ($SecretariaId) {
         $Consulta = $connHaberes->prepare("SELECT DESCRIP FROM RTABLAS WHERE COTAB=40 AND CODIGO=" . $SecretariaId);
         $Consulta->execute();
         $SecretariaNombre = \Tapir\BaseBundle\Helper\StringHelper::Desoraclizar($Consulta->fetchAll()[0]['DESCRIP']);
     } else {
         $SecretariaNombre = '';
     }
     $res = array('persona' => $Persona, 'agente' => $Agente, 'agente_planta' => $PlantaNombre, 'agente_secretaria' => $SecretariaNombre, 'ames' => $ames, 'peri' => $peri, 'resumen' => $Resumen, 'personahab' => $PersonaHaberes, 'detalles' => $ConsultaRecibo->fetchAll());
     return $this->ArrastrarVariables($request, $res);
 }
コード例 #8
0
ファイル: StringHelper.php プロジェクト: Drake86cnf/yacare
 /**
  * Obtiene el nombre de la calle y la altura por separado.
  * Devuelve un array con dos o tres elementos (calle, altura [y departamento]).
  * TODO: mejorar para que si no existe 'Nº', reconozca el final del nombre de la calle cuando encuentre un dígito.
  * 
  * @param  string $domicilio
  * @return array  $PartesNombre contiene la calle y número, de un domicilio, por separado.
  */
 public static function ObtenerCalleYNumero($domicilio)
 {
     $domicilio = StringHelper::Desoraclizar($domicilio);
     $PartesNombre = explode('Nº', $domicilio, 2);
     /*
      * if(count($PartesNombre) == 1) {
      * $PartesNombre = explode(' ', $PartesNombre[0], 2);
      * }
      */
     if (count($PartesNombre) == 1) {
         $PartesNombre[] = '';
     }
     $PartesNombre[0] = trim($PartesNombre[0]);
     $PartesNombre[1] = trim($PartesNombre[1]);
     $PartesNumero = explode(' ', $PartesNombre[1], 2);
     if (count($PartesNumero) == 2) {
         $PartesNombre[1] = trim($PartesNumero[0]);
         $PartesNombre[2] = trim($PartesNumero[1]);
     }
     return $PartesNombre;
 }
コード例 #9
0
 public function ImportarRegistro($Row)
 {
     $resultado = new ResultadoLote();
     //$resultado->Registros[] = $Row;
     $entity = $this->em->getRepository('YacareRecursosHumanosBundle:Agente')->findOneBy(array('ImportSrc' => 'rr_hh.agentes', 'ImportId' => $Row['legajo']));
     if (!$entity) {
         $entity = $this->em->getRepository('YacareRecursosHumanosBundle:Agente')->findOneBy(array('id' => $Row['legajo']));
     }
     if (!$entity) {
         $entity = new \Yacare\RecursosHumanosBundle\Entity\Agente();
         // Asigno manualmente el ID
         $entity->setId((int) $Row['legajo']);
         $metadata = $this->em->getClassMetaData(get_class($entity));
         $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE);
         $Persona = $this->em->getRepository('YacareBaseBundle:Persona')->findOneBy(array('DocumentoNumero' => trim($Row['nrodoc'])));
         if (!$Persona) {
             $Persona = new \Yacare\BaseBundle\Entity\Persona();
             $Persona->setDocumentoNumero($Row['nrodoc']);
             $Persona->setDocumentoTipo((int) $Row['tipodoc']);
         }
         $Persona->setNombre(StringHelper::Desoraclizar($Row['name']));
         $Persona->setApellido(StringHelper::Desoraclizar($Row['lastname']));
         if ($Row['fechanacim']) {
             $Persona->setFechaNacimiento(new \DateTime($Row['fechanacim']));
         }
         $Persona->setTelefonoNumero(trim(str_ireplace('NO DECLARA', '', $Row['telefono']) . ' ' . str_ireplace('NO DECLARA', '', $Row['celular'])));
         $Persona->setGenero($Row['sexo'] == 1 ? 1 : 0);
         $Persona->setEmail(str_ireplace('NO DECLARA', '', strtolower($Row['email'])));
         $Persona->setCuilt(trim($Row['cuil']));
         $this->em->persist($Persona);
         //$this->em->flush();
         $entity->setPersona($Persona);
         $entity->setImportSrc('rr_hh.agentes');
         $entity->setImportId($Row['legajo']);
         $resultado->RegistrosNuevos++;
     } else {
         $resultado->RegistrosActualizados++;
         $Persona = $entity->getPersona();
     }
     $Departamento = $this->em->getRepository('YacareOrganizacionBundle:Departamento')->findOneBy(array('ImportSrc' => 'rr_hh.sectores', 'ImportId' => $Row['secretaria'] . '.' . $Row['direccion'] . '.' . $Row['sector']));
     if (!$Departamento) {
         $Departamento = $this->em->getRepository('YacareOrganizacionBundle:Departamento')->findOneBy(array('ImportSrc' => 'rr_hh.direcciones', 'ImportId' => $Row['secretaria'] . '.' . $Row['direccion']));
     }
     if (!$Departamento) {
         $Departamento = $this->em->getRepository('YacareOrganizacionBundle:Departamento')->findOneBy(array('ImportSrc' => 'rr_hh.secretarias', 'ImportId' => $Row['secretaria']));
     }
     $entity->setDepartamento($Departamento);
     $entity->setCategoria($Row['categoria']);
     $entity->setSituacion($Row['situacion']);
     $entity->setFuncion(StringHelper::Desoraclizar($Row['funcion']));
     $entity->setBajaMotivo($Row['motivo']);
     if ($Row['excombatie'] == 'S') {
         $entity->setExCombatiente(1);
     }
     if ($Row['discapacit'] == 'S') {
         $entity->setDiscapacitado(1);
     }
     if ($Row['manohabil'] == 'I') {
         $entity->setManoHabil(1);
     }
     $entity->setEstudiosNivel($Row['estudios']);
     if ($Row['titulo'] == 999) {
         $entity->setEstudiosTitulo(null);
     } else {
         $entity->setEstudiosTitulo($Row['titulo']);
     }
     if (\Tapir\BaseBundle\Helper\Cbu::EsCbuValida($Row['cbu'])) {
         $entity->setCBUCuentaAgente(\Tapir\BaseBundle\Helper\Cbu::FormatearCbu($Row['cbu']));
     }
     if ($Row['fechaingre']) {
         $entity->setFechaIngreso(new \DateTime($Row['fechaingre']));
     } else {
         $entity->setFechaIngreso(null);
     }
     if (is_null($Row['fechabaja']) || $Row['fechabaja'] === '0000-00-00') {
         $entity->setBajaFecha(null);
         $entity->setArchivado(false);
     } else {
         $entity->setBajaFecha(new \DateTime($Row['fechabaja']));
         $entity->setArchivado(true);
     }
     if (is_null($Row['fechanacion'] || $Row['fechanacion'] === '0000-00-00')) {
         $entity->setFechaNacionalizacion(null);
     } else {
         $entity->setFechaNacionalizacion(new \DateTime($Row['fechanacion']));
     }
     if (is_null($Row['ult_act_d'] || $Row['ult_act_d'] === '0000-00-00')) {
         $entity->setUltimaActualizacionDomicilio(null);
     } else {
         $entity->setUltimaActualizacionDomicilio(new \DateTime($Row['ult_act_d']));
     }
     if (is_null($Row['fecha_psico'] || $Row['fecha_psico'] === '0000-00-00')) {
         $entity->setFechaPsicofisico(null);
     } else {
         $entity->setFechaPsicofisico(new \DateTime($Row['ult_act_d']));
     }
     if (is_null($Row['fecha_CBC'] || $Row['fecha_CBC'] === '0000-00-00')) {
         $entity->setFechaCertificadoBuenaConducta(null);
     } else {
         $entity->setFechaCertificadoBuenaConducta(new \DateTime($Row['fecha_CBC']));
     }
     if (is_null($Row['fecha_CAP'] || $Row['fecha_CAP'] === '0000-00-00')) {
         $entity->setFechaCertificadoAntecedentesPenales(null);
     } else {
         $entity->setFechaCertificadoAntecedentesPenales(new \DateTime($Row['fecha_CAP']));
     }
     if (is_null($Row['fecha_CD'] || $Row['fecha_CD'] === '0000-00-00')) {
         $entity->setFechaCertificadoDomicilio(null);
     } else {
         $entity->setFechaCertificadoDomicilio(new \DateTime($Row['fecha_CD']));
     }
     if (\Tapir\BaseBundle\Helper\Cbu::EsCbuValida($Row['cbu'])) {
         $entity->setCBUCuentaAgente($Row['cbu']);
     }
     if (is_null($Row['finalcontr'] || $Row['finalcontr'] === '0000-00-00')) {
         $entity->setBajaFechaContrato(null);
     } else {
         $entity->setBajaFechaContrato(new \DateTime($Row['finalcontr']));
     }
     if ($Row['decreto2']) {
         $entity->setBajaDecreto(\Yacare\MunirgBundle\Helper\StringHelper::FormatearActoAdministrativo($Row['decreto2']));
     } else {
         $entity->setBajaDecreto(null);
     }
     $entity->setSuprimido(false);
     $this->em->persist($entity);
     $this->em->flush();
     return $resultado;
 }
コード例 #10
0
ファイル: BaseController.php プロジェクト: Drake86cnf/yacare
 /**
  * Obtiene el nombre visible de la clase de entidad (etiqueta).
  *
  * El nombre visible o etiqueta es el nombre que se muestra al usuario en
  * pantalla para una clase de entidad, y que puede ser diferente del nombre
  * de la clase en el código fuente.
  * Por ejemplo, para la entidad "Tramite", el nombre visible es "Trámite"
  * (con tilde). Además, puede haber controladores que usan una entidad con
  * un nombre visible diferente, por ejemplo la entidad "Persona" se puede
  * usar con el nombre visible "Usuario".
  *
  * @return string El nombre visible de la clase de entidad.
  * 
  * @see obtenerEtiquetaEntidadPlural() obtenerEtiquetaEntidadPlural()
  */
 public function obtenerEtiquetaEntidad()
 {
     if (isset($this->EntityLabel)) {
         return $this->EntityLabel;
     } else {
         return \Tapir\BaseBundle\Helper\StringHelper::ProperCase($this->EntityName);
     }
 }
コード例 #11
0
ファイル: FormatExtension.php プロジェクト: Drake86cnf/yacare
 public function tapir_mejorartexto($valor)
 {
     return Tapir\BaseBundle\Helper\StringHelper::Desoraclizar($valor);
 }
コード例 #12
0
ファイル: ConNombre.php プロジェクト: Drake86cnf/yacare
 /**
  * @ignore
  */
 public function setNombre($Nombre)
 {
     $this->Nombre = \Tapir\BaseBundle\Helper\StringHelper::Desoraclizar($Nombre);
 }
コード例 #13
0
 public function testArreglarProblemasConocidos()
 {
     $this->assertEquals('yugoslavia', StringHelper::ArreglarProblemasConocidos('yugoeslavia'));
 }
コード例 #14
0
ファイル: TramiteHelper.php プロジェクト: Drake86cnf/yacare
 /**
  * Termina un trámite, emitiendo un comprobante si es necesario.
  * 
  * @param Tramite $tramite
  */
 public function TerminarTramite($tramite)
 {
     $res = array();
     if ($tramite->getEstado() != 100) {
         $tramite->setEstado(100);
         $tramite->setFechaTerminado(new \DateTime());
         $Comprob = $this->EmitirComprobante($tramite);
         $res['comprobante'] = $Comprob;
         if ($Comprob) {
             $Comprob->setNumero($this->ObtenerProximoNumeroComprobante($Comprob));
             $this->em->persist($Comprob);
             $tramite->setComprobante($Comprob);
             if ($tramite->getTramitePadre()) {
                 // Este trámite es parte de un trámite de nivel superior.
                 // Doy por aprobado el requisito correspondiente en el trámite padre
                 $EstadoReqEnTramitePadre = $tramite->getTramitePadre()->ObtenerEstadoRequisitoPorSubTramite($tramite);
                 if ($EstadoReqEnTramitePadre) {
                     $EstadoReqEnTramitePadre->setEstado(100);
                     $this->em->persist($EstadoReqEnTramitePadre);
                 }
             }
         }
         // Poner requisito aprobado en trámite padre
         $this->em->persist($tramite);
         $this->em->flush();
         $res['mensaje'] = null;
     } else {
         $res['mensaje'] = 'El trámite ya estaba terminado.';
         $Comprob = $tramite->getComprobante();
         $res['comprobante'] = $Comprob;
     }
     if ($Comprob) {
         $res['rutacomprobante'] = \Tapir\BaseBundle\Helper\StringHelper::ObtenerRutaBase($Comprob->getComprobanteTipo()->getClase());
     } else {
         $res['rutacomprobante'] = null;
     }
     return $res;
 }
コード例 #15
0
 /**
  * @Route("badabum/")
  * @Template("YacareMunirgBundle:Importar:importar.html.twig")
  */
 public function importarBadabumAction(Request $request)
 {
     $desde = (int) $request->query->get('desde');
     $cant = 500;
     mb_internal_encoding('UTF-8');
     ini_set('display_errors', 1);
     set_time_limit(600);
     ini_set('memory_limit', '2048M');
     $em = $this->getDoctrine()->getManager();
     $ArchivoCsv = fopen('badaum.csv', 'r');
     $importar_importados = 0;
     $importar_actualizados = 0;
     $importar_procesados = 0;
     $log = array();
     for ($i = 0; $i < $desde; $i++) {
         fgetcsv($ArchivoCsv);
     }
     while (!feof($ArchivoCsv)) {
         $Row = fgetcsv($ArchivoCsv);
         if ($Row && count($Row) > 1 && $Row[0]) {
             $Persona = $em->getRepository('YacareBaseBundle:Persona')->findOneBy(array('DocumentoNumero' => trim($Row[0])));
             if (!$Persona) {
                 $Persona = new \Yacare\BaseBundle\Entity\Persona();
                 $Persona->setDocumentoNumero($Row[0]);
                 $Persona->setDocumentoTipo(1);
                 $ApellidoYNombres = StringHelper::ObtenerApellidoYNombres($Row[1]);
                 $Persona->setApellido(StringHelper::Desoraclizar($ApellidoYNombres[0]));
                 $Persona->setNombre(StringHelper::Desoraclizar($ApellidoYNombres[1]));
                 $log[] = 'Creando persona: DNI ' . $Row[0] . ', ' . $Row[1];
                 $importar_importados++;
             } else {
                 $importar_actualizados++;
             }
             $PartesDomicilio = StringHelper::ObtenerCalleYNumero($Row[2]);
             /*
              * $Calle = $em->getRepository ( 'YacareCatastroBundle:Calle' )->findOneBy ( array (
              * 'Nombre' => $this->ArreglarNombreCalle ( $PartesDomicilio [0] )
              * ) );
              */
             $Calles = $em->getRepository('YacareCatastroBundle:Calle')->createQueryBuilder('c')->where('c.Nombre LIKE :nombre')->setParameter('nombre', $this->ArreglarNombreCalle($PartesDomicilio[0]))->getQuery()->getResult();
             if (count($Calles) == 1) {
                 $Calle = $Calles[0];
                 $PartesDomicilio[0] = $Calle->getNombre();
             } else {
                 $Calle = null;
             }
             if ($Row[3]) {
                 $PartesDomicilio[1] = $Row[3];
             }
             if ($Row[4]) {
                 $PartesDomicilio[2] = $Row[4];
             }
             if (!$Calle) {
                 $log[] = 'No existe la calle ' . $PartesDomicilio[0];
             }
             $Persona->setDomicilioCalle($Calle);
             $Persona->setDomicilioCalleNombre($PartesDomicilio[0]);
             $Persona->setDomicilioNumero($PartesDomicilio[1]);
             if (count($PartesDomicilio) > 2) {
                 $Persona->setDomicilioPuerta($PartesDomicilio[2]);
             }
             if (!$Persona->getTelefonoNumero()) {
                 $Persona->setTelefonoNumero(trim($Row[6]));
             } else {
                 $Persona->setTelefonoNumero($Persona->getTelefonoNumero() . ', ' . trim($Row[6]));
             }
             if (!$Persona->getFechaNacimiento() && $Row[7]) {
                 $fecha = \DateTime::createFromFormat('d/m/Y', $Row[7]);
                 if ($fecha) {
                     $Persona->setFechaNacimiento($fecha);
                 }
             }
             // Si no está en el grupo, lo agrego
             if ($Row[8]) {
                 $Grupo = $em->getRepository('YacareBaseBundle:PersonaGrupo')->find($Row[8]);
                 if ($Persona->getGrupos()->contains($Grupo) == false) {
                     $Persona->getGrupos()->add($Grupo);
                 }
             }
             $em->persist($Persona);
             $em->flush();
             $importar_procesados++;
             $log[] = $Row[0] . ': ' . (string) $Persona;
         }
         if ($importar_procesados >= $cant) {
             break;
         }
     }
     fclose($ArchivoCsv);
     return array('importar_importados' => $importar_importados, 'importar_actualizados' => $importar_actualizados, 'importar_procesados' => $importar_procesados, 'redir_desde' => $importar_procesados == $cant ? $desde + $cant : 0, 'log' => $log);
 }
コード例 #16
0
ファイル: TramiteHelper.php プロジェクト: Rezequiel/yacare
 /**
  * Termina un trámite, emitiendo un comprobante si es necesario.
  * 
  * @param Tramite $tramite
  */
 public function TerminarTramite($tramite)
 {
     $res = array();
     if ($tramite->getEstado() != 100) {
         $tramite->setEstado(100);
         $tramite->setFechaTerminado(new \DateTime());
         $Comprob = $this->EmitirComprobante($tramite);
         $res['comprobante'] = $Comprob;
         if ($Comprob) {
             $Comprob->setNumero($this->ObtenerProximoNumeroComprobante($Comprob));
             $this->em->persist($Comprob);
             $tramite->setComprobante($Comprob);
         }
         $this->em->persist($tramite);
         $this->em->flush();
         $res['mensaje'] = null;
     } else {
         $res['mensaje'] = 'El trámite ya estaba terminado.';
         $Comprob = $tramite->getComprobante();
         $res['comprobante'] = $Comprob;
     }
     if ($Comprob) {
         $res['rutacomprobante'] = \Tapir\BaseBundle\Helper\StringHelper::ObtenerRutaBase($Comprob->getComprobanteTipo()->getClase());
     } else {
         $res['rutacomprobante'] = null;
     }
     return $res;
 }