Commit d2f96f39fc5a634ab24ef45781d3fcb40df3be20

Authored by Alex Savenko
1 parent c9d4713b

strtotime

Showing 1 changed file with 9 additions and 4 deletions   Show diff stats
src/app/backend/controllers/DiscountController.php
@@ -91,15 +91,20 @@ class DiscountController extends Controller @@ -91,15 +91,20 @@ class DiscountController extends Controller
91 } 91 }
92 else { 92 else {
93 93
94 - if(!empty($data['group_ids']) && $this->models->getDiscount()->addData( $data )) { 94 + if(empty($data['group_ids'])) {
95 95
96 - $this->flash->success( 'Сохранение прошло успешно' );  
97 - return $this->response->redirect([ 'for' => 'discount_index' ]); 96 + $this->flash->error( 'Выберите товары на которые распространяется скидка' );
  97 +
  98 + }
  99 + elseif (!$this->models->getDiscount()->addData( $data )) {
  100 +
  101 + $this->flash->error( 'Произошла внутренняя ошибка сервера' );
98 102
99 } 103 }
100 else { 104 else {
101 105
102 - $this->flash->error( 'Выберите товары на которые распространяется скидка' ); 106 + $this->flash->success( 'Сохранение прошло успешно' );
  107 + return $this->response->redirect([ 'for' => 'discount_index' ]);
103 108
104 } 109 }
105 110