status flag

This commit is contained in:
2016-03-11 07:41:51 +01:00
parent bc74d92463
commit 9c25312cf1
8 changed files with 49 additions and 5 deletions

View File

@@ -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");
}
}