#!/usr/bin/php id) { continue; } foreach(['deleted', 'deletet', 'deleded', 'delete', 'deledet'] as $word) { if(strtolower(trim($cust->company)) == $word || strtolower(trim($cust->surname)) == $word || strtolower(trim($cust->firstname)) == $word) { continue 2; } } if(in_array($cust->id, $blacklist)) { // dont import blacklisted customer ids echo $cust->id. " in blacklist\n"; continue; } $address = AddressModel::getFirst(['customer_number' => $cust->id]); if(is_object($address) && $address->id) { continue; } // new customer $address_data['customer_number'] = $cust->id; $address_data['spin'] = $cust->MandatID; $address_data['company'] = $cust->company; $address_data['firstname'] = $cust->firstname; $address_data['lastname'] = $cust->surname; $address_data['street'] = $cust->street; if(strlen($cust->housenumber)) { $address_data['street'] .= " ".$cust->housenumber; } $address_data['zip'] = $cust->zip; $address_data['city'] = $cust->location; $address_data['country'] = ""; $address_data['phone'] = $cust->phone; $address_data['fax'] = ""; $address_data['mobile'] = ""; $address_data['email'] = $cust->email; $address_data['note'] = $cust->extrainfo; $address_data['uid'] = ($cust->UID) ? $cust->UID : null; $address_data["bank_account_bank"] = ""; $address_data["bank_account_owner"] = ($cust->company) ? $cust->company : $cust->firstname . " " . $cust->surname; $address_data["bank_account_iban"] = $cust->IBAN; $address_data["bank_account_bic"] = $cust->BIC; if($cust->payment == 0 ) { // 0 = sepa / 1 = rechnung $address_data['billing_type'] = "sepa"; } else { $address_data['billing_type'] = "invoice"; } if($cust->paper_invoice == 1) { $address_data["billing_delivery"] = "paper"; } else { $address_data["billing_delivery"] = "email"; } if($cust->accept_adver == 2) { $address_data["allow_contact"] = 1; } else { $address_data["allow_contact"] = 0; } if($cust->accept_info == 2) { $address_data["allow_spin"] = 1; } else { $address_data["allow_spin"] = 0; } $address_data['create_by'] = $me->id; $address_data['edit_by'] = $me->id; $address = AddressModel::create($address_data); if(!$address->save()) { echo "Error creating address"; } //exit; }