merge app api
This commit is contained in:
@@ -34,6 +34,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
const TYPE_BARCODE = 30;
|
||||
const TYPE_OLD = 40;
|
||||
const TYPE_EMPLOYEE = 50;
|
||||
const TYPE_REVIEW = 60;
|
||||
|
||||
|
||||
public static $FLAG_TICKET = 0; //has valid ticket
|
||||
@@ -164,6 +165,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'),
|
||||
self::TYPE_OLD => Yii::t('common/card', 'OLD'),
|
||||
self::TYPE_EMPLOYEE => Yii::t('common/card', 'Munkatárs'),
|
||||
self::TYPE_REVIEW => Yii::t('common/card', 'Review'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ use yii\behaviors\TimestampBehavior;
|
||||
* @property integer $id_card
|
||||
* @property integer $id_key
|
||||
* @property integer $id_user
|
||||
* @property string $virtual_key
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ use Yii;
|
||||
use yii\base\Exception;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\base\NotSupportedException;
|
||||
use yii\filters\RateLimitInterface;
|
||||
use yii\web\IdentityInterface;
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,7 @@ use yii\web\IdentityInterface;
|
||||
* @property string password_hash
|
||||
* @property string auth_key
|
||||
*/
|
||||
class Customer extends BaseFitnessActiveRecord implements IdentityInterface
|
||||
class Customer extends BaseFitnessActiveRecord implements IdentityInterface, RateLimitInterface
|
||||
{
|
||||
|
||||
const STATUS_DELETED = 0;
|
||||
@@ -339,4 +340,23 @@ class Customer extends BaseFitnessActiveRecord implements IdentityInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function getRateLimit($request, $action)
|
||||
{
|
||||
return [1000,3600];
|
||||
// TODO: Implement getRateLimit() method.
|
||||
}
|
||||
|
||||
public function loadAllowance($request, $action)
|
||||
{
|
||||
// TODO: Implement loadAllowance() method.
|
||||
return [1000,3600];
|
||||
|
||||
}
|
||||
|
||||
public function saveAllowance($request, $action, $allowance, $timestamp)
|
||||
{
|
||||
// TODO: Implement saveAllowance() method.
|
||||
return [1000,3600];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,29 @@ use yii\helpers\ArrayHelper;
|
||||
* @property integer id_ticket_current
|
||||
* @property integer card_flag
|
||||
* @property integer flag_out
|
||||
* @property integer version
|
||||
*/
|
||||
class DoorLog extends \yii\db\ActiveRecord
|
||||
{
|
||||
|
||||
public static $SOURCE_APP_FORGO_VILLA = "forgo_villa";
|
||||
public static $SOURCE_APP_FITNESS_ADMIN = "fitness_admin";
|
||||
|
||||
public static $SOURCE_APP_FORGO_VILLA = "forgo_villa";
|
||||
public static $SOURCE_APP_FITNESS_ADMIN = "fitness_admin";
|
||||
|
||||
|
||||
public static $DIRECTION_OUT_MANUAL_READ_KEY_ASSIGNED = -2; // "Kézi olvasás/Kulcs ki",
|
||||
public static $DIRECTION_IN_MANUAL_READ_KEY_UNASSIGNED = -1; // "Kézi olvasás/Kulcs vissza",
|
||||
public static $DIRECTION_ALL_MANUAL_READ = 0; // "Kézi olvasás",
|
||||
public static $DIRECTION_OUT_WITHOUT_MOVE = 1; // "KI olvastatás mozgás nélkül",
|
||||
public static $DIRECTION_IN_WITHOUT_MOVE = 3; // "BE olvastatás mozgás nélkül",
|
||||
public static $DIRECTION_OUT = 5; // "KI mozgás",
|
||||
public static $DIRECTION_IN = 7; // "BE mozgás",
|
||||
public static $DIRECTION_OUT_ERROR_KEY_ASSIGNED = 9; // "KI olvastatás, van érvényes öltöző kulcs (nem enged)",
|
||||
public static $DIRECTION_IN_ERROR_KEY_MISSING = 11; // "BE olvastatás, nincs érvényes öltöző kulcs (nem enged)",
|
||||
public static $DIRECTION_OUT_NO_TICKET = 17; // "Bérlet érvényességi időn kívüli KI olvastatás (nem enged)",
|
||||
public static $DIRECTION_IN_NO_TICKET = 19; // "Bérlet érvényességi időn kívüli BE olvastatás (nem enged)",
|
||||
public static $DIRECTION_ALL_EMERGENCY = 128; // "Vésznyitás",
|
||||
public static $DIRECTION_ALL_CARD_BLOCKED = 256; // "Kártya tiltva -> információ mező",
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -35,16 +52,21 @@ class DoorLog extends \yii\db\ActiveRecord
|
||||
{
|
||||
return 'door_log';
|
||||
}
|
||||
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return ArrayHelper::merge( [
|
||||
[
|
||||
'class' => TimestampBehavior::className(),
|
||||
'value' => function(){ return date('Y-m-d H:i:s' ); },
|
||||
'updatedAtAttribute' => false,
|
||||
]
|
||||
], parent::behaviors());
|
||||
return ArrayHelper::merge([
|
||||
[
|
||||
'class' => TimestampBehavior::className(),
|
||||
'value' => function ($event) {
|
||||
if ( isset($event->sender->created_at) ){
|
||||
return $event->sender->created_at;
|
||||
}
|
||||
return date('Y-m-d H:i:s');
|
||||
},
|
||||
'updatedAtAttribute' => false,
|
||||
]
|
||||
], parent::behaviors());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,133 +97,147 @@ class DoorLog extends \yii\db\ActiveRecord
|
||||
'source_app' => Yii::t('common/door_log', 'Eszköz'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getCustomer(){
|
||||
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
|
||||
}
|
||||
|
||||
public function getCustomerName(){
|
||||
$result = "";
|
||||
if (isset($this->customer)){
|
||||
$result = $this->customer->name;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function getCard(){
|
||||
return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] );
|
||||
}
|
||||
|
||||
public function getCardNumber(){
|
||||
$result = "";
|
||||
if (isset($this->card)){
|
||||
$result = $this->card->number;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function getKey(){
|
||||
return $this->hasOne( Key::className(), ["id_key" =>"id_key" ] );
|
||||
}
|
||||
|
||||
public function getKeyNumber(){
|
||||
$result = "";
|
||||
if (isset($this->key)){
|
||||
$result = $this->key->number;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function getDirectionName(){
|
||||
$result = "";
|
||||
if ( $this->source_app == 'forgo_villa'){
|
||||
if (isset($this->direction)){
|
||||
$result = Helper::getArrayValue(self::getDirectionTypes() , $this->direction, "-");
|
||||
}
|
||||
}else{
|
||||
$result = "Kézi olvasás";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public static function getSourceAppName($source_app){
|
||||
$result = "";
|
||||
switch ($source_app){
|
||||
case self::$SOURCE_APP_FITNESS_ADMIN :
|
||||
$result = "Recepciós alkalmazás";
|
||||
break;
|
||||
case self::$SOURCE_APP_FORGO_VILLA:
|
||||
$result = "Forgó villa";
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getDirectionTypes( ){
|
||||
return [
|
||||
-2 => "Kézi olvasás/Kulcs ki",
|
||||
-1 => "Kézi olvasás/Kulcs vissza",
|
||||
0 => "Kézi olvasás",
|
||||
|
||||
1 => "KI olvastatás mozgás nélkül",
|
||||
|
||||
3 => "BE olvastatás mozgás nélkül",
|
||||
|
||||
5 => "KI mozgás",
|
||||
|
||||
7 => "BE mozgás",
|
||||
|
||||
9 => "KI olvastatás, van érvényes öltöző kulcs (nem enged)",
|
||||
|
||||
11 => "BE olvastatás, nincs érvényes öltöző kulcs (nem enged)",
|
||||
|
||||
17 => "Bérlet érvényességi időn kívüli KI olvastatás (nem enged)",
|
||||
|
||||
19 => "Bérlet érvényességi időn kívüli BE olvastatás (nem enged)",
|
||||
|
||||
128 => "Vésznyitás",
|
||||
256 => "Kártya tiltva -> információ mező",
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCardFlagTexts( ){
|
||||
return [
|
||||
0 => "Kártya érvényes bérlettel",
|
||||
1 => "Nincs érvényes bérlet",
|
||||
2 => "Kártya inaktív/Érvényes bérlet",
|
||||
3 => "Kártya inaktív/Nincs érvényes bérlet"
|
||||
|
||||
];
|
||||
}
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->hasOne(Customer::className(), ["id_customer" => "id_customer"]);
|
||||
}
|
||||
|
||||
public static function mkDoorLog($direction,$card,$customer = null,$key = null){
|
||||
public function getCustomerName()
|
||||
{
|
||||
$result = "";
|
||||
if (isset($this->customer)) {
|
||||
$result = $this->customer->name;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ( !Helper::isKeyToggleDoorLogEnabled() ){
|
||||
return;
|
||||
public function getCard()
|
||||
{
|
||||
return $this->hasOne(Card::className(), ["id_card" => "id_card"]);
|
||||
}
|
||||
|
||||
public function getCardNumber()
|
||||
{
|
||||
$result = "";
|
||||
if (isset($this->card)) {
|
||||
$result = $this->card->number;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getKey()
|
||||
{
|
||||
return $this->hasOne(Key::className(), ["id_key" => "id_key"]);
|
||||
}
|
||||
|
||||
public function getKeyNumber()
|
||||
{
|
||||
$result = "";
|
||||
if (isset($this->key)) {
|
||||
$result = $this->key->number;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getDirectionName()
|
||||
{
|
||||
$result = "";
|
||||
if ($this->source_app == 'forgo_villa') {
|
||||
if (isset($this->direction)) {
|
||||
$result = Helper::getArrayValue(self::getDirectionTypes(), $this->direction, "-");
|
||||
}
|
||||
} else {
|
||||
$result = "Kézi olvasás";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public static function getSourceAppName($source_app)
|
||||
{
|
||||
$result = "";
|
||||
switch ($source_app) {
|
||||
case self::$SOURCE_APP_FITNESS_ADMIN :
|
||||
$result = "Recepciós alkalmazás";
|
||||
break;
|
||||
case self::$SOURCE_APP_FORGO_VILLA:
|
||||
$result = "Forgó villa";
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getDirectionTypes()
|
||||
{
|
||||
return [
|
||||
-2 => "Kézi olvasás/Kulcs ki",
|
||||
-1 => "Kézi olvasás/Kulcs vissza",
|
||||
0 => "Kézi olvasás",
|
||||
|
||||
1 => "KI olvastatás mozgás nélkül",
|
||||
|
||||
3 => "BE olvastatás mozgás nélkül",
|
||||
|
||||
5 => "KI mozgás",
|
||||
|
||||
7 => "BE mozgás",
|
||||
|
||||
9 => "KI olvastatás, van érvényes öltöző kulcs (nem enged)",
|
||||
|
||||
11 => "BE olvastatás, nincs érvényes öltöző kulcs (nem enged)",
|
||||
|
||||
17 => "Bérlet érvényességi időn kívüli KI olvastatás (nem enged)",
|
||||
|
||||
19 => "Bérlet érvényességi időn kívüli BE olvastatás (nem enged)",
|
||||
|
||||
128 => "Vésznyitás",
|
||||
256 => "Kártya tiltva -> információ mező",
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCardFlagTexts()
|
||||
{
|
||||
return [
|
||||
0 => "Kártya érvényes bérlettel",
|
||||
1 => "Nincs érvényes bérlet",
|
||||
2 => "Kártya inaktív/Érvényes bérlet",
|
||||
3 => "Kártya inaktív/Nincs érvényes bérlet"
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public static function mkDoorLog($direction, $card, $customer = null, $key = null)
|
||||
{
|
||||
|
||||
if (!Helper::isKeyToggleDoorLogEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dlog = new DoorLog();
|
||||
$dlog->id_card = $card->id_card;
|
||||
$dlog = new DoorLog();
|
||||
$dlog->id_card = $card->id_card;
|
||||
|
||||
if ( isset($customer)){
|
||||
$dlog->id_customer = $customer->id_customer;
|
||||
}
|
||||
if (isset($customer)) {
|
||||
$dlog->id_customer = $customer->id_customer;
|
||||
}
|
||||
|
||||
if ( isset($key)){
|
||||
$dlog->id_key = $key->id_key;
|
||||
}
|
||||
$dlog->direction = $direction;
|
||||
$dlog->type = $card->type;
|
||||
$dlog->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
|
||||
if (isset($key)) {
|
||||
$dlog->id_key = $key->id_key;
|
||||
}
|
||||
$dlog->direction = $direction;
|
||||
$dlog->type = $card->type;
|
||||
$dlog->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
|
||||
|
||||
$dlog->id_account = Account::readDefault();
|
||||
$dlog->id_account = Account::readDefault();
|
||||
|
||||
if ( $dlog->direction == 0){
|
||||
$dlog->card_flag = $card->validity;
|
||||
}else{
|
||||
$dlog->card_flag = -1;
|
||||
}
|
||||
if ($dlog->direction == 0) {
|
||||
$dlog->card_flag = $card->validity;
|
||||
} else {
|
||||
$dlog->card_flag = -1;
|
||||
}
|
||||
|
||||
$dlog->created_at = date('Y-m-d H:i:s');
|
||||
$dlog->save(false);
|
||||
}
|
||||
|
||||
$dlog->created_at = date('Y-m-d H:i:s');
|
||||
$dlog->save(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
49
common/models/DoorLogForTest.php
Normal file
49
common/models/DoorLogForTest.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use common\components\Helper;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/**
|
||||
* This is the model class for table "door_log".
|
||||
*
|
||||
* @property integer $id_door_log
|
||||
* @property integer $id_card
|
||||
* @property integer $id_customer
|
||||
* @property integer $id_key
|
||||
* @property integer $direction
|
||||
* @property integer $type
|
||||
* @property integer $id_account
|
||||
* @property string $created_at
|
||||
* @property string $source_app
|
||||
* @property integer id_ticket_current
|
||||
* @property integer card_flag
|
||||
* @property integer flag_out
|
||||
*/
|
||||
class DoorLogForTest extends DoorLog
|
||||
{
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[
|
||||
['id_card', 'id_customer', 'id_key', 'direction', 'type', 'id_ticket_current'], 'integer'
|
||||
],
|
||||
|
||||
[['created_at'], 'string'],
|
||||
[['created_at'], 'required'],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
42
common/models/HuBankAccountValidator.php
Normal file
42
common/models/HuBankAccountValidator.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
class HuBankAccountValidator
|
||||
{
|
||||
|
||||
|
||||
public function validate($bankAccount){
|
||||
if ( !isset($bankAccount)){
|
||||
// \Yii::error("HuBankAccountValidator: bank account is null");
|
||||
return false;
|
||||
}
|
||||
$stripedBankAccount = preg_replace('/\s+/', '', $bankAccount);
|
||||
if ( !(strlen($stripedBankAccount) == 24 || strlen($stripedBankAccount) == 16)){
|
||||
// \Yii::error("HuBankAccountValidator: bank account length is invalid");
|
||||
return false;
|
||||
}
|
||||
$arrayOfNumbers = str_split($stripedBankAccount);
|
||||
$multipliers = [9,7,3,1];
|
||||
$groups = [0,0,0];
|
||||
for ( $i = 0; $i < count($arrayOfNumbers); $i++ ) {
|
||||
$number = $arrayOfNumbers[$i];
|
||||
$multiplier = $multipliers[$i % 4];
|
||||
$total = $multiplier * $number;
|
||||
$groups[intval($i / 8)] += $total ;
|
||||
}
|
||||
|
||||
$sumOfGroups = 0;
|
||||
foreach ($groups as $group){
|
||||
$sumOfGroups += $group;
|
||||
}
|
||||
|
||||
$mod = $sumOfGroups % 10;
|
||||
if ( $mod > 0 ){
|
||||
// \Yii::error("HuBankAccountValidator: bank account groups are invalid: " . $groups[0] .",". $groups[1] . "," . $groups[2],true);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,67 +33,71 @@ use yii\helpers\Console;
|
||||
*/
|
||||
class Log extends BaseFitnessActiveRecord
|
||||
{
|
||||
|
||||
public static $TYPE_INFO = 10;
|
||||
public static $TYPE_ERR = 20;
|
||||
public static $TYPE_TICKET_USAGE_FIRST = 30;
|
||||
public static $TYPE_TICKET_USAGE_MULTIPLE = 40;
|
||||
public static $TYPE_LOGIN = 50;
|
||||
public static $TYPE_DEFAULT_ACCOUNT= 60;
|
||||
public static $TYPE_CREATE_CUSTOMER= 70;
|
||||
public static $TYPE_PROCUREMENT_UPDATE = 80;
|
||||
public static $TYPE_TICKET_COUNT_MOVE_OUT = 90;
|
||||
public static $TYPE_WASTE = 100;
|
||||
public static $TYPE_NEWSLETTER_SUBSCRIBE = 110;
|
||||
public static $TYPE_NEWSLETTER_UNSUBSCRIBE = 120;
|
||||
public static $TYPE_NEWSLETTER_SENT = 130;
|
||||
public static $TYPE_TICKET_EXPIRE_SENT = 140;
|
||||
public static $TYPE_NEWSLETTER_SEND_START = 150;
|
||||
public static $TYPE_NEWSLETTER_SEND_END = 160;
|
||||
public static $TYPE_KEY_ASSIGN = 170;
|
||||
public static $TYPE_KEY_UNASSIGN = 180;
|
||||
public static $TYPE_TOWEL_IN = 190;
|
||||
public static $TYPE_TOWEL_OUT = 200;
|
||||
public static $TYPE_CRUD = 210;
|
||||
public static $TYPE_TICKET_UPDATED_BY_ADMIN = 220;
|
||||
|
||||
public static $TYPE_INFO = 10;
|
||||
public static $TYPE_ERR = 20;
|
||||
public static $TYPE_TICKET_USAGE_FIRST = 30;
|
||||
public static $TYPE_TICKET_USAGE_MULTIPLE = 40;
|
||||
public static $TYPE_LOGIN = 50;
|
||||
public static $TYPE_DEFAULT_ACCOUNT = 60;
|
||||
public static $TYPE_CREATE_CUSTOMER = 70;
|
||||
public static $TYPE_PROCUREMENT_UPDATE = 80;
|
||||
public static $TYPE_TICKET_COUNT_MOVE_OUT = 90;
|
||||
public static $TYPE_WASTE = 100;
|
||||
public static $TYPE_NEWSLETTER_SUBSCRIBE = 110;
|
||||
public static $TYPE_NEWSLETTER_UNSUBSCRIBE = 120;
|
||||
public static $TYPE_NEWSLETTER_SENT = 130;
|
||||
public static $TYPE_TICKET_EXPIRE_SENT = 140;
|
||||
public static $TYPE_NEWSLETTER_SEND_START = 150;
|
||||
public static $TYPE_NEWSLETTER_SEND_END = 160;
|
||||
public static $TYPE_KEY_ASSIGN = 170;
|
||||
public static $TYPE_KEY_UNASSIGN = 180;
|
||||
public static $TYPE_TOWEL_IN = 190;
|
||||
public static $TYPE_TOWEL_OUT = 200;
|
||||
public static $TYPE_CRUD = 210;
|
||||
public static $TYPE_TICKET_UPDATED_BY_ADMIN = 220;
|
||||
public static $TYPE_MOBILE_DEVICE_STATUS = 230;
|
||||
|
||||
|
||||
public static function getTypes(){
|
||||
return [
|
||||
|
||||
Log::$TYPE_INFO => "Info",
|
||||
Log::$TYPE_ERR => "Hiba",
|
||||
Log::$TYPE_TICKET_USAGE_FIRST => "Bérlet használat",
|
||||
Log::$TYPE_TICKET_USAGE_MULTIPLE => "Többszöri bérlet használat",
|
||||
Log::$TYPE_LOGIN => "Bejelentkezés",
|
||||
Log::$TYPE_DEFAULT_ACCOUNT=> "Alapértelmezett kassza",
|
||||
Log::$TYPE_CREATE_CUSTOMER=> "Új vendég",
|
||||
Log::$TYPE_PROCUREMENT_UPDATE => "Beszerzés módosítás",
|
||||
Log::$TYPE_TICKET_COUNT_MOVE_OUT => "Ki mozgás",
|
||||
Log::$TYPE_WASTE => "Selejt",
|
||||
Log::$TYPE_NEWSLETTER_SUBSCRIBE => "Feliratkozás hirlevélre",
|
||||
Log::$TYPE_NEWSLETTER_UNSUBSCRIBE => "Leiratkozás hírlevélről",
|
||||
Log::$TYPE_NEWSLETTER_SENT => "Hirlevél elküldve",
|
||||
Log::$TYPE_TICKET_EXPIRE_SENT => "Bérlet lejáart figyelmeztetés elküldve",
|
||||
Log::$TYPE_NEWSLETTER_SEND_START => "Hirlevél küldés start",
|
||||
Log::$TYPE_NEWSLETTER_SEND_END => "Hirlevél küldés vége",
|
||||
Log::$TYPE_KEY_ASSIGN => "Kulcs kiadás",
|
||||
Log::$TYPE_KEY_UNASSIGN => "Kulcs visszaadás",
|
||||
Log::$TYPE_TOWEL_IN => "Törölköző ki",
|
||||
Log::$TYPE_TOWEL_OUT => "Törölköző vissza",
|
||||
Log::$TYPE_CRUD => "CRUD",
|
||||
Log::$TYPE_TICKET_UPDATED_BY_ADMIN => "Bérlet módosítás"
|
||||
|
||||
public static function getTypes()
|
||||
{
|
||||
return [
|
||||
|
||||
Log::$TYPE_INFO => "Info",
|
||||
Log::$TYPE_ERR => "Hiba",
|
||||
Log::$TYPE_TICKET_USAGE_FIRST => "Bérlet használat",
|
||||
Log::$TYPE_TICKET_USAGE_MULTIPLE => "Többszöri bérlet használat",
|
||||
Log::$TYPE_LOGIN => "Bejelentkezés",
|
||||
Log::$TYPE_DEFAULT_ACCOUNT => "Alapértelmezett kassza",
|
||||
Log::$TYPE_CREATE_CUSTOMER => "Új vendég",
|
||||
Log::$TYPE_PROCUREMENT_UPDATE => "Beszerzés módosítás",
|
||||
Log::$TYPE_TICKET_COUNT_MOVE_OUT => "Ki mozgás",
|
||||
Log::$TYPE_WASTE => "Selejt",
|
||||
Log::$TYPE_NEWSLETTER_SUBSCRIBE => "Feliratkozás hirlevélre",
|
||||
Log::$TYPE_NEWSLETTER_UNSUBSCRIBE => "Leiratkozás hírlevélről",
|
||||
Log::$TYPE_NEWSLETTER_SENT => "Hirlevél elküldve",
|
||||
Log::$TYPE_TICKET_EXPIRE_SENT => "Bérlet lejáart figyelmeztetés elküldve",
|
||||
Log::$TYPE_NEWSLETTER_SEND_START => "Hirlevél küldés start",
|
||||
Log::$TYPE_NEWSLETTER_SEND_END => "Hirlevél küldés vége",
|
||||
Log::$TYPE_KEY_ASSIGN => "Kulcs kiadás",
|
||||
Log::$TYPE_KEY_UNASSIGN => "Kulcs visszaadás",
|
||||
Log::$TYPE_TOWEL_IN => "Törölköző ki",
|
||||
Log::$TYPE_TOWEL_OUT => "Törölköző vissza",
|
||||
Log::$TYPE_CRUD => "CRUD",
|
||||
Log::$TYPE_TICKET_UPDATED_BY_ADMIN => "Bérlet módosítás",
|
||||
Log::$TYPE_MOBILE_DEVICE_STATUS => "Mobil eszköz státusz"
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeName(){
|
||||
$types = Log::getTypes();
|
||||
return Helper::getArrayValue($types,$this->type,null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
public function getTypeName()
|
||||
{
|
||||
$types = Log::getTypes();
|
||||
return Helper::getArrayValue($types, $this->type, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
@@ -134,79 +138,89 @@ class Log extends BaseFitnessActiveRecord
|
||||
'id_door_log' => Yii::t('common/log', 'Kapu log'),
|
||||
'created_at' => Yii::t('common/log', 'Dátum idő'),
|
||||
'updated_at' => Yii::t('common/log', 'Módosítás'),
|
||||
'start' => 'Időszak kezdete',
|
||||
'end' => 'Időszak vége'
|
||||
'start' => 'Időszak kezdete',
|
||||
'end' => 'Időszak vége'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public static function info($message ){
|
||||
self::log(['type' =>self::$TYPE_INFO, 'message' => $message]);
|
||||
|
||||
|
||||
public static function info($message)
|
||||
{
|
||||
self::log(['type' => self::$TYPE_INFO, 'message' => $message]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* example
|
||||
* Log::log([
|
||||
'type' =>Log::$TYPE_LOGIN,
|
||||
'message' => $message
|
||||
]);
|
||||
* 'type' =>Log::$TYPE_LOGIN,
|
||||
* 'message' => $message
|
||||
* ]);
|
||||
* @param array $config
|
||||
*/
|
||||
public static function log( $config ){
|
||||
$model = new Log($config);
|
||||
$model->app = \Yii::$app->name;
|
||||
$model->url = Url::canonical();
|
||||
$model->id_user = \Yii::$app->user->id;
|
||||
$model->save(false);
|
||||
public static function log($config)
|
||||
{
|
||||
$model = new Log($config);
|
||||
$model->app = \Yii::$app->name;
|
||||
$model->url = Url::canonical();
|
||||
$model->id_user = \Yii::$app->user->id;
|
||||
$model->save(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* create a log from the console app
|
||||
* */
|
||||
public static function logC( $config ){
|
||||
$model = new Log($config);
|
||||
$model->app = "Fitness rendszer";
|
||||
$model->url = "console";
|
||||
$model->id_user = 1;
|
||||
$model->save(false);
|
||||
public static function logC($config)
|
||||
{
|
||||
$model = new Log($config);
|
||||
$model->app = "Fitness rendszer";
|
||||
$model->url = "console";
|
||||
$model->id_user = 1;
|
||||
$model->save(false);
|
||||
}
|
||||
|
||||
public function getUser(){
|
||||
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
|
||||
public function getUser()
|
||||
{
|
||||
return $this->hasOne(User::className(), ["id" => "id_user"]);
|
||||
}
|
||||
|
||||
public function getTicket(){
|
||||
return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket" ] );
|
||||
public function getTicket()
|
||||
{
|
||||
return $this->hasOne(Ticket::className(), ["id_ticket" => "id_ticket"]);
|
||||
}
|
||||
|
||||
public function getCustomer(){
|
||||
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->hasOne(Customer::className(), ["id_customer" => "id_customer"]);
|
||||
}
|
||||
|
||||
public function getMoneyMovement(){
|
||||
return $this->hasOne( MoneyMovement::className(), ["id_money_movement" =>"id_money_movement" ] );
|
||||
public function getMoneyMovement()
|
||||
{
|
||||
return $this->hasOne(MoneyMovement::className(), ["id_money_movement" => "id_money_movement"]);
|
||||
}
|
||||
|
||||
|
||||
public function getUserName(){
|
||||
public function getUserName()
|
||||
{
|
||||
$user = $this->user;
|
||||
if ( isset($user)){
|
||||
if (isset($user)) {
|
||||
return $user->username;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getCustomerName(){
|
||||
public function getCustomerName()
|
||||
{
|
||||
$customer = $this->customer;
|
||||
if ( isset($customer)){
|
||||
if (isset($customer)) {
|
||||
return $customer->name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTicketName(){
|
||||
public function getTicketName()
|
||||
{
|
||||
$ticket = $this->ticket;
|
||||
if ( isset($ticket)){
|
||||
if (isset($ticket)) {
|
||||
return $ticket->ticketTypeName;
|
||||
}
|
||||
return null;
|
||||
|
||||
134
common/models/MobileDevice.php
Normal file
134
common/models/MobileDevice.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\NotSupportedException;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\web\IdentityInterface;
|
||||
|
||||
/**
|
||||
* This is the model class for table "mobile_device".
|
||||
*
|
||||
* @property integer $id
|
||||
* @property integer $id_card
|
||||
* @property string $status
|
||||
* @property string $device_identifier
|
||||
* @property string $device_name
|
||||
* @property string $activated_at
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class MobileDevice extends \yii\db\ActiveRecord implements IdentityInterface
|
||||
{
|
||||
|
||||
const STATUS_ACTIVE = 'active';
|
||||
const STATUS_INACTIVE = 'inactive';
|
||||
const STATUS_DELETED_MANUAL = 'deleted_manual';
|
||||
const STATUS_DELETED_SYSTEM = 'deleted_system';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'mobile_device';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// [['id_card'], 'integer'],
|
||||
// [['activated_at', 'created_at', 'updated_at'], 'safe'],
|
||||
// [['created_at', 'updated_at'], 'required'],
|
||||
// [['status'], 'string', 'max' => 20],
|
||||
// [['device_identifier'], 'string', 'max' => 255]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id' => Yii::t('common/mobiledevice', 'ID'),
|
||||
'id_card' => Yii::t('common/mobiledevice', 'Id Card'),
|
||||
'status' => Yii::t('common/mobiledevice', 'Status'),
|
||||
'device_identifier' => Yii::t('common/mobiledevice', 'Device Identifier'),
|
||||
'device_name' => Yii::t('common/mobiledevice', 'Device Name'),
|
||||
'activated_at' => Yii::t('common/mobiledevice', 'Activated At'),
|
||||
'created_at' => Yii::t('common/mobiledevice', 'Created At'),
|
||||
'updated_at' => Yii::t('common/mobiledevice', 'Updated At'),
|
||||
];
|
||||
}
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return ArrayHelper::merge( [
|
||||
[
|
||||
'class' => TimestampBehavior::className(),
|
||||
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||
]
|
||||
],
|
||||
parent::behaviors());
|
||||
}
|
||||
|
||||
public static function toStatusHumanReadable($status){
|
||||
$result = "";
|
||||
switch ($status){
|
||||
case self::STATUS_ACTIVE:
|
||||
$result ='Aktív';
|
||||
break;
|
||||
case self::STATUS_DELETED_MANUAL:
|
||||
$result ='Törölve (m)';
|
||||
break;
|
||||
case self::STATUS_DELETED_SYSTEM:
|
||||
$result ='Törölve (r)';
|
||||
break;
|
||||
case self::STATUS_INACTIVE:
|
||||
$result ='Inaktív';
|
||||
break;
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function findIdentity($id)
|
||||
{
|
||||
self::findOne(['id' => $id]);
|
||||
}
|
||||
|
||||
public static function findIdentityByAccessToken($token, $type = null)
|
||||
{
|
||||
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
|
||||
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getAuthKey()
|
||||
{
|
||||
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
|
||||
|
||||
}
|
||||
|
||||
public function validateAuthKey($authKey)
|
||||
{
|
||||
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
|
||||
}
|
||||
|
||||
public function getCard()
|
||||
{
|
||||
return $this->hasOne(Card::class, [
|
||||
'id_card' => 'id_card'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use yii\helpers\ArrayHelper;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use common\components\AccountAwareBehavior;
|
||||
use common\components\UserAwareBehavior;
|
||||
use yii\base\Object;
|
||||
use yii\base\BaseObject;
|
||||
use common\models\Transfer;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Transfer;
|
||||
use yii\base\Object;
|
||||
use yii\base\BaseObject;
|
||||
use yii\db\Query;
|
||||
use yii\db\Expression;
|
||||
use common\models\Account;
|
||||
|
||||
@@ -6,7 +6,7 @@ use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Transfer;
|
||||
use yii\base\Object;
|
||||
use yii\base\BaseObject;
|
||||
use yii\db\Query;
|
||||
use yii\db\Expression;
|
||||
use common\models\Account;
|
||||
|
||||
71
common/models/VirtualKey.php
Normal file
71
common/models/VirtualKey.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/**
|
||||
* This is the model class for table "virtual_key".
|
||||
*
|
||||
* @property integer $id
|
||||
* @property integer $id_card
|
||||
* @property integer $id_key
|
||||
* @property integer $number
|
||||
* @property string $direction_in_at
|
||||
* @property string $direction_out_at
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class VirtualKey extends \yii\db\ActiveRecord
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'virtual_key';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_card', 'id_key'], 'integer'],
|
||||
[[ 'created_at', 'updated_at'], 'required'],
|
||||
[[ 'direction_in_at', 'created_at', 'updated_at'], 'safe']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id' => Yii::t('common/virtualkey', 'ID'),
|
||||
'id_card' => Yii::t('common/virtualkey', 'Id Card'),
|
||||
'id_key' => Yii::t('common/virtualkey', 'Id Key'),
|
||||
'direction_in_at' => Yii::t('common/virtualkey', 'Direction In At'),
|
||||
'direction_out_at' => Yii::t('common/virtualkey', 'Direction Out At'),
|
||||
'created_at' => Yii::t('common/virtualkey', 'Created At'),
|
||||
'updated_at' => Yii::t('common/virtualkey', 'Updated At'),
|
||||
];
|
||||
}
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return ArrayHelper::merge([
|
||||
[
|
||||
'class' => TimestampBehavior::className(),
|
||||
'value' => function () {
|
||||
return date('Y-m-d H:i:s');
|
||||
}
|
||||
]
|
||||
],
|
||||
parent::behaviors());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user