add ticket usage count increment trigger, add log, fix card flag update query, fix customer card move update

This commit is contained in:
2016-03-20 15:36:05 +01:00
parent 1d5a5be5bf
commit 7db129de92
18 changed files with 846 additions and 25 deletions

View File

@@ -363,7 +363,11 @@ class Helper {
public static function mkYiiSortItems($config){
$result = [];
foreach ($config as $col ){
$result = $result + Helper::mkYiiSortItem($col[0] ,$col[1]);
if ( count($col) == 1){
$result = $result + Helper::mkYiiSortItem($col[0] ,$col[0]);
}else{
$result = $result + Helper::mkYiiSortItem($col[0] ,$col[1]);
}
}
return $result;
}

View File

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

View File

@@ -62,24 +62,26 @@ class Log extends BaseFitnessActiveRecord
public function attributeLabels()
{
return [
'id_log' => Yii::t('common/log', 'Id Log'),
'type' => Yii::t('common/log', 'Type'),
'message' => Yii::t('common/log', 'Message'),
'id_log' => Yii::t('common/log', 'Azonosító'),
'type' => Yii::t('common/log', 'Típus'),
'message' => Yii::t('common/log', 'Üzenet'),
'url' => Yii::t('common/log', 'Url'),
'app' => Yii::t('common/log', 'App'),
'id_user' => Yii::t('common/log', 'Id User'),
'id_transfer' => Yii::t('common/log', 'Id Transfer'),
'id_money_movement' => Yii::t('common/log', 'Id Money Movement'),
'id_ticket' => Yii::t('common/log', 'Id Ticket'),
'id_sale' => Yii::t('common/log', 'Id Sale'),
'id_customer' => Yii::t('common/log', 'Id Customer'),
'id_account' => Yii::t('common/log', 'Id Account'),
'app' => Yii::t('common/log', 'Alkalmazás'),
'id_user' => Yii::t('common/log', 'Felhasználó'),
'id_transfer' => Yii::t('common/log', 'Tranzakció'),
'id_money_movement' => Yii::t('common/log', 'Pénzmozgás'),
'id_ticket' => Yii::t('common/log', 'Bérlet'),
'id_sale' => Yii::t('common/log', 'Termékeladás'),
'id_customer' => Yii::t('common/log', 'Vendég'),
'id_account' => Yii::t('common/log', 'Kassza'),
'id_account_state' => Yii::t('common/log', 'Id Account State'),
'id_key' => Yii::t('common/log', 'Id Key'),
'id_product' => Yii::t('common/log', 'Id Product'),
'id_door_log' => Yii::t('common/log', 'Id Door Log'),
'created_at' => Yii::t('common/log', 'Created At'),
'updated_at' => Yii::t('common/log', 'Updated At'),
'id_key' => Yii::t('common/log', 'Kulcs'),
'id_product' => Yii::t('common/log', 'Termék'),
'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'
];
}

View File

@@ -37,22 +37,31 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
const STATUS_INACTIVE = 20;
public static $SQL_UPDATE = "UPDATE card as c1
left JOIN ( select distinct ticket.id_card as id_card ,ticket.id_ticket as id_ticket from ticket
left JOIN ( select ticket.id_card as id_card , max(ticket.id_ticket) as id_ticket
from ticket
where ticket.start <= CURDATE()
and ticket.end >= curdate() and ticket.status = 10
and ticket.usage_count < ticket.max_usage_count
order by id_ticket desc limit 1 ) as t
and ticket.end >= curdate()
and ticket.status = 10
and ticket.usage_count < ticket.max_usage_count
group by id_card
order by id_card desc
) as t
on t.id_card = c1.id_card
SET c1.flag = case when t.id_card is null then ( c1.flag | 1 << 0 ) else ( c1.flag & ~(1 << 0) ) end
, c1.id_ticket_current = case when t.id_ticket is null then null else t.id_ticket end
WHERE c1.type <> 50";
public static $SQL_UPDATE_CARD = "UPDATE card as c1
left JOIN ( select distinct ticket.id_card as id_card ,ticket.id_ticket as id_ticket from ticket
left JOIN ( select ticket.id_card as id_card , max(ticket.id_ticket) as id_ticket
from ticket
where ticket.start <= CURDATE()
and ticket.end >= curdate() and ticket.status = 10
and ticket.end >= curdate()
and ticket.status = 10
and ticket.usage_count < ticket.max_usage_count
order by id_ticket desc limit 1 ) as t
and ticket.id_card = :id
group by id_card
order by id_card desc
) as t
on t.id_card = c1.id_card
SET c1.flag = case when t.id_card is null then ( c1.flag | 1 << 0 ) else ( c1.flag & ~(1 << 0) ) end
, c1.id_ticket_current = case when t.id_ticket is null then null else t.id_ticket end