Order/Form: Changed owner and billingaddress to autocomplete instead of
select
This commit is contained in:
50
scripts/update_customers_street.php
Normal file
50
scripts/update_customers_street.php
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
// ivtcustomer id blacklist
|
||||
//$blacklist = [3805];
|
||||
|
||||
//require 'vendor/autoload.php';
|
||||
require("../config/config.php");
|
||||
|
||||
define('FRONKDB_SQLDEBUG',false);
|
||||
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||
|
||||
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
||||
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
||||
|
||||
$me = new User(1);
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
//$ivt = new FronkDB(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME);
|
||||
|
||||
|
||||
$sql = "SELECT * FROM Address WHERE customer_number < 100000 AND customer_number > 1";
|
||||
$res = $db->query($sql);
|
||||
if(!$db->num_rows($res)) {
|
||||
echo "no addresses\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$address = new Address($data);
|
||||
if(!$address->id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cust = new IvtCustomer($address->customer_number);
|
||||
if(!$cust->id) {
|
||||
echo "not an ivt customer".$cust->id." - ".$address->customer_number."\n";
|
||||
}
|
||||
|
||||
$address->street = $cust->street;
|
||||
if(strlen($cust->housenumber)) {
|
||||
$address->street .= " ".$cust->housenumber;
|
||||
}
|
||||
|
||||
//var_dump($address);exit;
|
||||
if(!$address->save()) {
|
||||
echo "Error updateing address";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user