示例#1
0
function main()
{
    if (!checkPrereqs())
    {
        return;
    }

    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        handlePost();
    } else {
        showForm();
    }
}
示例#2
0
function generateCronOutput()
{
    $handlerCommonCore = new \CommonCore();
    // Armar Wrapper HTML
    echo $handlerCommonCore->getPageHeaderHtml("Lector de Correos - Recepción de facturas XML");
    // Armar sección de prerequisitos
    $html = '   <header id="header" class="container">
                    <h1><span class="awe-envelope"></span> Lector de Correos - Recepción de facturas XML</h1>
                    <p>' . date("Y") . '</p>
                </header>
                <section class="container">
                    <div class="content-block">
                        <div class="row">
                            

                            <article class="data-block decent" style="margin-left: 0px;">
                                <div class="data-container" style="padding: 10px;">
                                    
                                    <header>
                                        <h2><span class="awe-check"></span> Prerequisitos</h2>
                                    </header>

                                    <section style="margin: 0px;">
                                        <table class="table table-condensed table-striped">';
    $validArray = checkPrereqs();
    $html .= $validArray["html"];
    $html .= '                          </table>
                                    </section>
                                </div>
                            </article>';
    // Armar sección para cada dirección de mail registrada
    // Solo si se cumplen los prerequisitos
    if ($validArray["status"]) {
        //Tomar todas las direcciones de correo registradas
        $mailsString = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_MC_MAILS");
        if ($mailsString != "") {
            $mails = explode(",", $mailsString);
            foreach ($mails as $mail) {
                $mail = explode("|", $mail);
                $mail = array("ruc" => $mail[0], "servidor" => $mail[1], "usuario" => $mail[2], "password" => $mail[3]);
                $html .= '  <article class="data-block decent" style="margin-left: 0px;">
                                <div class="data-container" style="padding: 10px;">
                                    
                                    <header>
                                        <h2><span class="awe-check"></span> Correos para RUC: ' . $mail["ruc"] . '</h2>
                                    </header>

                                    <section style="margin: 0px;">';
                $validArray = openMailbox($mail["servidor"], $mail["usuario"], $mail["password"]);
                // Abrir dirección de correo
                $inbox = $validArray["status"];
                $html .= $validArray["html"];
                if ($inbox) {
                    $validArray = getEmails($inbox, $mail["ruc"]);
                    // Seleccionar e-mails nuevos
                    $emails = $validArray["status"];
                    $html .= $validArray["html"];
                    if (count($emails) > 0) {
                        $validArray = processAllEmails($inbox, $emails, $mail["ruc"]);
                        // Procesar todos los e-mails
                        $html .= $validArray["html"];
                        imap_close($inbox, CL_EXPUNGE);
                        $html .= '<strong>Estado:</strong> Conexión cerrada exitosamente <br />';
                    }
                }
                $html .= '          </section>
                                </div>
                            </article>';
            }
        } else {
            $html .= '<strong>AVISO:</strong> No existen datos de RUC parametrizados. Por favor configure la variable de proceso RDE_MC_MAILS';
        }
    }
    // Armar sección para archivos locales
    $html .= '  <article class="data-block decent" style="margin-left: 0px;">
                            <div class="data-container" style="padding: 10px;">
                                
                                <header>
                                    <h2><span class="awe-check"></span> Archivos locales:</h2>
                                </header>

                                <section style="margin: 0px;">';
    //Verificar si hay archivos locales en carpeta IN
    $inDirectory = FlowSettingsCore::get(FLOW_RECEPCIONDOCUMENTOS, "RDE_FILES_IN_PATH");
    $files = array_diff(scandir($inDirectory), array('..', '.'));
    if (count($files) > 0) {
        $validArray = processAllLocalFiles($files);
        $html .= $validArray["html"];
    } else {
        $html .= '<strong>AVISO:</strong> No existen archivos locales';
    }
    $html .= '                  </section>
                            </div>
                        </article>';
    $html .= '          </div>
                    </div>
                </section>';
    echo $html;
}
示例#3
0
 public static function main()
 {
     checkPrereqs();
 }