fix barcodue uniqe on admin , ticket use status=active , when checking
This commit is contained in:
@@ -48,12 +48,14 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
|||||||
[['product_number', 'barcode'], 'string', 'max' => 20],
|
[['product_number', 'barcode'], 'string', 'max' => 20],
|
||||||
[['name'], 'string', 'max' => 128],
|
[['name'], 'string', 'max' => 128],
|
||||||
[['description'], 'string', 'max' => 255],
|
[['description'], 'string', 'max' => 255],
|
||||||
[['product_number'], 'unique' ],
|
// [['product_number'], 'unique' ],
|
||||||
[['barcode'], 'unique' ],
|
// [['barcode'], 'unique' ],
|
||||||
// a1 and a2 need to be unique together, only a1 will receive error message
|
// a1 and a2 need to be unique together, only a1 will receive error message
|
||||||
// ['a1', 'unique', 'targetAttribute' => ['a1', 'a2']]
|
// ['a1', 'unique', 'targetAttribute' => ['a1', 'a2']]
|
||||||
|
[['barcode','product_number'], 'filter', 'filter' => function($value){return Helper::fixAsciiChars($value);}],
|
||||||
['barcode', 'unique', 'targetAttribute' => ['id_account', 'barcode']],
|
['barcode', 'unique', 'targetAttribute' => ['id_account', 'barcode']],
|
||||||
['product_number', 'unique', 'targetAttribute' => ['id_account', 'product_number']],
|
['product_number', 'unique', 'targetAttribute' => ['id_account', 'product_number']],
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,10 +165,11 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
|||||||
$query = Ticket::find();
|
$query = Ticket::find();
|
||||||
$today = date('Y-m-d');
|
$today = date('Y-m-d');
|
||||||
|
|
||||||
$query->andWhere(['id_card' => $card->id_card]);
|
$query->andWhere(['ticket.id_card' => $card->id_card]);
|
||||||
$query->andWhere( 'start <= :today' ,[ 'today' => $today] );
|
$query->andWhere( 'ticket.start <= :today' ,[ 'today' => $today] );
|
||||||
$query->andWhere( 'end >= :today' ,[ 'today' => $today] );
|
$query->andWhere( 'ticket.end >= :today' ,[ 'today' => $today] );
|
||||||
$query->orderBy([ "created_at" =>SORT_DESC] );
|
$query->andWhere( 'ticket.status = :status' ,[ 'status' => Ticket::STATUS_ACTIVE] );
|
||||||
|
$query->orderBy([ "ticket.created_at" =>SORT_DESC] );
|
||||||
$result = $query->all();
|
$result = $query->all();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
Reference in New Issue
Block a user