Remove trigger condition - maximalize enter count with ticket

This commit is contained in:
2016-09-29 18:38:53 +02:00
parent 606f18950f
commit e30bb082fa
4 changed files with 31 additions and 3 deletions

View File

@@ -44,6 +44,15 @@ class Card extends \common\models\BaseFitnessActiveRecord
UPDATE card set flag = ( flag & ~(1 << 1 ) ), flag_out= ( flag_out & ~(1 << 1 ) ) where card.type <> 50
";
public static $SQL_FIX_KEY_STATUS = "
update card as c1
left join card_key_assignment k
on k.id_card = c1.id_card
set flag = CASE WHEN k.id_key is null then (c1.flag | 1 << 2) else ( c1.flag & ~(1 << 2 ) ) end,
flag_out = CASE WHEN k.id_key is null then ( c1.flag_out & ~(1 << 2 )) else (c1.flag_out | 1 << 2 ) end
WHERE c1.type <> 50
";
public static $SQL_CLEARS_STATUS_DOOR_IN = "
UPDATE card set flag = ( flag & ~(1 << 1 ) ) WHERE card.type <> 50 and card.id_card = :id
";