From 94c3a17075f34d4bcb5762a606d506569d548819 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Mon, 4 Jan 2016 08:58:44 +0100 Subject: [PATCH] =?UTF-8?q?replace=20on=20cardsaving=20=C3=B6=20to=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/CardController.php | 3 ++- changelog.txt | 3 +++ common/models/Card.php | 9 ++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/controllers/CardController.php b/backend/controllers/CardController.php index c06d8a4..07409dc 100644 --- a/backend/controllers/CardController.php +++ b/backend/controllers/CardController.php @@ -99,7 +99,8 @@ class CardController extends \backend\controllers\BackendController $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id_card]); + return $this->redirect(['index']); +// return $this->redirect(Yii::$app->request->referrer); } else { return $this->render('update', [ 'model' => $model, diff --git a/changelog.txt b/changelog.txt index e73125e..d5e73ee 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +-0.0.15 + - backend on card saving replace ö to 0 + - backend on card saving redirect to index -0.0.14 - add hidden account - add cart payout/delete per row diff --git a/common/models/Card.php b/common/models/Card.php index 09e1af7..42f4016 100644 --- a/common/models/Card.php +++ b/common/models/Card.php @@ -43,7 +43,8 @@ class Card extends \common\models\BaseFitnessActiveRecord [['status', 'type'], 'integer'], [['number'], 'string', 'max' => 20], [['rfid_key'], 'string', 'max' => 25], - [['number'], 'unique' ] + [['number'], 'unique' ], + [['rfid_key','number'] , 'validateAscii'] ]; } @@ -64,6 +65,12 @@ class Card extends \common\models\BaseFitnessActiveRecord } + public function validateAscii($attribute,$params){ + if ( !$this->hasErrors($this->$attribute)){ + $this->$attribute = str_replace("ö", "0", $this->$attribute); + } + } + static function statuses() { return [ self::STATUS_ACTIVE => Yii::t('common/card', 'Active'),