Exemplo n.º 1
0
    if (!SesionController::isLoggedIn()) {
        throw new ApiException($this->error_dispatcher->invalidAuthToken());
    }
    set_time_limit(600);
    Logger::log("Subiendo archivo ... ");
    if ($_REQUEST["type"] == "csv-clientes") {
        move_uploaded_file($_FILES["logo"]["tmp_name"], "../../../static_content/" . IID . "-clientes.csv");
        ClientesController::Importar(file_get_contents("../../../static_content/" . IID . "-clientes.csv"));
    }
    if ($_REQUEST["type"] == "csv-productos") {
        move_uploaded_file($_FILES["logo"]["tmp_name"], "../../../static_content/" . IID . "-productos.csv");
        ProductosController::Importar(file_get_contents("../../../static_content/" . IID . "-productos.csv"));
    }
    if ($_REQUEST["type"] == "csv-proveedores") {
        move_uploaded_file($_FILES["logo"]["tmp_name"], "../../../static_content/" . IID . "-proveedores.csv");
        ProveedoresController::Importar(file_get_contents("../../../static_content/" . IID . "-proveedores.csv"));
    }
    if ($_REQUEST["type"] == "logo") {
        move_uploaded_file($_FILES["logo"]["tmp_name"], "../static/" . IID . ".jpg");
    }
    echo '{"status":"ok"}';
    exit;
}
$page = new GerenciaTabPage();
$page->addComponent("<script>Ext.Ajax.timeout = 5 * 60 * 1000; /* 5 minutos */ </script>");
$page->addComponent(new TitleComponent("Configuracion de POS ERP"));
if (!is_writable("../../../static_content/")) {
    $page->addComponent(" <div id=''>ALERTA: No se pueden subir archivos. Contacte a un administrador de POS ERP</div>");
}
$page->nextTab("Importar");
$page->addComponent(new TitleComponent("Importar clientes de CSV/AdminPAQ/Excel", 2));