コード例 #1
0
 $ftp_server = SP_NECKERMANN_FTP_HOST;
 $ftp_user_name = SP_NECKERMANN_FTP_USER;
 $ftp_user_pass = SP_NECKERMANN_FTP_PASSWORD;
 $ftp_file_path = 'in/';
 $conn_id = ftp_connect($ftp_server);
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 if ($conn_id && $login_result) {
     $contents = ftp_nlist($conn_id, $ftp_file_path);
     if (is_array($contents) && count($contents) > 0) {
         if (in_array($xml_filename_encrypted, $contents)) {
             ftp_delete($conn_id, $xml_filename_encrypted);
         }
     }
     $success_upload = ftp_put($conn_id, $ftp_file_path . $xml_filename_encrypted, $encrypted_file, FTP_BINARY);
     if ($success_upload) {
         $upload_id = $class_ju->newUpload($jng_sp_id, 'ORDRSP', $xml_filename_encrypted, $session_userinfo['username']);
         $uploaded_size = ftp_size($conn_id, $ftp_file_path . $xml_filename_encrypted);
         $local_size = filesize($encrypted_file);
         if ($uploaded_size == $local_size) {
             $class_ju->updateStatus($upload_id, 'S', 'auto-check');
             $class_jo->confirmOrders($orders_confirmed, $export_date);
             $content .= '<h3 class="green">' . $jng_sp_name . ': ORDRSP XML File is uploaded successfully</h3>';
         } else {
             $content .= '<h3 class="red">' . $jng_sp_name . ': ORDRSP XML File is not uploaded successfully, please try again.</h3>';
         }
     } else {
         $content .= '<h3 class="red">' . $jng_sp_name . ': Upload file failed</h3>';
     }
     ftp_close($conn_id);
 } else {
     $content .= '<h3 class="red">' . $jng_sp_name . ': Failed connecting to FTP server, please try again later.</h3>';
コード例 #2
0
 $ftp_server = SP_NECKERMANN_FTP_HOST;
 $ftp_user_name = SP_NECKERMANN_FTP_USER;
 $ftp_user_pass = SP_NECKERMANN_FTP_PASSWORD;
 $ftp_file_path = 'in/';
 $conn_id = ftp_connect($ftp_server, 21, 10);
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 if ($conn_id && $login_result) {
     $contents = ftp_nlist($conn_id, $ftp_file_path);
     if (is_array($contents) && count($contents) > 0) {
         if (in_array($xml_filename_encrypted, $contents)) {
             ftp_delete($conn_id, $xml_filename_encrypted);
         }
     }
     $success_upload = ftp_put($conn_id, $ftp_file_path . $xml_filename_encrypted, $encrypted_file, FTP_BINARY);
     if ($success_upload) {
         $upload_id = $class_ju->newUpload($jng_sp_id, 'DESADV_LRM', $xml_filename_encrypted, $session_userinfo['username']);
         $uploaded_size = ftp_size($conn_id, $ftp_file_path . $xml_filename_encrypted);
         $local_size = filesize($encrypted_file);
         if ($uploaded_size == $local_size) {
             $class_ju->updateStatus($upload_id, 'S', 'auto-check');
             $class_jo->confirmOrderDelivery($items_confirmed);
             if (count($qty_cancel_confirmed) > 0) {
                 $class_jo->confirmOrderCancelQty($qty_cancel_confirmed);
             }
             $content .= '<h3 class="green">' . $jng_sp_name . ': DESADV_LRM XML File is uploaded successfully</h3>';
         } else {
             $content .= '<h3 class="red">' . $jng_sp_name . ': DESADV_LRM XML File is not uploaded successfully, please try again.</h3>';
         }
     } else {
         $content .= '<h3 class="red">' . $jng_sp_name . ': Upload file failed</h3>';
     }
コード例 #3
0
         $xml_content .= writeXMLline('order-status', 'return', 5);
         $xml_content .= writeXMLline('ModificationDate', ottodeDateFormat($export_date), 5);
         $xml_content .= writeXMLclose('product-line-item', 4);
     }
     $xml_content .= writeXMLclose('product-line-items', 3);
     $xml_content .= writeXMLclose('OrderState', 2);
 }
 $xml_content .= writeXMLclose('OrderStates', 1);
 $xml_content .= writeXMLclose('ottopartner', 0);
 //CREATE XML ON SERVER
 $xmlfullpath = SP_OTTODE_UPLOAD_PATH_STATES . $xml_filename;
 $file = fopen($xmlfullpath, 'w');
 $success = fwrite($file, $xml_content) !== false;
 fclose($file);
 if ($success) {
     $upload_id = $class_ju->newUpload($jng_sp_id, 'BS', $xml_filename, $session_userinfo['username']);
     $class_jo->confirmOrderReturn($items_confirmed);
     $archive_path_raw = SP_OTTODE_ARCHIVE_PATH . 'return/' . date('Y') . '/';
     if (!file_exists($archive_path_raw)) {
         mkdir($archive_path_raw);
     }
     $archive_fullpath = $archive_path_raw . $xml_filename;
     while (file_exists($archive_fullpath)) {
         $archive_fullpath .= '_copy';
     }
     copy($xmlfullpath, $archive_fullpath);
 }
 //CONFIRM DIRECTLY TO CUSTOMER
 use_class('jng_sp_customers');
 $class_jcust = new jng_sp_customers();
 $counter_success = 0;
コード例 #4
0
     while (count($files) > 2 && $cur_upload_try <= $max_upload_try) {
         $cur_upload_try++;
         $logger->write('- Starting JMS Upload, Try' . $cur_upload_try);
         $shell = array();
         $shell[] = 'cd ' . SP_OTTODE_PATH . 'jms';
         $shell[] = './produce-styles.sh';
         $output = shell_exec(implode("\n", $shell));
         $files = @scandir(SP_OTTODE_UPLOAD_PATH);
     }
     $success = count($files) <= 2;
 }
 if ($success) {
     if (!$trigger_jms_manually) {
         logProcess('JMS Upload Success', '- ', false);
     }
     $upload_id = $class_ju->newUpload($jng_sp_id, 'CAT', $xml_files[count($xml_files) - 1], $session_userinfo['username']);
     //save products with images files included in upload
     if (count($upload_image_log) > 0) {
         $class_ju->addUploadType($upload_id, 'MEDIA', $zip_filename);
         foreach ($upload_image_log as $jcid) {
             $class_ju->addUploadImage($upload_id, $jcid);
         }
     }
     //save products with changing active status
     foreach ($active_log as $status => $jccol) {
         foreach ($jccol as $jcid) {
             $class_ju->addUploadProducts($upload_id, $jcid, $status);
         }
     }
     //SAVE DELETED TO DB AND SEND EAN INFO TO PETER
     //Prevent error caused by multiple eans in array
コード例 #5
0
 //XML CLOSER
 $xml_content .= writeXMLclose('NVAG_CATALOG', 0);
 //FINISH XML FILE CREATION
 $success = fwrite($file, $xml_content) !== false;
 fclose($file);
 if ($success) {
     $class_jc->updateLastActiveStatus($jng_sp_id);
     $class_jc->updateLastReportedStock($jng_sp_id);
     //BACKUP XML FILE
     $shell = array();
     $shell[] = 'cd ' . SP_NECKERMANNAT_UPLOAD_PATH;
     $shell[] = 'zip ' . SP_NECKERMANNAT_PATH . 'cat-backup/' . $xml_filename . '.zip ' . $xml_filename;
     $output = shell_exec(implode("\n", $shell));
     $file = fopen(SP_NECKERMANNAT_UPLOAD_PATH . $xml_filename_marker, 'w');
     fclose($file);
     $upload_id = $class_ju->newUpload($jng_sp_id, 'CAT', $xml_filename, $session_userinfo['username']);
     $content = '<h3 class="green">CAT XML File is uploaded successfully</h3>';
     if (count($upload_image_log) > 0 && $create_image_zip) {
         $zipper->create_archive();
         $success = rename($zip_file, $zip_final);
         if ($success) {
             $file = fopen($zip_marker, 'w');
             fclose($file);
             $class_ju->addUploadType($upload_id, 'MEDIA', $zip_filename);
             foreach ($upload_image_log as $jcid) {
                 $class_ju->addUploadImage($upload_id, $jcid);
             }
             $content .= '<h3 class="green">Media (Image) File is uploaded successfuly</h3>';
         } else {
             $content .= '<h3 class="red">Can not create the Media file, please contact administrator.</h3>';
         }