Added customer_number and serice pin
This commit is contained in:
@@ -51,6 +51,20 @@ class Address extends mfBaseModel {
|
||||
|
||||
}
|
||||
|
||||
public function generateServicePin() {
|
||||
if(!$this->customer_number) {
|
||||
return false;
|
||||
}
|
||||
$num1 = rand(65, 90);
|
||||
$num2 = rand(65, 90);
|
||||
|
||||
$c1 = chr($num1);
|
||||
$c2 = chr($num2);
|
||||
|
||||
$spin = $c1.$c2.$this->customer_number;
|
||||
return $spin;
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
class AddressModel {
|
||||
public $parent_id = null;
|
||||
public $customer_number = null;
|
||||
public $spin = null;
|
||||
public $company = null;
|
||||
public $firstname = null;
|
||||
public $lastname = null;
|
||||
@@ -76,6 +78,17 @@ class AddressModel {
|
||||
|
||||
}
|
||||
|
||||
public static function getLastCustomerNumber() {
|
||||
$db = FronkDB::singleton();
|
||||
$res = $db->select("Addres","customer_number", "customer_number > 0 ORDER BY customer_number DESC LIMIT 1");
|
||||
if(!$db->num_rows($res)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = $db->num_rows($res);
|
||||
return $data->customer_number;
|
||||
}
|
||||
|
||||
public static function byNetwork($network_id, $addresstype) {
|
||||
if(!is_numeric($network_id) || !$network_id) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user