Ejemplo n.º 1
0
 public static function synchronizeInboundAltitude(IConnection $connect, $syncID, $userID)
 {
     global $database, $servers_altitude;
     $response = "";
     $path_data = PATHDATA_SOCKET_EASYLOAD;
     $path_file = "{$path_data}/{$userID}_{$syncID}";
     $output = "";
     try {
         //$objCampaign = Campaign::getCampaignByID($connect, $campaignID);
         //$shortname = $objCampaign->getShortName();
         //$objSync = new SynchronizeFolio($syncID,0, 0, "", "", "");
         $without_easycode = FolioImport::getRegistersInboundRegestion($connect, 'S');
         $action = 1;
         try {
             $objSocket = new Socket(IP_SOCKET_EASYLOAD, PORT_SOCKET_EASYLOAD, TIMEOUT_SOCKET_EASYLOAD);
             $objSocket->connect();
             // 1. Comprobando enlace con socket
             $objSocket->send("ACTION=TEST");
             $response = $objSocket->receive();
             //$objSync->updateSynchronizeAction($connect, $action, "OK");
             // 2. Generando archivo .TYP
             $action = 2;
             sleep(1);
             $filename = Util::generateFilesImportInbound($connect, $path_file, "TYP", true);
             //$objSync->updateSynchronizeAction($connect, $action, "OK");
             // 3. Generando archivo .dat
             $action = 3;
             sleep(1);
             Util::generateFilesImportInbound($connect, $path_file, "DAT", true);
             //$objSync->updateSynchronizeAction($connect, $action, "OK");
             // 4. Delegar a socket importar data en altitude
             $action = 4;
             sleep(1);
             $serverAtt = SERVER_NORMAL;
             //trim($objCampaign->getServerAltitude()) == "" ? SERVER_NORMAL : trim($objCampaign->getServerAltitude());
             $connectSQL = Util::createConnection(ENGINE_SQLSERVER, $database[$servers_altitude["{$serverAtt}"]['altitude']]);
             $connectSQL->connect();
             $rsDataAltitude = Altitude::getCampaignsByContactTable($connectSQL, 'outbound_retencion');
             $data = $connectSQL->getRows($rsDataAltitude);
             $campaignATT = trim($data['shortname']);
             $accessInstance = $database[$servers_altitude["{$serverAtt}"]['altitude']];
             $instance = $accessInstance['serverIA'] . ":" . $accessInstance['portIA'];
             $objSocket->send("ACTION=IMPORT;CAMPAIGN={$campaignATT};FILE={$filename};INSTANCE={$instance};USER={$userID};SYNCID={$syncID}");
             $response = $objSocket->receive();
             echo $response;
             /*if ($response == "ERROR" || $response == "WARN") {
                                 $msg = Util::getContentFile("{$path_file}/{$campaignATT}_messages.txt");
                                 $txt = "Ocurrio un problema en la importacion altitude";
                                 $mex = new MyException("$msg", 0, $txt);
                                 $mex->publisherSqlException(false);
                                 $mex->setText("{$txt}. Error# {$mex->getExceptionID()}");
                                 $output = "{$txt}. Error# {$mex->getExceptionID()}.";
             
                                 if ($response == "ERROR") {
                                     throw $mex;
                                 }
                             }*/
             //$objSync->updateSynchronizeAction($connect, $action, "{$response}");
             // 5. Finalizando enlace con socket
             $action = 5;
             $objSocket->changeTimeout(15);
             $objSocket->send("ACTION=END");
             $response = $objSocket->receive();
             //$objCampaign = Campaign::getCampaignByID($connect, $campaignID);
             //$objFolio = FolioImport::getFolioImport($connect, $folioID);
             //$total_folio = $objFolio->getRegistersImported();
             //$without_easycode = FolioImport::getRegistersWithoutEasycode($connect, $shortname, $folioID, 'S');
             //$objSync->updateSynchronizeAction($connect, $action, $total_folio - $without_easycode);
         } catch (MyException $ex) {
             $output = "ERROR: " . $ex->getText();
             //$objSync->updateSynchronizeAction($connect, $action, "ERROR: {$ex->getText()}");
         }
     } catch (MyException $ex) {
         $output = "Error: " . $ex->getText();
     }
     return $output;
 }
Ejemplo n.º 2
0
 function confDbRestoreLocal($filename)
 {
     if (empty($filename)) {
         return NULL;
     }
     $socket = new Socket();
     $socket->send('backup_db_restore_local', $filename);
     $socket->receive();
     $socket = new Socket();
     $socket->send('reload_d3config');
 }
Ejemplo n.º 3
0
 function confDbBackupUSB()
 {
     $socket = new Socket();
     $socket->send('backup_usb');
     $listBackupUSB = $socket->receive();
     return $listBackupUSB;
 }