Commit a33b71b565f35a496f7edef06ecf694c5588c1ec

Authored by Yarik
1 parent 7138a911

test

common/models/Vacancy.php
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 { 64 {
65 return [ 65 return [
66 [ 66 [
67 - [ 'name', 'description', 'city', 'link', 'specializationInput' ], 67 + [ 'name', 'description', 'city', 'link' ],
68 'required', 68 'required',
69 ], 69 ],
70 [ 70 [
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 'string', 72 'string',
73 ], 73 ],
74 [ 74 [
75 - [ 'employmentInput', ], 75 + [ 'employmentInput', 'specializationInput' ],
76 'safe', 76 'safe',
77 ], 77 ],
78 [ 78 [
frontend/controllers/AccountsController.php
@@ -990,6 +990,11 @@ @@ -990,6 +990,11 @@
990 if(!empty( $post )) { 990 if(!empty( $post )) {
991 $vacancy->load($post); 991 $vacancy->load($post);
992 $vacancy->validate(); 992 $vacancy->validate();
  993 + if(empty($vacancy->specializationInput)) {
  994 + $vacancy->addError('specializationInput', 'Cannot be blank');
  995 + } else {
  996 + $vacancy->clearErrors('specializationInput');
  997 + }
993 if(!$vacancy->hasErrors()) { 998 if(!$vacancy->hasErrors()) {
994 $vacancy->save(); 999 $vacancy->save();
995 Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru'); 1000 Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru');
@@ -1049,6 +1054,11 @@ @@ -1049,6 +1054,11 @@
1049 if(!empty( $post )) { 1054 if(!empty( $post )) {
1050 $vacancy->load($post); 1055 $vacancy->load($post);
1051 $vacancy->validate(); 1056 $vacancy->validate();
  1057 + if(empty($vacancy->specializationInput)) {
  1058 + $vacancy->addError('specializationInput', 'Cannot be blank');
  1059 + } else {
  1060 + $vacancy->clearErrors('specializationInput');
  1061 + }
1052 if(!$vacancy->hasErrors()) { 1062 if(!$vacancy->hasErrors()) {
1053 $vacancy->save(); 1063 $vacancy->save();
1054 Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru'); 1064 Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru');