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;
 }
    $xObj = new cSAFETabla($tabla);
    if ($xObj->obj() == null) {
        $rs[MSG_NO_PARAM_VALID] = "ERROR\t para la Tabla {$tabla} y clave {$clave}\r\n";
    } else {
        $obj = $xObj->obj();
        if ($action == SYS_NINGUNO) {
            if ($clave != false) {
                $obj->setData($obj->query()->initByID($clave));
            }
            $rs = $obj->query()->getCampos();
            $cadena = json_encode($rs);
        } else {
            //$obj	= new cSocios_aeconomica();
            $indice = $obj->getKey();
            $etiq = $xObj->getCampoDescripcion();
            if ($etiq == "") {
                $campos = $obj->query()->getCampos();
                $cnt = 0;
                foreach ($campos as $props) {
                    $etiq = $cnt == 1 ? $props["N"] : $etiq;
                    $cnt++;
                }
            }
            $sql = "SELECT `{$tabla}`.`{$indice}` AS `indice`, `{$tabla}`.`{$etiq}` AS `etiqueta` FROM {$tabla} WHERE (`{$tabla}`.`{$indice}` LIKE '%{$clave}%' OR  `{$tabla}`.`{$etiq}` LIKE '%{$clave}%' ) LIMIT 0,100";
            //setLog($sql);
            $xSVC = new MQLService($action, $sql);
            $cadena = $xSVC->getJSON($out);
        }
    }
}
echo $cadena;
//=====>	INICIO_H
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
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"]) ? $svc->getDecryptData($_REQUEST["data"]) : null;
$command = isset($_REQUEST["cmd"]) ? $svc->getDecryptData($_REQUEST["cmd"]) : null;
//$context	= (isset($_REQUEST["ctx"])) ? $svc->getDecryptData($_REQUEST["ctx"]) : null;
$cnt = "";
//setLog("$data $command");
switch ($command) {
    case TPERSONAS_GENERALES:
        $xSoc = new cSocios_general();
        $xSoc->setData($xSoc->query()->initByID($data));
        $cnt = $svc->getEncryptData(json_encode($xSoc->query()->getCampos()));
        //setLog(json_encode($xSoc->query()->getCampos()));
        break;
    case TPERSONAS_DIRECCIONES:
        $xDom = new cSocios_vivienda();
 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;
 }
$arg2 = isset($DDATA["arg2"]) ? $DDATA["arg2"] : PERSONAS_ACTIVIDAD_ECONOMICA_CLASE;
//$relacionado    = isset($DDATA["relacionado"]) ? $DDATA["relacionado"] : SYS_NINGUNO; //ID
$lim = isset($DDATA["lim"]) ? $DDATA["lim"] : 100;
$arg = substr($arg, 0, 20);
$where = "";
$superior = "";
$clase = "";
switch ($action) {
    case SVC_LIST:
        $where = " AND (\n    \t\t\t(`personas_actividad_economica_tipos`.`nombre_de_la_actividad` LIKE '%{$arg}%')\n               /* OR\n                (`personas_actividad_economica_tipos`.`descripcion_detallada` LIKE '%{$arg}%')\n                \n                (`personas_actividad_economica_tipos`.`productos` LIKE '%{$arg}%')*/\n\t\t\t\t) LIMIT 0,{$lim}";
        $clase = $arg2;
        break;
    case SVC_GET:
        $where = " AND ( `personas_actividad_economica_tipos`.`clave_de_actividad` = {$arg} ) LIMIT 0,1";
        break;
}
//GET PUT DELETE LIST
$xT = new cSQLListas();
//$xT->setOperador("LIKE");
$sql = $xT->getListadoDePersonasActividadesEconomicasTipos("", $clase, $superior, $where);
//echo $sql;
$xSVC = new MQLService($action, $sql);
echo $xSVC->getJSON();
//$xLog       = new cSystemLog();
//$xLog->setRotate();
//$xLog->setSave($sql);
//$xT->clave_de_actividad()
//print json_encode($jTableResult);
/*
echo "<?xml version =\"1.0\" ?>\n<data>\n" . $txt . "</data>";
*/
/**
 * @author Balam Gonzalez Luis Humberto
 * @version 0.0.01
 * @package
 */
//=====================================================================================================
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
include_once "../core/core.db.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("", HP_FORM);
$sql = "SELECT\n\t`general_menu`.`idgeneral_menu`,\n\t/*`general_menu`.`menu_parent`,*/\n\t`general_menu`.`menu_title`,\n\t'' AS 'translate'\nFROM\n\t`general_menu` `general_menu` \nWHERE\n\t(`general_menu`.`menu_title` !='') ";
//$OB				= new MQL();
//$rs			= $OB->getRecordset($sql);
//$sel			= $OB->
//$ob				= new MQLSelect($tabla, $datos, $primaryK);
//$men				= new cGeneral_menu();
header('Content-type: application/json');
$svc = new MQLService("LIST", $sql);
echo $svc->getJSON();
//$q					= $men->query()->select();
//$q->exec("(`general_menu`.`menu_title` !='')");
$persona = parametro("persona", DEFAULT_SOCIO, MQL_INT);
$persona = parametro("socio", $persona, MQL_INT);
$persona = parametro("idsocio", $persona, MQL_INT);
$relacionado = parametro("relacionado", DEFAULT_SOCIO, MQL_INT);
$tipo = parametro("tipo", 0, MQL_INT);
$parentesco = parametro("parentesco", 0, MQL_INT);
$depende = parametro("depende", false, MQL_BOOL);
$documento = parametro("documento", false, MQL_INT);
$error = false;
$format = parametro("out", "", MQL_STRING);
header('Content-type: application/json');
if ($persona > DEFAULT_SOCIO) {
    $xPer = new cSocio($persona);
    if ($xPer->init() == true) {
        //setLog($lis->getListadoDeRelaciones($persona));
        $svc = new MQLService("list", $lis->getListadoDeRelaciones($persona, $documento));
        echo $svc->getJSON($format);
    } else {
        $error = true;
        $txt .= "ERROR\tNo existe la persona {$persona}\r\n";
    }
    if (MODO_DEBUG == true) {
        $txt .= $xPer->getMessages();
    }
}
if ($error == true) {
    $rs["error"] = true;
    $rs["msg"] = $txt;
    echo json_encode($rs);
}
//setLog(json_encode($rs));
            echo $svc->getJSON($out);
            exit;
        }
    } else {
        $wher = $where == false ? "" : $where;
        $sql = base64_decode($query) . " " . base64_decode($where);
        $svc = new MQLService("list", $sql);
        echo $svc->getJSON($out);
        exit;
    }
}
if ($tabla != false and $clave != false) {
    $xObj = new cSAFETabla($tabla);
    if ($xObj->obj() == null) {
        $err = true;
    } else {
        $obj = $xObj->obj();
        //$obj	= new cSocios_general();
        $sel = $obj->query()->select();
        $sql = $sel->get($obj->getKey() . " = '{$clave}' ");
        $svc = new MQLService("list", $sql);
        //echo $sql;
        echo $svc->getJSON($out);
        exit;
    }
}
if ($err == true) {
    $rs[MSG_NO_PARAM_VALID] = "ERROR\t para la Tabla {$tabla} y clave {$clave}\r\n";
    $rs["error"] = true;
}
echo json_encode($rs);
 function patch($force = false, $version_inicial = false, $soloIdioma = false)
 {
     $ql = new MQL();
     $xConf = new cConfiguration();
     $localver = $xConf->get("safe_osms_database_version");
     //Actualiza la configuracion
     //if($force == true){			$xConf->set("safe_osms_database_version", $version);		}
     if (FORCE_UPDATES_ON_BOOT == true or $force == true) {
         //Ejecutar Vistas y Functions
         if ($soloIdioma == false) {
             $this->setAplicarScripts();
         }
         $current = $version_inicial === false ? intval(SAFE_DB_VERSION) : $version_inicial;
         //201406.01
         $dbversion = intval(SAFE_VERSION . SAFE_REVISION);
         $sqlMenu = "INSERT INTO `general_menu` (`idgeneral_menu`, `menu_parent`, `menu_title`, `menu_file`, `menu_type`, `menu_order`) VALUES ";
         $lang = array();
         $sql = array();
         $xSrv = new MQLService("", "");
         $ulang = $xSrv->getRequest(URL_UPDATES . "install/updates/lang.php");
         $lang = json_decode($ulang, true);
         $ulang2 = $xSrv->getRequest(URL_UPDATES . "install/updates/lang2.php");
         $lang2 = json_decode($ulang2, true);
         $usql = $xSrv->getRequest(URL_UPDATES . "install/updates/sql.php?version={$localver}");
         $sql = json_decode($usql, true);
         //setLog(URL_UPDATES . "install/updates/sql.php?version=$dbversion");
         $this->mMessages .= "URL\t" . URL_UPDATES . "install/updates/sql.php?version={$localver}" . "\r\n";
         $upt = false;
         if (is_array($lang)) {
             foreach ($lang as $version => $patchs) {
                 if ($current <= intval($version)) {
                     foreach ($patchs as $idx => $content) {
                         $palabra = $content[0];
                         $traduccion = $content[1];
                         $language = $content[2];
                         $this->addLang($palabra, $traduccion, $language);
                     }
                     $upt = true;
                 }
             }
         }
         if (is_array($lang2)) {
             foreach ($lang2 as $version2 => $patchs2) {
                 if ($current <= intval($version2)) {
                     foreach ($patchs2 as $idx2 => $content2) {
                         $palabra = $content2[0];
                         $spanish = $content2[1];
                         $english = $content2[2];
                         $this->addLang($palabra, $spanish, "es");
                         $this->addLang($palabra, $english, "en");
                     }
                     $upt = true;
                 }
             }
         }
         if ($soloIdioma == false) {
             foreach ($sql as $version => $patchs) {
                 if ($current <= intval($version)) {
                     $this->mMessages .= "WARN\t===========PATCH {$version}\r\n";
                     foreach ($patchs as $idx => $content) {
                         $ql->setRawQuery($content);
                         $content = preg_replace('!\\s+!', ' ', $content);
                         $this->mMessages .= "{$idx}\t===={$content}====\r\n";
                         $upt = true;
                         //syslog(E_ERROR, $content);
                     }
                 } else {
                     $this->mMessages .= "WARN\tDescartado por ser {$version} de {$current}\r\n";
                 }
             }
             //Obtener el codigo y parcharlo
             //URL_UPDATES
             //Convierte la DB a UTF8
             //ALTER TABLE `operaciones_recibos` CHANGE COLUMN `clave_de_moneda` `clave_de_moneda` VARCHAR(6) NULL DEFAULT 'MXN', ADD COLUMN `archivo_fisico` VARCHAR(200) NULL COMMENT 'Archivo fisico del recibo, almacenado en server ftp' AFTER `origen_aml`
             $codif = $ql->getDataRecord("SHOW TABLES IN " . MY_DB_IN);
             foreach ($codif as $rows) {
                 $table = $rows["Tables_in_" . MY_DB_IN];
                 $trs = "ALTER TABLE `{$table}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci";
                 //$ql->setRawQuery($trs);
             }
             $ql->setRawQuery("ALTER SCHEMA `" . MY_DB_IN . "`  DEFAULT CHARACTER SET utf8  DEFAULT COLLATE utf8_general_ci");
         }
         //Actualizar vistas y functions
         if ($soloIdioma == false) {
             if ($this->setAplicarScripts() == false) {
                 $this->mMessages .= "ERROR\tAl Aplicar Vistas y funciones...\r\n";
             } else {
                 $this->mMessages .= "OK\tSe aplicaron Vistas y funciones...\r\n";
             }
         }
         //ejecutar Mensajes
         $this->mMessages .= $ql->getMessages(OUT_TXT);
         if ($upt == true) {
             /*Actualiza la configuracion*/
             $xConf->set("safe_osms_database_version", $dbversion);
         }
     } else {
         $this->mMessages .= "WARN\tSistema no Actualizado\r\n";
     }
     return $this->mMessages;
 }
//=====>	INICIO_H
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
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