@@ 68-100 (lines=33) @@ | ||
65 | $model->loadDefaultValues(); |
|
66 | } |
|
67 | ||
68 | if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
69 | if ($model->save()) { |
|
70 | ||
71 | Yii::$app->session->setFlash('info', Yii::t('app', 'Object saved')); |
|
72 | $returnUrl = Yii::$app->request->get( |
|
73 | 'returnUrl', |
|
74 | ['/shop/backend-discount/index'] |
|
75 | ); |
|
76 | switch (Yii::$app->request->post('action', 'save')) { |
|
77 | case 'next': |
|
78 | return $this->redirect( |
|
79 | [ |
|
80 | '/shop/backend-discount/edit', |
|
81 | 'returnUrl' => $returnUrl, |
|
82 | ] |
|
83 | ); |
|
84 | case 'back': |
|
85 | return $this->redirect($returnUrl); |
|
86 | default: |
|
87 | return $this->redirect( |
|
88 | Url::toRoute( |
|
89 | [ |
|
90 | '/shop/backend-discount/edit', |
|
91 | 'id' => $model->id, |
|
92 | 'returnUrl' => $returnUrl, |
|
93 | ] |
|
94 | ) |
|
95 | ); |
|
96 | } |
|
97 | } |
|
98 | ||
99 | ||
100 | } |
|
101 | ||
102 | if (Yii::$app->request->isPost && !$model->isNewRecord) { |
|
103 | foreach ($model::getTypeObjects() as $object) { |
@@ 98-129 (lines=32) @@ | ||
95 | } |
|
96 | ||
97 | ||
98 | if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
99 | if ($model->save()) { |
|
100 | Yii::$app->session->setFlash('info', Yii::t('app', 'Object saved')); |
|
101 | $returnUrl = Yii::$app->request->get( |
|
102 | 'returnUrl', |
|
103 | ['/shop/backend-warehouse/index'] |
|
104 | ); |
|
105 | switch (Yii::$app->request->post('action', 'save')) { |
|
106 | case 'next': |
|
107 | return $this->redirect( |
|
108 | [ |
|
109 | '/shop/backend-warehouse/edit', |
|
110 | 'returnUrl' => $returnUrl, |
|
111 | ] |
|
112 | ); |
|
113 | case 'back': |
|
114 | return $this->redirect($returnUrl); |
|
115 | default: |
|
116 | return $this->redirect( |
|
117 | Url::toRoute( |
|
118 | [ |
|
119 | '/shop/backend-warehouse/edit', |
|
120 | 'id' => $model->id, |
|
121 | 'returnUrl' => $returnUrl, |
|
122 | ] |
|
123 | ) |
|
124 | ); |
|
125 | } |
|
126 | } |
|
127 | ||
128 | ||
129 | } |
|
130 | ||
131 | $wareHouseOpeningHours = WarehouseOpeninghours::find()->where(['warehouse_id' => $model->id])->one(); |
|
132 | if ($wareHouseOpeningHours === null) { |