public function actionAdd()
 {
     $shipping_id = (int) \yii::$app->request->get('shipping', 0);
     $sql = "SELECT shipping_name,shipping_code FROM " . Shipping::tableName() . " WHERE id={$shipping_id}";
     $shipping = \yii::$app->getDb()->createCommand($sql)->queryOne();
     $set_modules = 1;
     include_once \yii::getAlias('@ext') . '/shipping/' . $shipping['shipping_code'] . '.php';
     $fields = [];
     foreach ($modules[0]['configure'] as $key => $val) {
         $fields[$key]['name'] = $val['name'];
         $fields[$key]['value'] = $val['value'];
         $fields[$key]['label'] = \yii::t('shipping', $val['name']);
     }
     $count = count($fields);
     $fields[$count]['name'] = "freee_money";
     $fields[$count]['value'] = "0";
     $fields[$count]['label'] = \yii::t('shipping', 'free_money');
     //如果支持货到付款,则允许设置货到付款支付费用
     if ($modules[0]['cod']) {
         $count++;
         $fields[$count]['name'] = "pay_fee";
         $fields[$count]['value'] = "0";
         $fields[$count]['label'] = \yii::t('shipping', 'pay_fee');
     }
     $shipping_area['shipping_id'] = 0;
     $shipping_area['free_money'] = 0;
     return $this->render('shipping_area_info', ['shipping_area' => ['shipping_id' => $shipping_id, 'shipping_code' => $shipping['shipping_code']], 'fields' => $fields, 'form_action' => 'insert']);
 }
Exemple #2
0
 /**
  * 记录管理员的操作内容
  *
  * @access  public
  * @param   string      $sn         数据的唯一值
  * @param   string      $action     操作的类型
  * @param   string      $content    操作的内容
  * @return  void
  */
 public static function admin_log($sn = '', $action, $content)
 {
     $log_info = \yii::t('log', $action) . \yii::t('log', $content) . ":" . Html::encode($sn);
     $time = time();
     $sql = "INSERT INTO " . self::tableName() . " (log_time,user_id,log_info,ip_address) " . " VALUES ('{$time}','" . \yii::$app->user->id . "','" . Html::encode($log_info) . "','" . \yii::$app->request->userIP . "')";
     return \yii::$app->getDb()->createCommand($sql)->execute();
 }
 public function actionUpdate()
 {
     $pictures = array();
     $lid = Yii::app()->request->getParam('lid');
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     $criteria = new CDbCriteria();
     $criteria->with = 'productImg';
     $criteria->addCondition('t.lid=:lid and t.dpid=:dpid and t.delete_flag=0 ');
     $criteria->order = ' t.lid desc ';
     $criteria->params[':lid'] = $lid;
     $criteria->params[':dpid'] = $this->companyId;
     $model = Product::model()->find($criteria);
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('productImg');
         if (ProductPicture::saveImg($this->companyId, $lid, $postData)) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('productImg/index', 'companyId' => $this->companyId));
         }
     }
     if (!empty($model->productImg)) {
         foreach ($model->productImg as $pic) {
             array_push($pictures, $pic->pic_path);
         }
     }
     $this->render('updateProductImg', array('model' => $model, 'pictures' => $pictures));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $pageSize = Yii::app()->request->getParam('pageSize', Yii::app()->params['pageSize']);
     Yii::app()->user->setState('pageSize', $pageSize);
     $model = new RejectModel('search');
     $model->unsetAttributes();
     // clear any default values
     //lay mang phone
     $phone = Yii::app()->request->getParam('phone');
     $phoneModel = RejectModel::model()->findByAttributes(array('phone' => $phone));
     if (empty($phoneModel)) {
         $model = new RejectModel();
         $model->phone = $phone;
         try {
             if ($model->save()) {
                 $message = yii::t('SpamModule', 'Success!');
             } else {
                 $message = yii::t('SpamModule', 'Insert fail');
             }
         } catch (Exception $exc) {
             echo $exc->getTrace();
         }
     } else {
         $message = yii::t('SpamModule', 'The number had exists');
     }
     echo $message;
 }
 public function actionIndex()
 {
     $type = CHtml::encode(Yii::app()->request->getParam('type', 'HOT'));
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = Yii::app()->params['numberSongPerPage'];
     if ($this->layout == 'application.views.wap.layouts.main') {
         $limit = Yii::app()->params['numberSongPerPageWap'];
     }
     $count_hot = WapSongModel::countListByCollection('SONG_HOT');
     $songs = WapSongModel::getListByCollection('SONG_HOT', $page, $limit);
     $pager = new CPagination($count_hot);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $count_new = WapSongModel::countListByCollection('SONG_NEW');
     $songs_new = WapSongModel::getListByCollection('SONG_NEW', $page, $limit);
     $arr_songs = array(array('headerText' => yii::t('wap', 'BÀI HÁT HOT'), 'song' => $songs, 'link' => 'song/list?type=HOT'), array('headerText' => yii::t('wap', 'BÀI HÁT MỚI'), 'song' => $songs_new, 'link' => 'song/list?type=NEW'));
     $callBackLink = Yii::app()->createUrl("song/index", array('type' => $type));
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('songs', 'pager', 'callBackLink', 'options'));
     } else {
         $userPlaylist = array();
         if ($this->userPhone) {
             $userPlaylist = WapPlaylistModel::model()->getPlaylistByPhone($this->userPhone, $limit, $page);
         }
         $this->render("index", compact('arr_songs', 'pager', 'callBackLink', 'userPlaylist'));
     }
 }
Exemple #6
0
 /**
  * User login
  */
 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $userDriver = isset(\Yii::$app->params['user_driver']) == true && empty(\Yii::$app->params['user_driver']) == false ? strtolower(\Yii::$app->params['user_driver']) : 'local';
     if ($userDriver == 'ldap') {
         if (isset(\Yii::$app->params['ldap']) == false) {
             throw new \Exception(yii::t('walle', 'the login dirver configs does not defined', array('loginType' => \Yii::$app->params['user_driver'])));
         }
         if (is_array(\Yii::$app->params['ldap']) == false) {
             throw new \Exception(yii::t('walle', 'the login dirver configs parse error', array('loginType' => \Yii::$app->params['user_driver'])));
         }
         $model = new LdapLoginForm(\Yii::$app->params['ldap']);
         if ($model->load(Yii::$app->request->post()) && $model->login()) {
             return $this->goBack();
         } else {
             return $this->render('login', ['isLdapLigin' => true, 'model' => $model]);
         }
     } elseif ($userDriver == 'local') {
         $model = new LoginForm();
         if ($model->load(Yii::$app->request->post()) && $model->login()) {
             return $this->goBack();
         } else {
             return $this->render('login', ['isLdapLigin' => false, 'model' => $model]);
         }
     } else {
         throw new \Exception(yii::t('walle', 'login type could not support', array('loginType' => \Yii::$app->params['user_driver'])));
     }
 }
 public function renderHtmlInput($input_type_id, $options = [])
 {
     $field = $options['prefix_text'] . " ";
     switch ($input_type_id) {
         case Types::$input_type['small_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', ['style' => 'width:60px']);
             break;
         case Types::$input_type['med_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', []);
             break;
         case Types::$input_type['large_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', ['style' => 'width:240px']);
             break;
         case Types::$input_type['date']['id']:
             $field = sprintf('');
             break;
         case Types::$input_type['radio']['id']:
             // Enable tristate behavior with custom indeterminate value, custom toggle icon, and a custom label for the indeterminate state.
             $options['tristate_option_id'] == Types::$boolean['true']['id'] ? $tristate = true : ($tristate = false);
             $field = Html::radioList(sprintf('question_%s', $options['screening_question_id']), Types::$boolean['null']['id'], [Types::$boolean['true']['description'] => Types::$boolean['true']['description'], Types::$boolean['false']['description'] => Types::$boolean['false']['description']], ['unselect' => Types::$boolean['null']['description'], 'separator' => '   ']);
             break;
         case Types::$input_type['text_agreement']['id']:
         case Types::$input_type['text_agreement']['id']:
             $field = Html::radioList(sprintf('question_%s', $options['screening_question_id']), Types::$boolean['null']['id'], [yii::t('app', 'Agree') => yii::t('app', 'Agree'), yii::t('app', 'Disagree') => yii::t('app', 'Disagree')], ['unselect' => Types::$boolean['null']['description'], 'separator' => '   ']);
             break;
             break;
         case Types::$input_type['image_overlay']['id']:
             $field = sprintf('image overlay');
             break;
     }
     $field .= " " . $options['suffix_text'];
     return $field;
 }
 /**
  * Validates the password.
  * This method serves as the inline validation for password.
  *
  * @param string $attribute the attribute currently being validated
  * @param array $params the additional name-value pairs given in the rule
  */
 public function validatePassword($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $user = $this->getUser();
         if (!$user || !$user->validatePassword($this->password)) {
             $this->addError($attribute, yii::t('adminlte', 'Incorrect username or password.'));
         }
     }
 }
Exemple #9
0
 /**
  * 检查货币是否符合规范
  * @param $data 需要检查的字符串 (此值用传址格式传递,当其格式误差不大时会将其修改为货币格式)
  * @param $name 错误提示名
  * @return 成功返回转换后的字符串,否则返回false
  */
 static function moneySingle(&$data = null, $name = 'data')
 {
     if (empty($data)) {
         throw new BeubeuException($name . yii::t('public', "为空"), BeubeuException::FIELD_EMPTY);
     }
     if (!is_numeric($data)) {
         throw new BeubeuException($name . Yii::t('public', '格式不正确'), BeubeuException::FIELD_FORMAT);
     } else {
         $data = number_format($data, 2);
     }
 }
Exemple #10
0
 public static function getRevision($conf)
 {
     switch ($conf->repo_type) {
         case Project::REPO_GIT:
             return new Git($conf);
         case Project::REPO_SVN:
             return new Svn($conf);
         default:
             throw new \Exception(\yii::t('walle', 'unknown scm'));
             break;
     }
 }
Exemple #11
0
 /**
  * Validates the password.
  * This method serves as the inline validation for password.
  */
 public function validatePassword()
 {
     if (!$this->hasErrors()) {
         $user = $this->getUser();
         if (!$user) {
             return $this->addError('password', yii::t('user', 'inactive or ban'));
         }
         if (!$user->validatePassword($this->password)) {
             return $this->addError('password', yii::t('user', 'password error'));
         }
     }
 }
 public function init()
 {
     parent::init();
     if (empty($this->secret)) {
         if (!\yii::$app->has("recaptcha") || empty(\yii::$app->recaptcha->secret)) {
             throw new \yii\base\InvalidConfigException("`secret` param is required");
         }
         $this->secret = \yii::$app->recaptcha->secret;
     }
     if ($this->message === null) {
         $this->message = \yii::t("yii", "The verification code is incorrect.");
     }
 }
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', yii::t('adminlte', 'Thank you for contacting us. We will respond to you as soon as possible.'));
         } else {
             Yii::$app->session->setFlash('error', yii::t('adminlte', 'There was an error sending email.'));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
 /**
  * Connects to our database
  */
 public function connect()
 {
     if (!extension_loaded('mongo')) {
         throw new EMongoException(yii::t('yii', 'We could not find the MongoDB extension ( http://php.net/manual/en/mongo.installation.php ), please install it'));
     }
     try {
         $this->_mongo = new MongoClient($this->connectionString, $this->connectOptions);
         $dbname = $this->db;
         $this->_db = $this->_mongo->{$dbname};
         $this->_db->setWriteConcern($this->options['writeConcerns'], $this->options['wTimeoutMS']);
     } catch (Exception $e) {
         throw new EMongoException(yii::t('yii', 'We could not find the MongoDB extension ( http://php.net/manual/en/mongo.installation.php ), please install it'));
     }
 }
 public function getSelecter($categoryTree)
 {
     $selecter = '';
     for ($i = 0, $count = count($categoryTree); $i < $count - 1; $i++) {
         $categoties = Helper::getCategories($this->companyId, $categoryTree[$i]);
         $selecter .= '<select class="form-control category_selecter" tabindex="-1" name="category_id_selecter">';
         $selecter .= yii::t('app', '<option value="">--请选择--</option>');
         foreach ($categoties as $c) {
             $selecter .= '<option value="' . $c['lid'] . '" ' . (in_array($c['lid'], $categoryTree) ? 'selected' : '') . '>' . $c['category_name'] . '</option>';
         }
         $selecter .= '</select>';
     }
     return $selecter;
 }
 public function actionUpdate()
 {
     $lid = Yii::app()->request->getParam('lid');
     $dpid = Yii::app()->request->getParam('companyId');
     $model = Floor::model()->find('t.lid=:lid and t.dpid=:dpid', array(':lid' => $lid, ':dpid' => $dpid));
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = Yii::app()->request->getPost('Floor');
         $model->update_at = date('Y-m-d H:i:s', time());
         if ($model->save()) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('floor/index', 'companyId' => $this->companyId));
         }
     }
     $this->render('update', array('model' => $model));
 }
Exemple #17
0
 public function filterWechat($filterChain)
 {
     if (Assist::isWeixin()) {
         // if(!Yii::app()->session['wechat']) {
         // 	if(!strpos(Yii::app()->request->getPathInfo(), 'wechatconnect')){
         // 		$this->redirect('/wechat/wechatconnect');
         // 		return false;
         // 	}
         // }
         $filterChain->run();
         return true;
     } else {
         // echo 'ERROR';
         $this->layout = '//layouts/error';
         $this->render('/site/error', array('code' => 403, 'message' => yii::t('yii', 'Only login in wechat')));
     }
 }
 public static function getSetlist($companyId)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 't.delete_flag=0 and t.dpid=' . $companyId;
     $criteria->order = ' t.lid asc ';
     $models = ProductSet::model()->findAll($criteria);
     //return CHtml::listData($models, 'lid', 'category_name','pid');
     //$options = array();
     $options = array(yii::t('app', '--请选择分类--'));
     if ($models) {
         foreach ($models as $model) {
             $options[$model->lid] = $model->set_name;
         }
         //var_dump($options);exit;
     }
     return $options;
 }
 public function actionUpdate()
 {
     $id = Yii::app()->request->getParam('id');
     $model = Department::model()->findByPk($id);
     if (Yii::app()->request->isPostRequest) {
         Until::isUpdateValid(array($id), $this->companyId, $this);
         //0,表示企业任何时候都在云端更新。
         $model->attributes = Yii::app()->request->getPost('Department');
         $model->update_at = date('Y-m-d H:i:s', time());
         if ($model->save()) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('department/index', 'companyId' => $this->companyId));
         }
     }
     $printers = $this->getPrinterList();
     $this->render('update', array('model' => $model, 'printers' => $printers));
 }
 public function actionRefund()
 {
     $begin_time = Yii::app()->request->getParam('begin_time', date('Y-m-d', time()));
     $end_time = Yii::app()->request->getParam('end_time', date('Y-m-d', time()));
     $orderId = Yii::app()->request->getParam('orderID');
     $model = new OrderPay();
     //新建数据库表!!!
     $model->dpid = $this->companyId;
     $order = Order::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $orderId, ':dpid' => $this->companyId));
     if (!$order) {
         Yii::app()->user->setFlash('error', yii::t('app', '无法查询到该订单!'));
         $this->redirect(array('orderManagement/paymentRecord', 'companyId' => $this->companyId, 'begin_time' => $begin_time, 'end_time' => $end_time));
     }
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('OrderPay');
         $model->attributes = $postData;
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $pay_amount = -abs($postData['pay_amount']);
             $order->reality_total = $order->reality_total + $pay_amount;
             if ($order->reality_total < 0) {
                 Yii::app()->user->setFlash('success', yii::t('app', '退款失败,退款金额大于订单金额!'));
                 $this->redirect(array('orderManagement/paymentRecord', 'companyId' => $this->companyId, 'begin_time' => $begin_time, 'end_time' => $end_time));
             }
             $order->update();
             $model->pay_amount = $pay_amount;
             $se = new Sequence("order_pay");
             $model->lid = $se->nextval();
             $model->create_at = date('Y-m-d H:i:s', time());
             $model->update_at = date('Y-m-d H:i:s', time());
             if ($model->save()) {
                 Yii::app()->user->setFlash('success', yii::t('app', '退款成功'));
             }
             $transaction->commit();
             //提交事务会真正的执行数据库操作
             $this->redirect(array('orderManagement/paymentRecord', 'companyId' => $this->companyId, 'begin_time' => $begin_time, 'end_time' => $end_time));
         } catch (Exception $e) {
             $transaction->rollback();
             //如果操作失败, 数据回滚
             Yii::app()->user->setFlash('error', yii::t('app', '退款失败'));
         }
     }
     $this->render('refund', array('model' => $model, 'order' => $order, 'orderId' => $orderId, 'begin_time' => $begin_time, 'end_time' => $end_time));
 }
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $ids = Yii::app()->request->getPost('ids');
     Until::isUpdateValid($ids, $companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (!empty($ids)) {
         foreach ($ids as $id) {
             $model = PaymentMethod::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId));
             if ($model) {
                 $model->delete();
             }
         }
         $this->redirect(array('payMethod/index', 'companyId' => $companyId));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('payMethod/index', 'companyId' => $companyId));
     }
 }
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $ids = Yii::app()->request->getPost('ids');
     Until::isUpdateValid($ids, $this->companyId, $this);
     if (!empty($ids)) {
         foreach ($ids as $id) {
             $model = CompanyWifi::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId));
             if ($model) {
                 $model->update_at = date('Y-m-d H:i:s');
                 $model->delete();
             }
         }
         $this->redirect(array('companyWifi/index', 'companyId' => $companyId));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('companyWifi/index', 'companyId' => $companyId));
     }
 }
 public function actionSearch($project_id)
 {
     if ($this->getScreeningSession('subject_hash') !== null) {
         $this->redirect('index');
     }
     if (!\Yii::$app->ProjectComponent->canUse($project_id)) {
         throw new \yii\web\HttpException(403, yii::t('app', 'No permission to access page.'));
     }
     if (!\yii::$app->ScreeningForm->canUse($this->getScreeningSession('screening_form_id'))) {
         throw new \yii\web\HttpException(403, yii::t('app', 'No permission to access page.'));
     }
     if (!\yii::$app->ResourceComponent->canUse($this->getScreeningSession('resource_id'))) {
         throw new \yii\web\HttpException(403, yii::t('app', 'No permission to access page.'));
     }
     $this->setScreeningSession('project_id', $project_id);
     $searchModel = new SubjectScreeningSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('search', ['model' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Exemple #24
0
 public function event()
 {
     Yii::$app->on(\yii\base\Application::EVENT_BEFORE_ACTION, function ($event) {
         $aid = $event->action->id;
         $cid = $event->action->controller->id;
         if (Yii::$app->user->id) {
             return true;
         }
         if ($cid == 'site') {
             return true;
         }
         if (!Yii::$app->request->getIsAjax()) {
             Yii::$app->response->redirect('site/login');
             Yii::$app->end();
         }
         $event->isValid = false;
         throw new \Exception(yii::t('w', 'need login'));
     });
 }
Exemple #25
0
 /**
  * Logs in the user using the given username and password in the model.
  * @return boolean whether login is successful
  */
 public function login()
 {
     if ($this->_identity === null) {
         $this->_identity = new UserIdentity($this->username, $this->password);
         $this->_identity->authenticate();
     }
     if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) {
         $duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
         // 30 days
         if (Yii::app()->user->login($this->_identity, $duration)) {
             return true;
         } else {
             Yii::app()->user->setFlash('error', yii::t('app', '对不起,你没有权限登陆'));
             return false;
         }
     } else {
         return false;
     }
 }
 public function actionDelete()
 {
     $companyId = Helper::getCompanyId(Yii::app()->request->getParam('companyId'));
     $ids = Yii::app()->request->getPost('lid');
     Until::isUpdateValid($ids, $companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (!empty($ids)) {
         foreach ($ids as $id) {
             $model = Retreat::model()->find('lid=:id and dpid=:companyId', array(':id' => $id, ':companyId' => $companyId));
             if ($model) {
                 $model->saveAttributes(array('delete_flag' => 1, 'update_at' => date('Y-m-d H:i:s', time())));
             }
         }
         $this->redirect(array('retreat/index', 'companyId' => $companyId));
     } else {
         Yii::app()->user->setFlash('error', yii::t('app', '请选择要删除的项目'));
         $this->redirect(array('retreat/index', 'companyId' => $companyId));
     }
 }
 public function actionUpdate()
 {
     $dpid = Helper::getCompanyId(Yii::app()->request->getParam('dpid'));
     $model = Company::model()->find('dpid=:companyId', array(':companyId' => $dpid));
     if (Yii::app()->request->isPostRequest) {
         Until::isUpdateValid(array(0), $this->companyId, $this);
         //0,表示企业任何时候都在云端更新。
         $model->attributes = Yii::app()->request->getPost('Company');
         $model->update_at = date('Y-m-d H:i:s', time());
         //var_dump($model->attributes);exit;
         if ($model->save()) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('company/index', 'companyId' => $this->companyId));
         } else {
             Yii::app()->user->setFlash('error', yii::t('app', '修改失败'));
         }
     }
     $printers = $this->getPrinterList();
     return $this->render('update', array('model' => $model, 'printers' => $printers, 'companyId' => $this->companyId));
 }
Exemple #28
0
 /**
  * @inheritdoc
  */
 public function getTitle()
 {
     switch ($this->key) {
         case self::KEY_NUEVO_PEDIDO:
             $pedido = ProyectoPedido::findOne($this->key_id);
             return Yii::t('app', 'Nuevo pedido/requerimiento');
             break;
         case self::KEY_NUEVO_PEDIDO_ACC:
             $pedido = AccioncentralizadaPedido::findOne($this->key_id);
             return Yii::t('app', 'Nuevo Requerimiento Central');
             break;
         case self::KEY_PEDIDO_ACC_APROBADO:
             $acc_uej = AcEspUej::findOne($this->key_id);
             $pedido = $acc_uej->nombreunidadejecutora;
             return yii::t('app', 'Aprobación De Requerimientos');
             break;
         case self::KEY_FEEDBACK:
             return yii::t('app', 'Observacion Proyecto');
             break;
     }
 }
 public function actionUpdate()
 {
     $printerway = array();
     $lid = Yii::app()->request->getParam('lid');
     $model = Product::model()->find('lid=:lid and dpid=:dpid', array(':lid' => $lid, ':dpid' => $this->companyId));
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('ProductPrinterway');
         //$model->printer_way_id = $postData;
         if (ProductPrinterway::saveProductPrinterway($this->companyId, $lid, $postData)) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('productPrinter/index', 'companyId' => $this->companyId));
         }
     }
     $printerWays = PrinterWay::getPrinterWay($this->companyId);
     $productPrinterway = ProductPrinterway::getProductPrinterWay($lid, $this->companyId);
     foreach ($productPrinterway as $ppw) {
         array_push($printerway, $ppw['printer_way_id']);
     }
     $this->render('updateProductPrinter', array('model' => $model, 'printerWays' => $printerWays, 'printerway' => $printerway));
 }
 public function actionUpdate()
 {
     $id = Yii::app()->request->getParam('id');
     $order = Order::model()->with('company')->find('order_id=:id', array(':id' => $id));
     $siteNo = SiteNo::model()->findByPk($order->site_no_id);
     $orderProducts = OrderProduct::getOrderProducts($order->order_id);
     $productTotal = OrderProduct::getTotal($order->order_id);
     $total = Helper::calOrderConsume($order, $productTotal);
     if (Yii::app()->request->isPostRequest) {
         $order->attributes = Yii::app()->request->getPost('Order');
         if ($order->order_status) {
             $siteNo->delete_flag = 1;
             $order->pay_time = time();
         }
         $transaction = Yii::app()->db->beginTransaction();
         try {
             if ($order->save()) {
                 if ($order->order_status) {
                     $siteNo->save();
                     Yii::app()->db->createCommand('delete from nb_cart where company_id=:companyId and code=:code')->bindValue(':companyId', $this->companyId)->bindValue(':code', $siteNo->code)->execute();
                     $status = Helper::printList($order);
                 }
                 if (!$status['status']) {
                     Yii::app()->user->setFlash('error', $status['msg']);
                     throw new CException(yii::t('app', '请选择打印机'));
                 } else {
                     Yii::app()->user->setFlash('success', yii::t('app', '结单成功'));
                 }
             }
             $transaction->commit();
             $this->redirect(array('order/index', 'companyId' => $this->companyId));
         } catch (Exception $e) {
             $transaction->rollback();
         }
     }
     $paymentMethods = $this->getPaymentMethodList();
     $this->render('update', array('model' => $order, 'orderProducts' => $orderProducts, 'productTotal' => $productTotal, 'total' => $total, 'paymentMethods' => $paymentMethods));
 }