function getBuscarEnListaNegra($nombre = "", $primerapellido = "", $segundoapellido = "")
 {
     $this->init();
     $nombre = $nombre == "" ? $this->getOPersona()->getNombre() : $nombre;
     $primerapellido = $primerapellido == "" ? $this->getOPersona()->getApellidoPaterno() : $primerapellido;
     $segundoapellido = $segundoapellido == "" ? $this->getOPersona()->getApellidoMaterno() : $segundoapellido;
     $xUser = new cSystemUser();
     $ctx = $xUser->getCTX();
     $extras = AML_BUSQUEDA_PERSONAS_REFORZADA == true ? "&jarowinkler=true&metaphone=true" : "";
     //$nombre				= urlencode($nombre);
     $result = false;
     $items = 0;
     //count($data);
     $mURL = SVC_REMOTE_HOST . "svc/listanegra.svc.php?n=" . urlencode($nombre) . "&p=" . urlencode($primerapellido) . "&m=" . urlencode($segundoapellido) . "&ctx={$ctx}" . $extras;
     if (MODO_DEBUG == true) {
         setLog($mURL);
     }
     $ql = new MQLService("", "");
     $json = $ql->getRequest($mURL);
     //file_get_contents($mURL);
     $data = json_decode($json, true);
     if (!$data) {
         $this->mMessages .= "ERROR\tNo existen ITEMS\r\n";
     } else {
         foreach ($data as $subobj) {
             $items++;
             //{"codigo":"16145","primerapellido":"CALLE","segundoapellido":"QUIROS","nombres":" LUIS SANTIAGO","curp":"SDNTK-16145","tipo":"metaphone"}
             //var_dump($subobj);
             //setLog( $subobj->primerapellido );
             //foreach ($subobj as $cls){
             //}
             $this->mMessages .= "WARN\t" . $subobj["curp"] . " : Coincidencia " . $subobj["primerapellido"] . " " . $subobj["segundoapellido"] . " " . $subobj["nombres"] . " encontrado con  " . $subobj["tipo"] . "\r\n";
         }
     }
     //setLog("NUMERO DE ITEMS $items");
     $this->mMessages .= "WARN\tReporte : {$mURL}&report=true&ret=true \r\n";
     $this->mURLConsulta = "{$mURL}&report=true&ret=true";
     //var_dump($data);
     if ($items >= 1) {
         $result = true;
         $this->mMessages .= "ERROR\tPersona en Lista Negra o con Alto riesgo con {$items} posibles concindencias\r\n";
     }
     return $result;
 }
 function setProcesarProgramacion($id, $arrVars = false, $data = false, $fecha = false)
 {
     $xF = new cFecha();
     $xT = new cTipos();
     $xLog = new cCoreLog();
     $arrVars = $arrVars == false ? $this->mArrVars : $arrVars;
     //idprograma, nombre_del_aviso, forma_de_creacion, programacion, destinatarios, microformato, tipo_de_medios, intent_check, intent_command
     $sql = "SELECT *\tFROM sistema_programacion_de_avisos WHERE idprograma={$id} LIMIT 0,1";
     $d = $data == false ? obten_filas($sql) : $data;
     $mOb = new cSistema_programacion_de_avisos();
     $mOb->setData($d);
     $emails = array();
     $tels = array();
     $enviar = false;
     $fecha = $fecha == false ? fechasys() : $fecha;
     $nombredia = $xF->getDayName();
     $diadelmes = date("j", $xF->getInt());
     $EnviarNota = true;
     $EnviarMail = true;
     $EnviarSMS = false;
     $xLoc = new cLocal();
     //procesar cuerpo del contenido
     $arrVars["fecha"] = !isset($arrVars["fecha"]) ? $fecha : $arrVars["fecha"];
     $arrVars["fecha_dia_siguiente"] = $xF->setSumarDias(1, $fecha);
     $arrVars["fecha_inicio_de_semana"] = $xF->getFechaDeInicioDeSemana($fecha);
     $arrVars["fecha_inicio_de_mes"] = $xF->getDiaInicial($fecha);
     //Dia de la semana inicial
     $arrVars["hora"] = date("H");
     $arrVars["usuario"] = $xLoc->getNombreUsuario();
     $arrVars["clave_de_usuario"] = !isset($arrVars["clave_de_usuario"]) ? getUsuarioActual() : $arrVars["clave_de_usuario"];
     //interpretar DIA
     if (strtoupper($mOb->forma_de_creacion()->v()) == SYS_ALERTA_POR_EVENTO) {
         $enviar = true;
     } else {
         //if($mOb->programacion())
         $programacion = strtoupper($mOb->programacion()->v());
         $periodo = explode(":", $programacion);
         //INTERPRETAR DIA
         if ($periodo[0] == "PROGRAMACION_SEMANAL") {
             if (strpos($nombredia, $programacion) !== false) {
                 $enviar = true;
             }
         } else {
             if ($periodo[0] == "PROGRAMACION_DIARIA") {
                 $enviar = true;
             } else {
                 if (isset($periodo[1])) {
                     $dias = explode(",", $periodo[1]);
                     foreach ($dias as $dias => $iddia) {
                         $mes = $xF->mes();
                         $anno = $xF->anno();
                         if (date("Y-m-d", strtotime("{$anno}-{$mes}-{$iddia}")) == $fecha) {
                             $enviar = true;
                         }
                     }
                 }
             }
         }
     }
     //1.- extraer emails
     $destinatarios = explode("|", $mOb->destinatarios()->v());
     foreach ($destinatarios as $key => $cnt) {
         if (trim($cnt) != "") {
             //1.1 Desfragmentar destinos
             $DS = explode(":", $cnt);
             $mdestino = isset($DS[0]) ? strtoupper($DS[0]) : "";
             switch ($mdestino) {
                 case "OFICIALES":
                     if (isset($DS[1])) {
                         $oficiales = explode(",", $DS[1]);
                         foreach ($oficiales as $ofc => $ofkey) {
                             $xOf = new cOficial($ofkey);
                             $xOf->init();
                             $mail = $xOf->getEmail();
                             $emails[] = $mail;
                             $xLog->add("OK\tOFICIAL\tAgregar mail {$mail}  \r\n", $xLog->DEVELOPER);
                         }
                     }
                     break;
                 case "EMPRESAS":
                     if (isset($DS[1])) {
                         $empresas = explode(",", $DS[1]);
                         foreach ($empresas as $emp => $empkey) {
                             $xEmp = new cEmpresas($empkey);
                             $xEmp->init();
                             //$mail		= $xEmp->getEmailsDeEnvio();
                             //$emails[]	= $mail;
                             $emails = array_merge($emails, $xEmp->getEmailsDeEnvio());
                             $xLog->add("OK\tEMPRESAS\tAgregar mail de la empresa {$empkey}  \r\n", $xLog->DEVELOPER);
                         }
                     }
                     break;
                 case "PERSONAS":
                     if (isset($DS[1])) {
                         $personas = explode(",", $DS[1]);
                         foreach ($personas as $ofc => $ofkey) {
                             $xSoc = new cSocio($ofkey);
                             $xSoc->init();
                             $mail = $xSoc->getCorreoElectronico();
                             $emails[] = $mail;
                             $xLog->add("OK\tPERSONA\tAgregar mail {$mail}  \r\n", $xLog->DEVELOPER);
                             if ($xT->cNumeroTelefonico($xSoc->getTelefonoPrincipal()) != false) {
                                 $EnviarSMS = true;
                                 $tels[] = $xT->cNumeroTelefonico($xSoc->getTelefonoPrincipal());
                             }
                         }
                     }
                     break;
                 case "CORREO":
                     if (isset($DS[1])) {
                         $personas = explode(",", $DS[1]);
                         foreach ($personas as $ofc => $ofkey) {
                             if (filter_var($ofkey, FILTER_VALIDATE_EMAIL)) {
                                 $emails[] = $ofkey;
                             }
                             $xLog->add("OK\tCORREO\tAgregar mail {$ofkey}  \r\n", $xLog->DEVELOPER);
                         }
                     }
                     break;
             }
             //1.1.1 Validar oficiales, empresas, personas
             //if(strpos("OFICIALES:", $needle))
         }
     }
     $this->mMessages .= $xLog->getMessages();
     $texto = $mOb->microformato()->v();
     foreach ($arrVars as $variable => $valor) {
         $texto = str_replace("{" . $variable . "}", $valor, $texto);
     }
     if ($enviar == true) {
         $url = $mOb->intent_command()->v(OUT_TXT);
         //2 procesado del comando
         if (trim($url) == "") {
             $titulo = strtoupper($mOb->nombre_del_aviso()->v());
             $xNot = new cNotificaciones();
             //enviar mail normal
             if ($EnviarSMS == true) {
                 foreach ($tels as $pitm => $ptel) {
                     $xNot->sendSMS($ptel, $texto);
                 }
             }
             if ($EnviarMail == true) {
                 foreach ($emails as $itm => $pmail) {
                     $xNot->sendMail($titulo, $texto, $pmail);
                 }
             }
         } else {
             //execute command
             //rpttesoreria/corte_de_caja.rpt.php?on=2014-5-3&off=2014-5-3&cajero=todas&dependencia=todas
             $smail = "";
             $xHO = new cHObject();
             foreach ($arrVars as $variable => $valor) {
                 $url = str_replace("{" . $variable . "}", $valor, $url);
             }
             foreach ($emails as $id => $rmail) {
                 //$smail	.= ($smail == "") ? "email$id=$rmail" : "&email$id=$rmail";
                 $smail .= "&email{$id}={$rmail}";
             }
             //Iniciar session en contexto &on=$fecha&off=$fecha
             $xSysUser = new cSystemUser();
             $xSysUser->init();
             $url = $url . $smail . "&ctx=" . $xSysUser->getCTX();
             if (MODO_DEBUG == true) {
                 setLog($url);
             }
             $xHO->navigate($url);
         }
     } else {
         $this->mMessages .= "OK\tNo e envia el reporte\r\n";
     }
     setLog($this->mMessages);
     $this->mObProgAv = $mOb;
     //return $this->mObProgAv;
 }
 function getImportarDesdeAsociada($tipo)
 {
     $result = true;
     $svc = new MQLService("", "");
     $cmd = $svc->getEncryptData($tipo);
     $xTu = new cSystemUser(TASK_USR, false);
     $xTu->init();
     $ctx = $xTu->getCTX();
     $data = $svc->getEncryptData($this->mCodigo);
     $host = SVC_ASOCIADA_HOST;
     switch ($tipo) {
         case TPERSONAS_GENERALES:
             $dpersona = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($dpersona)) {
                 $xSoc = new cSocios_general($dpersona);
                 if (setNoMenorQueCero($xSoc->codigo()->v()) > 0) {
                     $xSoc->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
         case TPERSONAS_DIRECCIONES:
             $ddomicilio = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($ddomicilio)) {
                 $xDom = new cSocios_vivienda($ddomicilio);
                 if (setNoMenorQueCero($xDom->idsocios_vivienda()->v())) {
                     $xDom->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
         case TPERSONAS_ACTIVIDAD_ECONOMICA:
             $dtrabajo = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($dtrabajo)) {
                 $xTrab = new cSocios_aeconomica($dtrabajo);
                 if (setNoMenorQueCero($xTrab->idsocios_aeconomica()->v())) {
                     $xTrab->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
         case TCATALOGOS_EMPRESAS:
             $dempresa = $svc->getService($host . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
             if (is_array($dempresa)) {
                 $xEmp = new cSocios_aeconomica_dependencias($dempresa);
                 if (setNoMenorQueCero($xEmp->idsocios_aeconomica_dependencias()->v())) {
                     $xEmp->query()->insert()->save();
                     $result = true;
                 }
             }
             break;
     }
     return $result;
 }
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
//=====================================================================================================
$xInit = new cHPage("", HP_SERVICE);
$txt = "";
$svc = new MQLService("", "");
$ql = new MQL();
$data = isset($_REQUEST["data"]) ? $_REQUEST["data"] : null;
$command = isset($_REQUEST["cmd"]) ? $svc->getDecryptData($_REQUEST["cmd"]) : null;
//$context	= (isset($_REQUEST["ctx"])) ? $svc->getDecryptData($_REQUEST["ctx"]) : null;
$xTu = new cSystemUser(TASK_USR, false);
$xTu->init();
$ctx = $xTu->getCTX();
$cmd = $svc->getEncryptData($command);
switch ($command) {
    case TPERSONAS_GENERALES:
        $dpersona = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        if (is_array($dpersona)) {
            $xSoc = new cSocios_general($dpersona);
            $xSoc->query()->insert()->save();
            //Iniciar Cuenta de Captacion
        }
        break;
    case TPERSONAS_DIRECCIONES:
        $ddomicilio = $svc->getService(SVC_ASOCIADA_HOST . "svc/exportar.svc.php?ctx={$ctx}&data={$data}&cmd={$cmd}");
        if (is_array($ddomicilio)) {
            $xDom = new cSocios_vivienda($ddomicilio);
            $xDom->query()->insert()->save();