Added customer_number and serice pin
This commit is contained in:
@@ -359,6 +359,30 @@ class OrderController extends mfBaseController {
|
||||
$this->log->warn("Unable to save OrderProduct:".print_r($product, true));
|
||||
}
|
||||
|
||||
// if product is not external and customer is new, create customer_number and service pin
|
||||
|
||||
if(!$prod->external ) {
|
||||
if(!$owner->customer_number) {
|
||||
$last_num = AddressModel::getLastCustomerNumber();
|
||||
|
||||
if($last_num) {
|
||||
$new_num = $last_num + 1;
|
||||
} else {
|
||||
$new_num = TT_FIRST_CUSTNUM;
|
||||
}
|
||||
|
||||
$owner->customer_number = $new_num;
|
||||
$owner->save();
|
||||
}
|
||||
|
||||
if(!$owner->spin) {
|
||||
$spin = $owner->generateServicePin();
|
||||
if($spin) {
|
||||
$owner->spin = $spin;
|
||||
$owner->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user