From 6e66ab204d1bbde93ebe15f78aafcb1bf94cfe08 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Mon, 3 Jun 2019 18:10:32 +0200 Subject: [PATCH 1/2] improve employee card validity calculation --- common/models/Ticket.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/common/models/Ticket.php b/common/models/Ticket.php index 83f8660..c655af8 100644 --- a/common/models/Ticket.php +++ b/common/models/Ticket.php @@ -56,13 +56,16 @@ class Ticket extends \common\models\BaseFitnessActiveRecord order by id_card desc ) as t on t.id_card = c1.id_card - SET c1.validity = case when t.id_card is null then ( c1.validity | 1 << 0 ) else ( c1.validity & ~(1 << 0) ) end - , 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"; + -- first bit is 0 , when there is a valid ticket or the card is 'employee' => 0000 0000 + -- first bit is 1, when card is not employee and there is no valid card => 0000 0001 + SET c1.validity = case when c1.type = 50 then ( c1.validity & ~(1 << 0) ) when t.id_card is null then ( c1.validity | 1 << 0 ) else ( c1.validity & ~(1 << 0) ) end + -- first bit is 0 when there is a ticket or 'employee' card 0000 0000 + -- first bit is 1 when there is no ticket and card type is not 'employee' + , c1.flag = case when c1.type = 50 then ( c1.flag & ~(1 << 0) ) 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"; public static $SQL_UPDATE_CARD = "UPDATE card as c1 - left JOIN ( select ticket.id_card as id_card , max(ticket.id_ticket) as id_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() @@ -73,10 +76,10 @@ class Ticket extends \common\models\BaseFitnessActiveRecord order by id_card desc ) as t on t.id_card = c1.id_card - SET c1.validity = case when t.id_card is null then ( c1.validity | 1 << 0 ) else ( c1.validity & ~(1 << 0) ) end - ,c1.flag = case when t.id_card is null then ( c1.flag | 1 << 0 ) else ( c1.flag & ~(1 << 0) ) end + SET c1.validity = case when c1.type = 50 then ( c1.validity & ~(1 << 0) ) when t.id_card is null then ( c1.validity | 1 << 0 ) else ( c1.validity & ~(1 << 0) ) end + ,c1.flag = case when c1.type = 50 then ( c1.flag & ~(1 << 0) ) 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 and c1.id_card = :id"; + WHERE c1.id_card = :id"; From a56998f5fd5d3f33f2288c7f316dae53d6163ab5 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Tue, 4 Jun 2019 07:24:30 +0200 Subject: [PATCH 2/2] change version to v0.1.16 --- changelog.txt | 2 ++ common/config/params.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index df6c05d..bdb69a7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,5 @@ +-0.1.16 + - improve employee card validity calculation -0.1.15 - fix null pointer when displaying warning in reception , when no ticket -0.1.14 diff --git a/common/config/params.php b/common/config/params.php index fbf3a05..49c519f 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -5,7 +5,7 @@ return [ 'supportEmail' => 'rocho02@gmail.com', 'infoEmail' => 'info@rocho-net.hu', 'user.passwordResetTokenExpire' => 3600, - 'version' => 'v0.1.15', + 'version' => 'v0.1.16', 'company' => 'movar',//gyor 'company_name' => "Freimann Kft.", 'product_visiblity' => 'account',// on reception which products to display. account or global