| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- require_once("DataBase_Net/Customer_Net.php");
- require_once("DataBase/Customer.php");
- // sync Customer database
- $customer = new Customer();
- $customer_net = new Customer_Net();
- $new_customer_count = 0;
- $del_customer_count = 0;
- // fetch all remote customers
- $remote_customers = $customer_net->get('', array('customer_id'));
- foreach($remote_customers as $tmp)
- {
- if($customer->exists($tmp[0]) == false)
- {
- $customer_net->delete($tmp[0]);
- $del_customer_count++;
- }
- }
- $remote_customers = $customer_net->get('', array('customer_id'));
- $local_customers = $customer->get('', array('customer_id'));
- foreach($local_customers as $tmp)
- {
- $found = false;
-
- foreach($remote_customers as $remote_tmp)
- {
- if($remote_tmp[0] == $tmp[0])
- {
- $found = true;
- break;
- }
- }
-
- $tmp_data = $customer->get($tmp[0], array( "password",
- "prename",
- "postname",
- "street",
- "streetnumber",
- "plz",
- "city",
- "telephone",
- "telefax",
- "email",
- "pricelist_id",
- "tour_id",
- "rabatt",
- "details",
- "bank_name",
- "bank_account",
- "blz"));
-
- if(!$found)
- {
- $customer_net->create($tmp[0], $tmp_data[0]);
- $new_customer_count++;
- }
- else
- {
- $customer_net->update($tmp[0], $tmp_data[0]);
- }
- }
- $main_box->add(new NTKLabel("", "neue Kunden online: ".$new_customer_count), 200, 0, "background-color: #dfe7f3;");
- $main_box->add(new NTKLabel("", "Kunden online gelöscht: ".$del_customer_count), 200, 0, "background-color: #dfe7f3;");
- ?>
|