Creating shipping CSV
This commit is contained in:
@@ -7,6 +7,7 @@ class Address extends mfBaseModel {
|
||||
private $attributes;
|
||||
private $permissions;
|
||||
|
||||
private $phoneparts;
|
||||
|
||||
public function getFullName() {
|
||||
// Assumes "Firma1 Firma2" or "firstname lastname" as readable form
|
||||
@@ -22,6 +23,40 @@ class Address extends mfBaseModel {
|
||||
|
||||
return $name;
|
||||
|
||||
}
|
||||
|
||||
public function splitPhoneNumber() {
|
||||
if(!$this->phone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->phoneparts) {
|
||||
return $this->phoneparts;
|
||||
}
|
||||
|
||||
$phone = preg_replace('/[^0-9]\+/', '', $this->phone);
|
||||
|
||||
$cc = "";
|
||||
$num = "";
|
||||
if(substr($phone, 0, 1) === '+') {
|
||||
$cc = substr($phone, 1, 2);
|
||||
$num = substr($phone, 3);
|
||||
} elseif(substr($phone, 0, 2) === '00') {
|
||||
$cc = substr($phone, 2, 2);
|
||||
$num = substr($phone, 4);
|
||||
} elseif(substr($phone, 0, 1) === '0') {
|
||||
$cc = 43;
|
||||
$num = substr($phone, 1);
|
||||
} else {
|
||||
$cc = 43;
|
||||
$num = $phone;
|
||||
}
|
||||
|
||||
$this->phoneparts = [$cc,$num];
|
||||
return $this->phoneparts;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getCompanyOrName($returnParent = false) {
|
||||
|
||||
Reference in New Issue
Block a user