예제 #1
3
 /**
  *
  * @param \yii\web\Application $app
  * @param array                $config
  */
 protected function initialize($app, $config)
 {
     if ($app instanceof \yii\web\Application) {
         $app->attachBehaviors([hooks\TransferNoticeHook::className() => hooks\TransferNoticeHook::className()]);
         AppHelper::registerAccessHandler(models\Transfer::className(), AccessHandler::className());
         AppHelper::registerAccessHandler(models\TransferNotice::className(), AccessHandler::className());
     }
 }
예제 #2
0
 public function search($params)
 {
     $query = TransferModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_transfer' => $this->id_transfer, 'id_warehouse_source' => $this->id_warehouse_source, 'id_warehouse_dest' => $this->id_warehouse_dest, 'transfer_date' => $this->transfer_date, 'receive_date' => $this->receive_date, 'status' => $this->status, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'transfer_num', $this->transfer_num])->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]);
     return $dataProvider;
 }
예제 #3
0
 protected function checkAction($user, $action, $model)
 {
     $class = get_class($model);
     switch ($class) {
         case Transfer::className():
             switch ($action) {
                 case 'issue':
                     if ($model->status >= Transfer::STATUS_ISSUE) {
                         return false;
                     }
                     break;
                 default:
                     return true;
                     break;
             }
             break;
         default:
             break;
     }
     return true;
 }
예제 #4
0
 public static function modelClass()
 {
     return MTransfer::className();
 }
예제 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdTransfer()
 {
     return $this->hasOne(Transfer::className(), ['id_transfer' => 'id_transfer']);
 }
 /**
  * Finds the Transfer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param  integer               $id
  * @return Transfer              the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Transfer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }