Beispiel #1
0
 public function doCreateSubmit()
 {
     $ordersService = new OrdersService();
     $ordersVo = Request::getValue("orders", "OrdersValue");
     $ordersAssign = Request::get('orders_assign');
     if (count($ordersAssign) > 0) {
         $ordersVo->assign = implode(',', $ordersAssign);
     } else {
         $ordersVo->assign = '';
     }
     $ordersVo->addtime = date("Y-m-d H:i:s");
     $ordersVo->user_id = $_SESSION['user_id'];
     $ordersVo->status = Value::STATUS_NOT_SEE;
     $ordersVo->operate_status = Value::OPERATE_STATUS_NOT_OPERATE;
     $ordersVo->contact_status = Value::CONTACT_STATUS_NOT_CONTACT;
     //var_dump($ordersVo);exit;
     if ($ordersVo->mobile == '' and $ordersVo->telephone == '') {
         //如果同时为空
         Errors::addError('手机和电话至少要填一个', 'MOBILE');
         $flag_mobile = true;
     }
     if (!$ordersVo->checkOptions($ordersVo->getCreateOptions()) or $flag_mobile) {
         $projectService = new ProjectService();
         $projectlist = $projectService->getList(new ProjectValue());
         $areaService = new AreaService();
         $arealist = $areaService->getList(new AreaValue());
         View::set("Arealist", $arealist);
         View::set("Projectlist", $projectlist);
         View::set("OrdersCreateValue", $ordersVo);
         View::display("Create");
         return;
     }
     $ordersVo = $ordersService->create($ordersVo);
     Zee::redirect(Zee::url("orders", "list"));
 }