Added Borderpoint status to Preorder
This commit is contained in:
@@ -939,7 +939,7 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
|
||||
$prices_return = [
|
||||
"oaid" => $oaid,
|
||||
"enduser_setup_price_net" => (float)$prices["enduser_setup"]->price_setup,
|
||||
"enduser_setup_price_net" => round((float)$prices["enduser_setup"]->price_setup, 2),
|
||||
"enduser_setup_price_gross" => round((float)$prices["enduser_setup"]->price_setup * 1.2, 2),
|
||||
"enduser_setup_info" => $prices["enduser_setup"]->description,
|
||||
"enduser_setup_is_discount" => ($prices["enduser_setup"]->end_date) ? true : false,
|
||||
|
||||
@@ -42,15 +42,6 @@ class Building extends mfBaseModel {
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function afterSave() {
|
||||
if($this->in_after_save) return true;
|
||||
$this->in_after_save++;
|
||||
|
||||
$this->resetProperties();
|
||||
|
||||
$this->in_after_save--;
|
||||
}
|
||||
|
||||
public function resetProperties() {
|
||||
$this->network = null;
|
||||
$this->pop = null;
|
||||
|
||||
@@ -305,6 +305,8 @@ class PreorderController extends mfBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($new_filter);exit;
|
||||
|
||||
return $new_filter;
|
||||
}
|
||||
|
||||
@@ -1066,6 +1068,9 @@ class PreorderController extends mfBaseController {
|
||||
case "addWorkorderRemark":
|
||||
$return = $this->addWorkorderRemarkApi();
|
||||
break;
|
||||
case "saveBorderpointStatus":
|
||||
$return = $this->saveBorderpointStatusApi();
|
||||
break;
|
||||
case "saveOrderdate":
|
||||
$return = $this->saveOrderdateApi();
|
||||
break;
|
||||
@@ -1083,9 +1088,38 @@ class PreorderController extends mfBaseController {
|
||||
$data = ["status" => "error"];
|
||||
$this->returnJson($data);
|
||||
}
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
|
||||
if(mfResponse::isResponse($return)) {
|
||||
$this->returnJson($return);
|
||||
} else {
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveBorderpointStatusApi() {
|
||||
$preorder_id = $this->request->preorder_id;
|
||||
$status_type = $this->request->status_type;
|
||||
$value = $this->request->value;
|
||||
|
||||
$preorder = new Preorder($preorder_id);
|
||||
if(!$preorder->id) {
|
||||
return mfResponse::NotFound(["message" => "Preorder not found"]);
|
||||
}
|
||||
|
||||
if(!$value) {
|
||||
$preorder->update(["borderpoint_status" => null]);
|
||||
} else {
|
||||
$preorder->update(["borderpoint_status" => $status_type]);
|
||||
}
|
||||
|
||||
$this->log->debug(__METHOD__.": $preorder_id - borderpoint status updated to $status_type");
|
||||
$preorder->save();
|
||||
|
||||
return mfResponse::Ok();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function getFCPsForCampaignApi(): array {
|
||||
|
||||
@@ -35,6 +35,7 @@ class PreorderModel
|
||||
public $accept_marketing;
|
||||
public $accept_withdrawal;
|
||||
public $accept_digging;
|
||||
public $borderpoint_status;
|
||||
public $contact_type;
|
||||
public $company;
|
||||
public $uid;
|
||||
@@ -566,8 +567,6 @@ class PreorderModel
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
|
||||
if (array_key_exists("deleted", $filter)) {
|
||||
$deleted = $filter['deleted'];
|
||||
if ($deleted === null || $deleted === false) {
|
||||
@@ -685,6 +684,14 @@ class PreorderModel
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists("borderpoint_status", $filter)) {
|
||||
$borderpoint_status = FronkDB::singleton()->escape($filter['borderpoint_status']);
|
||||
if ($borderpoint_status) {
|
||||
$where .= " AND tt_preorder.borderpoint_status='$borderpoint_status'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists("preordercampaign_id", $filter)) {
|
||||
$preordercampaign_id = $filter['preordercampaign_id'];
|
||||
if (is_numeric($preordercampaign_id)) {
|
||||
|
||||
Reference in New Issue
Block a user