status flag
This commit is contained in:
@@ -12,6 +12,7 @@ use common\components\Helper;
|
||||
* @property string $number
|
||||
* @property integer $status
|
||||
* @property integer $type
|
||||
* @property integer $flag
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
@@ -27,6 +28,9 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
const TYPE_OLD = 40;
|
||||
const TYPE_EMPLOYEE = 50;
|
||||
|
||||
|
||||
public static $FLAG_TICKET = 0;
|
||||
public static $FLAG_STATUS = 1;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -172,4 +176,17 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
$command->execute();
|
||||
}
|
||||
|
||||
public function beforeSave($insert) {
|
||||
if (parent::beforeSave($insert)){
|
||||
$this->flag = Helper::setBit($this->flag, Card::$FLAG_STATUS, ( $this->status != Card::STATUS_ACTIVE));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function getFlagText(){
|
||||
return Helper::getArrayValue(DoorLog::getCardFlagTexts(), $this->flag, "Ismeretlen");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user