From 1d5a5be5bf289d59920d8929fefdcba1b3bbdaa7 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 18 Mar 2016 10:21:28 +0100 Subject: [PATCH] fix detsta download, fix card move card update --- backend/models/GiroKotegForm.php | 4 ---- common/components/giro/GiroBase.php | 2 +- common/components/giro/GiroBeszed.php | 2 +- common/components/giro/GiroBeszedTetel.php | 1 + common/models/Customer.php | 6 ++++++ common/models/Log.php | 3 ++- frontend/models/ContractForm.php | 18 ++++++++++++++++++ frontend/views/contract/_make_contract.php | 2 ++ 8 files changed, 31 insertions(+), 7 deletions(-) diff --git a/backend/models/GiroKotegForm.php b/backend/models/GiroKotegForm.php index 4a2745c..0e103e6 100644 --- a/backend/models/GiroKotegForm.php +++ b/backend/models/GiroKotegForm.php @@ -142,11 +142,7 @@ class GiroKotegForm extends Model{ public static function transliterate($string) { -// if (static::hasIntl()) { -// return transliterator_transliterate(BaseInflector::$transliterator, $string); -// } else { return str_replace(array_keys(BaseInflector::$transliteration), BaseInflector::$transliteration, $string); -// } } /** diff --git a/common/components/giro/GiroBase.php b/common/components/giro/GiroBase.php index 60971c0..0e38a06 100644 --- a/common/components/giro/GiroBase.php +++ b/common/components/giro/GiroBase.php @@ -24,7 +24,7 @@ class GiroBase { $data = substr($data, 0, $hossz ); } $data = str_pad($data, $hossz, $pad_string, STR_PAD_RIGHT); - echo $data; + //echo $data; // echo strlen($data); return $data; } diff --git a/common/components/giro/GiroBeszed.php b/common/components/giro/GiroBeszed.php index a3e6681..bea78ad 100644 --- a/common/components/giro/GiroBeszed.php +++ b/common/components/giro/GiroBeszed.php @@ -71,7 +71,7 @@ class GiroBeszed extends GiroBase { $tetel->szamlaTulajdonosNeve = $customer->name; $tetel->kozlemeny = "Fitness berlet. Megbizas azon: " . $request->id_ticket_installment_request; - return $tetel->toString(); + return $tetel->toString(); } public static function createLab($requests) { diff --git a/common/components/giro/GiroBeszedTetel.php b/common/components/giro/GiroBeszedTetel.php index 002bee3..aab3250 100644 --- a/common/components/giro/GiroBeszedTetel.php +++ b/common/components/giro/GiroBeszedTetel.php @@ -2,6 +2,7 @@ namespace common\components\giro; use common\components\giro\GiroBase; +use yii\helpers\VarDumper; /** * @property common\components\giro\GiroUzenetsorszam $uzenetSorszam * @property common\components\giro\GiroBankszamla $kotelezettBankszamla diff --git a/common/models/Customer.php b/common/models/Customer.php index f4866b2..c029d65 100644 --- a/common/models/Customer.php +++ b/common/models/Customer.php @@ -186,6 +186,12 @@ class Customer extends BaseFitnessActiveRecord } + public function afterSave($insert, $changedAttributes){ + if ( !$insert ){ + Card::updateCardFlagTicket($this->id_customer_card); + } + } + } diff --git a/common/models/Log.php b/common/models/Log.php index 60de4f0..7d922fd 100644 --- a/common/models/Log.php +++ b/common/models/Log.php @@ -5,6 +5,7 @@ namespace common\models; use Yii; use yii\helpers\Url; use yii\helpers\VarDumper; +use common\models\BaseFitnessActiveRecord; /** * This is the model class for table "log". @@ -28,7 +29,7 @@ use yii\helpers\VarDumper; * @property string $created_at * @property string $updated_at */ -class Log extends \yii\db\ActiveRecord +class Log extends BaseFitnessActiveRecord { public static $TYPE_INFO = 10; diff --git a/frontend/models/ContractForm.php b/frontend/models/ContractForm.php index 156cf8c..791ac06 100644 --- a/frontend/models/ContractForm.php +++ b/frontend/models/ContractForm.php @@ -90,6 +90,12 @@ class ContractForm extends Model { 'string', 'max' => 24 ], + [ + [ + 'bank_account' + ], + 'validateBankAccount', + ], [ [ 'bank_name' @@ -132,6 +138,18 @@ class ContractForm extends Model { [[ 'started_at', ], 'date', 'format' =>Yii::$app->formatter->dateFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ,'timeZone' => 'UTC' ], ]; } + + public function validateBankAccount($attribute, $params) { + if ( !is_numeric($this->bank_account)){ + $this->addError( $attribute, "A bankszámlaszám csak számokat tartalmazhat!"); + }else{ + if ( !( strlen($this->bank_account) == 16 || strlen($this->bank_account) == 24 ) ){ + $this->addError($attribute,"Bankszámlaszám 16 vagy 24 hosszú!"); + } + } + } + + public function validateTicketType($attribute, $params) { $this->ticketType = TicketType::findOne ( $this->ticket_type ); if (! isset ( $this->ticketType )) { diff --git a/frontend/views/contract/_make_contract.php b/frontend/views/contract/_make_contract.php index c157be7..0d45fba 100644 --- a/frontend/views/contract/_make_contract.php +++ b/frontend/views/contract/_make_contract.php @@ -9,6 +9,7 @@ use kartik\widgets\DatePicker; use common\models\Transfer; use common\models\Discount; use frontend\assets\ContractMakeAsset; +use yii\helpers\VarDumper; /* @var $this yii\web\View */ /* @var $model common\models\Contract */ @@ -38,6 +39,7 @@ use frontend\assets\ContractMakeAsset; $this->registerJs(' contract_make.init( '. json_encode($options) .' );'); + ?>

Szerződés létrehozása