implement feature 'put to cart ticket installment request'
This commit is contained in:
@@ -64,4 +64,5 @@ return [
|
||||
'ticket_type_door_allowed_check_on' => false,
|
||||
'warn_ticket_expire_in_days_count' => 3,
|
||||
'warn_ticket_expire_in_usage_count' => 3,
|
||||
'inventory.products.only.active' => true
|
||||
];
|
||||
|
||||
@@ -71,7 +71,7 @@ class Inventory extends \common\models\BaseFitnessActiveRecord
|
||||
}
|
||||
|
||||
|
||||
public function validateOnlyClosed($attribute,$params){
|
||||
public function validateOnlyClosed( ){
|
||||
$opened = Inventory::find()->andWhere(['status' => Inventory::$STATUS_OPEN])->all();
|
||||
if ( count($opened) > 0 ){
|
||||
$this->addError("name","Kérem előbb zárjon le minden másik leltárt");
|
||||
@@ -93,7 +93,12 @@ class Inventory extends \common\models\BaseFitnessActiveRecord
|
||||
]
|
||||
], parent::behaviors());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $insert
|
||||
* @param $changedAttributes
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function afterSave($insert, $changedAttributes){
|
||||
if ( $insert ){
|
||||
|
||||
@@ -101,12 +106,18 @@ class Inventory extends \common\models\BaseFitnessActiveRecord
|
||||
if ( isset($this->id_account) && is_numeric($this->id_account)){
|
||||
$query->andWhere(['id_account' => $this->id_account]);
|
||||
}
|
||||
|
||||
if ( \Yii::$app->params['inventory.products.only.active']) {
|
||||
$query->andWhere( ['status' => Product::STATUS_ACTIVE] );
|
||||
}
|
||||
|
||||
$products = $query->all();
|
||||
|
||||
$inventoryGroups = InventoryGroup::find()->all();
|
||||
|
||||
|
||||
foreach ($products as $product){
|
||||
|
||||
|
||||
/** @var \common\models\Product $product */
|
||||
foreach ($products as $product){
|
||||
$form = new InventoryItemForm(
|
||||
[
|
||||
'inventory' => $this,
|
||||
@@ -117,8 +128,9 @@ class Inventory extends \common\models\BaseFitnessActiveRecord
|
||||
);
|
||||
$form->save();
|
||||
}
|
||||
|
||||
foreach ($inventoryGroups as $group){
|
||||
|
||||
/** @var \common\models\InventoryGroup $group */
|
||||
foreach ($inventoryGroups as $group){
|
||||
$form = new InventoryItemForm(
|
||||
[
|
||||
'inventory' => $this,
|
||||
|
||||
@@ -36,6 +36,8 @@ use common\components\Helper;
|
||||
*
|
||||
* @property \common\models\Card card
|
||||
* @property \common\models\Ticket transfer
|
||||
* @property \common\models\TicketType ticketType
|
||||
* @property \common\models\Discount discount
|
||||
*/
|
||||
class Ticket extends \common\models\BaseFitnessActiveRecord
|
||||
{
|
||||
|
||||
@@ -342,5 +342,12 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
|
||||
public function getStatusName(){
|
||||
return static::toStatusName($this->status);
|
||||
}
|
||||
|
||||
|
||||
public static function canBePutToCustomerCart($status){
|
||||
return $status == TicketInstallmentRequest::$STATUS_CANCELED
|
||||
||
|
||||
$status == TicketInstallmentRequest::$STATUS_REJECTED
|
||||
||
|
||||
$status == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user