Started cpe shipping
This commit is contained in:
@@ -3,4 +3,50 @@
|
||||
class Cpeprovisioning extends mfBaseModel {
|
||||
protected $forcestr = ["wifi_ssid", "wifi_pass"];
|
||||
|
||||
private $order;
|
||||
private $orderproduct;
|
||||
private $termination;
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "cpeprovisioning") {
|
||||
$this->cpeprovisioning = CpeprovisioningModel::getFirst(["orderproduct_id" => $this->id]);
|
||||
return $this->cpeprovisioning;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
if($this->id) {
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
if($this->id) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
if($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class CpeprovisioningController extends mfBaseController {
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin", "salespartner"])) {
|
||||
if(!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +155,24 @@ class CpeprovisioningModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("shipping", $filter)) {
|
||||
$shipping = $filter['shipping'];
|
||||
if($shipping) {
|
||||
$where .= " AND shipping=1";
|
||||
} else {
|
||||
$where .= " AND shipping=0";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("shipped", $filter)) {
|
||||
$shipped = $filter['shipped'];
|
||||
if($shipped) {
|
||||
$where .= " AND shipped=1";
|
||||
} else {
|
||||
$where .= " AND shipped=0";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
34
application/Cpeshipping/CpeshippingController.php
Normal file
34
application/Cpeshipping/CpeshippingController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class CpeshippingController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("Cpeshipping/Index");
|
||||
$provisions = CpeprovisioningModel::search(["shipping" => 1, "shipped" => 0]);
|
||||
|
||||
$this->layout()->set("cpeprovisionings", $provisions);
|
||||
|
||||
}
|
||||
|
||||
protected function shipAction() {
|
||||
$this->redirect("Cpeshipping");
|
||||
$r = $this->request;
|
||||
|
||||
/*if($r->ships) {
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user