public function end($type, $order_id) { parent::load('model', 'work'); parent::load('model', 'order'); import('system/share/network/redirect'); $smarty = parent::load('smarty'); $work = OrderWork::get_by_order($order_id, $type); $workflow = Workflow::get_by_alias($this->available_next_type[$type]); if (!$work) { $message = sprintf('此订单的 %s 工作还没开始', $type); HTTPRedirect::flash_to('order/list/' . $workflow->id, $message, $smarty); } $work->process = 100; $work->save(); Order::set_workflow($order_id, $workflow); $message = '此工作已经完成, 将转入下一工作流程'; HTTPRedirect::flash_to('order/list/' . $workflow->id, $message, $smarty); }
public function publish($order_id) { AuthPlugins::required($this, '售后经理'); $workflow = Workflow::get_by_alias('已经上线'); Order::set_workflow($order_id, $workflow); $message = '网站已成功上线, 订单流程完成'; HTTPRedirect::flash_to('order/list/' . $workflow->id, $message, $this->smarty); }
public function decide_programe($order_id) { $workflow = Workflow::get_by_alias('程序验收完成'); import('system/share/io/filesystem'); FileSystem::init(); $http_path = FileSystem::Upload($_FILES['attachment']); if (!$_FILES['attachment'] || !$http_path) { HTTPRedirect::flash_to('customer', '请您上传首页确认书的扫描件', $this->smarty, 'cus_flash_to'); } $order = Order::get_by_id($order_id); $order->programe_decide_attachment = $http_path; $order->save(); Order::set_workflow($order_id, $workflow); $smarty = parent::load('smarty'); import('system/share/network/redirect'); $message = '程序验收完成,等待客户付尾款即可上线'; $flash_to = $userinfo['role']['0']['alias'] == '技术经理' ? 'order/list/' . $workflow->id : 'customer'; $template = $userinfo['role']['0']['alias'] == '技术经理' ? 'flash_to' : 'cus_flash_to'; HTTPRedirect::flash_to($flash_to, $message, $smarty, $template); }
public function add_customer() { AuthPlugins::required($this, '客服'); $smarty = parent::load('smarty'); $smarty->assign('page_title', '新增订单'); if ($this->is_post()) { unset($_POST['CSRF_TOKEN']); unset($_POST['sub4']); $model = parent::load('model', 'order'); $time_str = sprintf('%s %s:%s', $_POST['subscribe_time'], $_POST['book_hour'], $_POST['book_minu']); $_POST['subscribe_time'] = date('Y-m-d H:i', strtotime($time_str)); try { $customer = new Customer(); $order = new Order(); foreach ($_POST as $k => $v) { if (isset($customer->{$k})) { $customer->{$k} = trim(htmlspecialchars($v)); } else { if (isset($order->{$k})) { $order->{$k} = trim(htmlspecialchars($v)); } } } /* * 客户提供资料 */ if ($_FILES['cus_docs']) { import('system/share/io/filesystem'); FileSystem::init(); $http_path = FileSystem::Upload($_FILES['cus_docs'], false); $customer->docs = $http_path; } /* * 保存客户信息 */ $customer->save(); /* * 取得工作流程ID(订单状态) */ $workflow = Workflow::get_by_alias('新增订单管理'); /* * 新建订单, 并写入当前的订单初始信息 */ $order->Customer = $customer; $order->Workflow = $workflow; /* * 客服 */ $order->CustomerService = User::current(); $order->save(); import('system/share/network/redirect'); $message = '订单信息录入成功, 转入新增订单管理页面'; /* * 清除订单列表缓存 */ // $smarty->clearCache('order/list'); $smarty->clearAllCache(); HTTPRedirect::flash_to($workflow['action'], $message, $smarty); } catch (Doctrine_Query_Exception $e) { $smarty->raise('system'); } } else { parent::load('form', 'NewCustomer'); $smarty->display('customer/add'); } }