Preorder: Status can now be changed manually
This commit is contained in:
@@ -211,6 +211,8 @@ class Preorder extends mfBaseModel {
|
||||
return $this->ucode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function generateNewUcode() {
|
||||
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
|
||||
$charsLength = strlen($chars);
|
||||
@@ -221,6 +223,25 @@ class Preorder extends mfBaseModel {
|
||||
return $ucode;
|
||||
}
|
||||
|
||||
public function createCifCode() {
|
||||
$cifcode = $this->generateNewCifcode();
|
||||
while(PreorderModel::search(['cifcode' => $cifcode])) {
|
||||
$cifcode = $this->generateNewCifcode();
|
||||
}
|
||||
$this->cifcode = $cifcode;
|
||||
return $this->cifcode;
|
||||
}
|
||||
|
||||
private function generateNewCifcode() {
|
||||
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxzy';
|
||||
$charsLength = strlen($chars);
|
||||
$cifcode = '';
|
||||
for ($i = 0; $i < 16; $i++) {
|
||||
$cifcode .= $chars[rand(0, $charsLength - 1)];
|
||||
}
|
||||
return $cifcode;
|
||||
}
|
||||
|
||||
public function getApiArray() {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
@@ -233,6 +254,8 @@ class Preorder extends mfBaseModel {
|
||||
|
||||
$a = [];
|
||||
$a['code'] = strtoupper($this->ucode);
|
||||
$a['cifcode'] = $this->cifcode;
|
||||
$a['cifurl'] = $this->cifurl;
|
||||
$a['oaid'] = $this->oaid;
|
||||
$a['extref'] = $this->extref;
|
||||
$a['status'] = $this->getProperty("status")->getApiArray();
|
||||
|
||||
Reference in New Issue
Block a user