Commit 4a2095671d1dd69e14212b3238da43c27b2cb5a1
Merge branch 'discount' of gitlab.artweb.com.ua:Alex/semena
Showing
1 changed file
with
14 additions
and
4 deletions
Show diff stats
src/app/backend/controllers/DiscountController.php
| @@ -153,18 +153,28 @@ class DiscountController extends Controller | @@ -153,18 +153,28 @@ class DiscountController extends Controller | ||
| 153 | $data[0]['end_date'] = $this->request->getPost('end_date'); | 153 | $data[0]['end_date'] = $this->request->getPost('end_date'); |
| 154 | $data[0]['description'] = $this->request->getPost('description'); | 154 | $data[0]['description'] = $this->request->getPost('description'); |
| 155 | 155 | ||
| 156 | - if($this->models->getDiscount()->updateData( $data[0], $id ) ) { | 156 | + if ($data[0]['discount'] > 100) { |
| 157 | 157 | ||
| 158 | - $this->flash->success( 'Сохранение прошло успешно' ); | ||
| 159 | - return $this->response->redirect([ 'for' => 'discount_index' ]); | 158 | + $this->flash->error( 'Размер скидки не может привышать 100' ); |
| 160 | 159 | ||
| 161 | } | 160 | } |
| 162 | else { | 161 | else { |
| 163 | 162 | ||
| 164 | - $this->flash->error( 'Update error.' ); | 163 | + if($this->models->getDiscount()->updateData( $data[0], $id ) ) { |
| 164 | + | ||
| 165 | + $this->flash->success( 'Сохранение прошло успешно' ); | ||
| 166 | + return $this->response->redirect([ 'for' => 'discount_index' ]); | ||
| 167 | + | ||
| 168 | + } | ||
| 169 | + else { | ||
| 170 | + | ||
| 171 | + $this->flash->error( 'Update error.' ); | ||
| 172 | + | ||
| 173 | + } | ||
| 165 | 174 | ||
| 166 | } | 175 | } |
| 167 | 176 | ||
| 177 | + | ||
| 168 | } | 178 | } |
| 169 | 179 | ||
| 170 | $catalog_temp = $this->common->getTypeSubtype1(NULL, $lang_id)['catalog']; | 180 | $catalog_temp = $this->common->getTypeSubtype1(NULL, $lang_id)['catalog']; |