add new contract design

This commit is contained in:
2016-02-22 21:29:56 +01:00
parent 59a7a3e95d
commit 7a55dedc76
5 changed files with 16 additions and 17 deletions

View File

@@ -131,9 +131,15 @@ class ContractForm extends Model {
$this->ticketType = TicketType::findOne ( $this->ticket_type );
if (! isset ( $this->ticketType )) {
$this->addError ( $attribute, "Bérlet típus nem található" );
}else{
$contracts = Contract::find()->andWhere(['>' ,'contract.expired_at', date('Y-m-d')])->andWhere(['not in' ,'contract.flag',[Contract::$FLAG_DELETED]])->all();
if ( count($contracts) > 0 ){
$this->addError( $attribute , "Már van érvényes vagy lemondott szerződés az adott időszakban");
}
}
}
/**
* @inheritdoc
*/