add app param 'key_required'
This commit is contained in:
parent
59f6b32e7c
commit
57e578540c
@ -345,6 +345,10 @@ class Helper {
|
|||||||
return \Yii::$app->params ['user_cart_on'] == true;
|
return \Yii::$app->params ['user_cart_on'] == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isKeyRequired() {
|
||||||
|
return \Yii::$app->params ['key_required'] == true;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getProductSaleDefaultFocus() {
|
public static function getProductSaleDefaultFocus() {
|
||||||
return \Yii::$app->params ['product_sale_default_focus'] ;
|
return \Yii::$app->params ['product_sale_default_focus'] ;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,7 @@ return [
|
|||||||
/**
|
/**
|
||||||
* if true, key in/out events will generate doorlog events
|
* if true, key in/out events will generate doorlog events
|
||||||
*/
|
*/
|
||||||
'key_toggle_door_log_enabled' => false
|
'key_toggle_door_log_enabled' => false,
|
||||||
|
//if key required for entry trough the door
|
||||||
|
'key_required' => true
|
||||||
];
|
];
|
||||||
|
|||||||
@ -57,6 +57,10 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
WHERE c1.type <> 50
|
WHERE c1.type <> 50
|
||||||
";
|
";
|
||||||
|
|
||||||
|
public static $SQL_CLEAR_KEY_STATUS = "
|
||||||
|
UPDATE card set flag = ( flag & ~(1 << 2 ) ) WHERE card.type <> 50 and card.id_card = :id
|
||||||
|
";
|
||||||
|
|
||||||
public static $SQL_CLEARS_STATUS_DOOR_IN = "
|
public static $SQL_CLEARS_STATUS_DOOR_IN = "
|
||||||
UPDATE card set flag = ( flag & ~(1 << 1 ) ) WHERE card.type <> 50 and card.id_card = :id
|
UPDATE card set flag = ( flag & ~(1 << 1 ) ) WHERE card.type <> 50 and card.id_card = :id
|
||||||
";
|
";
|
||||||
@ -239,9 +243,14 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setFlagsHasKey($hasKey){
|
public function setFlagsHasKey($hasKey){
|
||||||
$this->flag = $hasKey ? ( $this->flag & ~(1 << Card::$FLAG_KEY) ) : ( $this->flag | 1 << Card::$FLAG_KEY );
|
if (Helper::isKeyRequired()){
|
||||||
$this->flag_out = $hasKey ? ( $this->flag_out | 1 << Card::$FLAG_KEY ) : ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
$this->flag = $hasKey ? ( $this->flag & ~(1 << Card::$FLAG_KEY) ) : ( $this->flag | 1 << Card::$FLAG_KEY );
|
||||||
/** @noinspection PhpUndefinedClassInspection */
|
$this->flag_out = $hasKey ? ( $this->flag_out | 1 << Card::$FLAG_KEY ) : ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
||||||
|
/** @noinspection PhpUndefinedClassInspection */
|
||||||
|
}else{
|
||||||
|
$this->flag = ( $this->flag & ~(1 << Card::$FLAG_KEY) );
|
||||||
|
$this->flag_out = ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
||||||
|
}
|
||||||
\Yii::info("flag has key: ".$this->flag .";".$this->flag_out);
|
\Yii::info("flag has key: ".$this->flag .";".$this->flag_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,9 +29,17 @@ class TicketController extends Controller {
|
|||||||
$result = $command->execute ();
|
$result = $command->execute ();
|
||||||
\Yii::info ( "Tickets updated: " . $result );
|
\Yii::info ( "Tickets updated: " . $result );
|
||||||
|
|
||||||
|
if ( Helper::isKeyRequired() ){
|
||||||
$command = $connection->createCommand ( Card::$SQL_FIX_KEY_STATUS );
|
\Yii::info ( "Fixing key status" );
|
||||||
$result = $command->execute ();
|
$command = $connection->createCommand ( Card::$SQL_FIX_KEY_STATUS );
|
||||||
|
$result = $command->execute ();
|
||||||
|
\Yii::info ( "Fixing key status updated: " . $result );
|
||||||
|
}else{
|
||||||
|
\Yii::info ( "Clearing key status" );
|
||||||
|
$command = $connection->createCommand ( Card::$SQL_CLEAR_KEY_STATUS );
|
||||||
|
$result = $command->execute ();
|
||||||
|
\Yii::info ( "Clearing key status updated: ". $result );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,10 +176,8 @@ class TicketController extends Controller {
|
|||||||
|
|
||||||
\Yii::info("Hírlevél küldése " .count($subscribers) . " előfizetőnek!" );
|
\Yii::info("Hírlevél küldése " .count($subscribers) . " előfizetőnek!" );
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
foreach ($newsletters as $newsletter ){
|
foreach ($newsletters as $newsletter ){
|
||||||
$i = 0;
|
|
||||||
Log::logC([
|
Log::logC([
|
||||||
'type' => Log::$TYPE_NEWSLETTER_SEND_START,
|
'type' => Log::$TYPE_NEWSLETTER_SEND_START,
|
||||||
'message' => "Hírlevél küldés indítása[id_newsletter=" . $newsletter->id_newsletter ."]"
|
'message' => "Hírlevél küldés indítása[id_newsletter=" . $newsletter->id_newsletter ."]"
|
||||||
@ -217,8 +223,6 @@ class TicketController extends Controller {
|
|||||||
}catch (\Exception $ex){
|
}catch (\Exception $ex){
|
||||||
\Yii::error("Nem sikerült hírlevelet kikülden: Hírlevél azonosító=" .$newsletter->id_newsletter. ";Előfizető azonosító ". $subscriber->id_subscriber ) ;
|
\Yii::error("Nem sikerült hírlevelet kikülden: Hírlevél azonosító=" .$newsletter->id_newsletter. ";Előfizető azonosító ". $subscriber->id_subscriber ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
$newsletter->sent = Newsletter::$SENT_TRUE;
|
$newsletter->sent = Newsletter::$SENT_TRUE;
|
||||||
$newsletter->sent_at = Helper::getDateTimeString();
|
$newsletter->sent_at = Helper::getDateTimeString();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user