change trigger to detect move in and move out

This commit is contained in:
2016-04-18 22:14:25 +02:00
parent 01ada90e8c
commit f19c60eacd
9 changed files with 278 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ return [
'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.64',
'version' => 'v0.0.65',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global

View File

@@ -4,6 +4,8 @@ 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".
@@ -30,6 +32,17 @@ 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());
}
/**
* @inheritdoc

View File

@@ -40,6 +40,7 @@ class Log extends BaseFitnessActiveRecord
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;
/**
* @inheritdoc
*/

View File

@@ -42,7 +42,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
where ticket.start <= CURDATE()
and ticket.end >= curdate()
and ticket.status = 10
and ticket.usage_count < ticket.max_usage_count
and ticket.count_move_out < ticket.max_usage_count
group by id_card
order by id_card desc
) as t
@@ -57,7 +57,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
where ticket.start <= CURDATE()
and ticket.end >= curdate()
and ticket.status = 10
and ticket.usage_count < ticket.max_usage_count
and ticket.count_move_out < ticket.max_usage_count
and ticket.id_card = :id
group by id_card
order by id_card desc