|
|
@@ -1,239 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-require_once("util.php");
|
|
|
-require_once("NTK/NTK.php");
|
|
|
-
|
|
|
-?>
|
|
|
-
|
|
|
-<html>
|
|
|
-<head>
|
|
|
- <title> Index </title>
|
|
|
-
|
|
|
-<?php
|
|
|
-
|
|
|
-echo getHead();
|
|
|
-
|
|
|
-?>
|
|
|
-
|
|
|
-</head>
|
|
|
-
|
|
|
-<body>
|
|
|
-
|
|
|
-<?php
|
|
|
-
|
|
|
-$action = var_get_post("action", "");
|
|
|
-
|
|
|
-$main_box = new NTKVBox("main_box", 0, 0, False);
|
|
|
-
|
|
|
-// Toolbar
|
|
|
-$page = "websync";
|
|
|
-$printfile = "";
|
|
|
-include("Modules/toolbar.php");
|
|
|
-
|
|
|
-// if($action == "upload_0")
|
|
|
-// {
|
|
|
-// $main_box->add(new NTKLabel("", "Neue Produkte / Preise online stellen"), 200, 10, "font-style: bold; background-color: #dfe7f3;");
|
|
|
-//
|
|
|
-// $button_next = new NTKButton("button_next", "Weiter", "location.replace('websync.php?action=upload_1');");
|
|
|
-// $main_box->add($button_next);
|
|
|
-// }
|
|
|
-
|
|
|
-if($action == "upload_0")
|
|
|
-{
|
|
|
- require_once("DataBase/Priceset.php");
|
|
|
- require_once("DataBase/Customer.php");
|
|
|
- require_once("DataBase/Product.php");
|
|
|
- require_once("DataBase/Price.php");
|
|
|
- require_once("DataBase/Category.php");
|
|
|
-
|
|
|
- $priceset = new Priceset();
|
|
|
- $customer = new Customer();
|
|
|
- $product = new Product();
|
|
|
- $price = new Price();
|
|
|
- $category = new Category();
|
|
|
-
|
|
|
- $priceset->export("mysql_export/priceset.csv");
|
|
|
- $customer->export("mysql_export/customer.csv");
|
|
|
- $product->export("mysql_export/product.csv");
|
|
|
- $price->export("mysql_export/price.csv");
|
|
|
- $category->export("mysql_export/category.csv");
|
|
|
-
|
|
|
- // upload all db-files "mysql_export"
|
|
|
- $handle = popen("/var/www/ursprung/bin/upload.sh", "r");
|
|
|
- pclose($handle);
|
|
|
-
|
|
|
- $main_box->add(new NTKLabel("", "Schritt erfolgreich"), 200, -1, "color: #00ff00; background-color: #dfe7f3;");
|
|
|
- $button_next = new NTKButton("button_next", "Weiter", "location.replace('websync.php?action=upload_1');");
|
|
|
- $main_box->add($button_next, 500);
|
|
|
-}
|
|
|
-elseif($action == "upload_1")
|
|
|
-{
|
|
|
- $iframe = new NTKIFrame("upload_frame", "http://www.natuerlich-grobi.de/db_import.php", "width: 300px; height: 200px; background-color: #dfe7f3;");
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
- $main_box->add(new NTKLabel("", "Serverausgabe (dauert etwas):"), False, False, "font-style: bold; background-color: #dfe7f3;");
|
|
|
- $main_box->add($iframe, False, False, "background-color: #dfe7f3;");
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
-}
|
|
|
-elseif($action == "download_0")
|
|
|
-{
|
|
|
- $iframe = new NTKIFrame("download_frame", "http://www.natuerlich-grobi.de/db_export.php", "width: 300px; height: 200px; background-color: #dfe7f3;");
|
|
|
-// $iframe = new NTKIFrame("download_frame", "http://localhost/ursprung/db_export.php", "width: 300px; height: 200px; background-color: #dfe7f3;");
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
- $main_box->add(new NTKLabel("", "Serverausgabe (dauert etwas):"), False, False, "font-style: bold; background-color: #dfe7f3;");
|
|
|
- $main_box->add($iframe, False, False, "background-color: #dfe7f3;");
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
- $main_box->add(new NTKButton("button_next", "Weiter", "ntk_show_splash('bitte warten ...'); location.replace('websync.php?action=download_1');"), 500);
|
|
|
-}
|
|
|
-elseif($action == "download_1")
|
|
|
-{
|
|
|
- // download all db-files "mysql_import"
|
|
|
- $handle = popen("/var/www/ursprung/bin/download.sh", "r");
|
|
|
- pclose($handle);
|
|
|
-
|
|
|
- require_once("DataBase/Bill.php");
|
|
|
- require_once("DataBase/Bill_Product.php");
|
|
|
- require_once("DataBase/Bill_Import.php");
|
|
|
- require_once("DataBase/Bill_Product_Import.php");
|
|
|
- require_once("DataBase/Customer.php");
|
|
|
- require_once("DataBase/Tour.php");
|
|
|
-
|
|
|
- // import new bills
|
|
|
- $bill = new Bill();
|
|
|
- $bill_product = new Bill_Product();
|
|
|
- $bill_import = new Bill_Import();
|
|
|
- $bill_product_import = new Bill_Product_Import();
|
|
|
- $customer = new Customer();
|
|
|
- $tour = new Tour();
|
|
|
-
|
|
|
- if( $bill_import->import("mysql_import/bill.csv") == 0 &&
|
|
|
- $bill_product_import->import("mysql_import/bill_product.csv") == 0)
|
|
|
- {
|
|
|
-
|
|
|
- /* import bills from bill_import and products from bill_product_import */
|
|
|
- $bills = $bill_import->get();
|
|
|
- for($i = 0; $i < count($bills); $i++)
|
|
|
- {
|
|
|
- if(!$bill->hasTimestamp($bills[$i][6]))
|
|
|
- {
|
|
|
- $customer_data = $customer->get($bills[$i][1]);
|
|
|
- if(count($customer_data) == 0)
|
|
|
- {
|
|
|
- echo "Fehler: websync.php import bills from bill_import no customer data";
|
|
|
- continue;
|
|
|
- }
|
|
|
- $tour_data = $tour->get($customer_data[0][12]);
|
|
|
- $date = getdate(time());
|
|
|
-
|
|
|
- $new_bill_id = $bill->create("", array($bills[$i][1], $customer_data[0][12], $date['year']."-".$date['mon']."-".$date['mday'], $tour_data[0][2], -2, $bills[$i][6]));
|
|
|
-
|
|
|
- $bill_products = $bill_product_import->getByBillId($bills[$i][0]);
|
|
|
- for($j = 0; $j < count($bill_products); $j++)
|
|
|
- {
|
|
|
- $bill_product->create(array($new_bill_id, $bill_products[$j][2], $bill_products[$j][3], $bill_products[$j][4], 0, 0, 0));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
- $main_box->add(new NTKLabel("", "Fertig"), False, False, "font-style: bold; background-color: #dfe7f3;");
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
- $main_box->add(new NTKLabel("", "neue Bestellungen laden schlug fehl.<br>In ein paar Minuten nochmal versuchen."), False, False, "color: #ff0000; font-style: bold; background-color: #dfe7f3;");
|
|
|
- $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
|
|
|
- }
|
|
|
-}
|
|
|
-else
|
|
|
-{
|
|
|
- // small Toolbar
|
|
|
- include("Modules/Websync/toolbar.php");
|
|
|
-
|
|
|
- // main content
|
|
|
- $main_box->add(new NTKLabel("", "Internet Synchronisation"), 200, -1, "background-color: #dfe7f3;");
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-// tools
|
|
|
-// $tool_box = new NTKVBox("online_box", 5, 0, False);
|
|
|
-//
|
|
|
-// $online_export_button = new NTKButton("", "online export", "window.open('http://www.natuerlich-grobi.de/db_export.php', 'Online Export', 'width=300,height=200');");
|
|
|
-// $tool_box->add($online_export_button, 60, 60, $style);
|
|
|
-//
|
|
|
-// $download_button = new NTKButton("", "download", "");
|
|
|
-// $tool_box->add($download_button, 60, 60, $style);
|
|
|
-//
|
|
|
-// $local_import_button = new NTKButton("", "Local Import", "location.replace('websync.php?action=local_import');");
|
|
|
-// $tool_box->add($local_import_button, 60, 60, $style);
|
|
|
-//
|
|
|
-// $local_sync_button = new NTKButton("", "Local Sync", "location.replace('websync.php?action=local_sync');");
|
|
|
-// $tool_box->add($local_sync_button, 60, 60, $style);
|
|
|
-//
|
|
|
-// $local_export_button = new NTKButton("", "Local Export", "location.replace('websync.php?action=local_export');");
|
|
|
-// $tool_box->add($local_export_button, 60, 60, $style);
|
|
|
-//
|
|
|
-// $upload_button = new NTKButton("", "upload", "");
|
|
|
-// $tool_box->add($upload_button, 60, 60, $style);
|
|
|
-//
|
|
|
-// $online_import_button = new NTKButton("", "online import", "window.open('http://www.natuerlich-grobi.de/db_import.php', 'Online Import', 'width=300,height=200');");
|
|
|
-// $tool_box->add($online_import_button, 60, 60, $style);
|
|
|
-//
|
|
|
-// // add toolbars
|
|
|
-// $main_box->add($tool_box, True, True);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// if($action == "local_import")
|
|
|
-// {
|
|
|
-// require_once("DataBase_Net/Bill_Net.php");
|
|
|
-// require_once("DataBase_Net/Bill_Product_Net.php");
|
|
|
-//
|
|
|
-// $bill_net = new Bill_Net();
|
|
|
-// $bill_product_net = new Bill_Product_Net();
|
|
|
-//
|
|
|
-// $bill_net->import("mysql_import/bill.csv");
|
|
|
-// $bill_product_net->import("mysql_import/bill_product.csv");
|
|
|
-//
|
|
|
-// $main_box->add(new NTKLabel("", "Local Import erfolgreich"), 200, -1, "background-color: #dfe7f3;");
|
|
|
-// }
|
|
|
-// elseif($action == "local_sync")
|
|
|
-// {
|
|
|
-// include("Modules/Websync/PricesetSync.php");
|
|
|
-// include("Modules/Websync/CustomerSync.php");
|
|
|
-// include("Modules/Websync/ProductSync.php");
|
|
|
-// include("Modules/Websync/BillSync.php");
|
|
|
-//
|
|
|
-// $main_box->add(new NTKLabel("", "Local Sync erfolgreich"), 200, -1, "background-color: #dfe7f3;");
|
|
|
-// }
|
|
|
-// elseif($action == "local_export")
|
|
|
-// {
|
|
|
-// require_once("DataBase_Net/Priceset_Net.php");
|
|
|
-// require_once("DataBase_Net/Customer_Net.php");
|
|
|
-// require_once("DataBase_Net/Product_Net.php");
|
|
|
-// require_once("DataBase_Net/Price_Net.php");
|
|
|
-// require_once("DataBase_Net/Category_Net.php");
|
|
|
-//
|
|
|
-//
|
|
|
-// $priceset_net = new Priceset_Net();
|
|
|
-// $customer_net = new Customer_Net();
|
|
|
-// $product_net = new Product_Net();
|
|
|
-// $price_net = new Price_Net();
|
|
|
-// $category_net = new Category_Net();
|
|
|
-//
|
|
|
-// $priceset_net->export("mysql_export/priceset.csv");
|
|
|
-// $customer_net->export("mysql_export/customer.csv");
|
|
|
-// $product_net->export("mysql_export/product.csv");
|
|
|
-// $price_net->export("mysql_export/price.csv");
|
|
|
-// $category_net->export("mysql_export/category.csv");
|
|
|
-//
|
|
|
-// $main_box->add(new NTKLabel("", "Local Export erfolgreich"), 200, -1, "background-color: #dfe7f3;");
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-echo $main_box->getHtml();
|
|
|
-
|
|
|
-?>
|
|
|
-
|
|
|
-</body>
|
|
|
-</html>
|