Commit 54d398c7d32c1830a6dd1fb78999ab5d9f27bc4d
1 parent
04c6736e
24.02.16
Showing
3 changed files
with
14 additions
and
22 deletions
Show diff stats
frontend/controllers/AccountsController.php
| ... | ... | @@ -408,15 +408,24 @@ |
| 408 | 408 | if(empty( $user_info )) { |
| 409 | 409 | $user_info = new UserInfo([ 'user_id' => $user->id ]); |
| 410 | 410 | } |
| 411 | + | |
| 411 | 412 | if(empty( $company_info )) { |
| 412 | 413 | $company_info = new CompanyInfo([ 'user_id' => $user->id ]); |
| 413 | 414 | } |
| 415 | + | |
| 414 | 416 | $post = \Yii::$app->request->post(); |
| 415 | 417 | if(!empty( $post )) { |
| 416 | - $user_info->load($post); | |
| 417 | - $company_info->load($post); | |
| 418 | - $user->load($post); | |
| 419 | - if($user_info->save() && $user->save() && $company_info->save()) { | |
| 418 | + | |
| 419 | + | |
| 420 | + if($user_info->load($post)){ | |
| 421 | + $user_info->save(); | |
| 422 | + } | |
| 423 | + | |
| 424 | + if($company_info->load($post)){ | |
| 425 | + $company_info->save(); | |
| 426 | + } | |
| 427 | + | |
| 428 | + if($user->load($post) && $user->save() ) { | |
| 420 | 429 | \Yii::$app->session->setFlash('userinfoupdate', 'Информация успешно обновлена'); |
| 421 | 430 | } else { |
| 422 | 431 | \Yii::$app->session->setFlash('userinfoupdate', 'Ошибка обновления. Проверьте форму'); | ... | ... |
frontend/views/accounts/general.php
| ... | ... | @@ -176,7 +176,7 @@ |
| 176 | 176 | ?> |
| 177 | 177 | </div> |
| 178 | 178 | <div class="input-blocks hide-mail-check"> |
| 179 | - <?= $form->field ($company_info, 'hide_mail', ['options' => ['class' => 'form-group company_info', ], 'template' => "{input}{label}\n{hint}\n{error}"]) | |
| 179 | + <?= $form->field ($company_info, 'hide_mail', ['options' => ['class' => 'form-group', ], 'template' => "{input}{label}\n{hint}\n{error}"]) | |
| 180 | 180 | ->label ('<span></span>не публиковать Email') |
| 181 | 181 | ->checkbox (['checked'=>'checked', 'class'=> 'custom-check'], false); |
| 182 | 182 | ?> | ... | ... |
frontend/views/site/registration.php
| ... | ... | @@ -168,24 +168,9 @@ |
| 168 | 168 | |
| 169 | 169 | </div> |
| 170 | 170 | <script> |
| 171 | - var labelFirstName = $('.field-signupform-firstname label').text(); | |
| 172 | - var labelLastName = $('.field-signupform-lastname label').text(); | |
| 173 | - var companyLabel = 'представителя'; | |
| 174 | - | |
| 175 | - function replaceLabel(){ | |
| 176 | - $('.field-signupform-firstname label').html(labelFirstName) | |
| 177 | - $('.field-signupform-lastname label').html(labelLastName) | |
| 178 | - } | |
| 179 | - | |
| 180 | - function companyReplaceLabel(){ | |
| 181 | - $('.field-signupform-firstname label').html(labelFirstName+' '+companyLabel) | |
| 182 | - $('.field-signupform-lastname label').html(labelLastName+' '+companyLabel) | |
| 183 | - } | |
| 184 | - | |
| 185 | 171 | var registerValCompany = $('.register-val-company .custom-radio:checked').attr('value'); |
| 186 | 172 | var regHideBlock = $('.register-company-block .form-group') |
| 187 | 173 | if(registerValCompany==1) { |
| 188 | - replaceLabel() | |
| 189 | 174 | $('.register-company-block').css('display', 'none'); |
| 190 | 175 | } |
| 191 | 176 | |
| ... | ... | @@ -195,12 +180,10 @@ |
| 195 | 180 | var newRegisterValCompany = +$(this).attr('value'); |
| 196 | 181 | if(newRegisterValCompany==1){ |
| 197 | 182 | //human |
| 198 | - replaceLabel() | |
| 199 | 183 | $('.register-company-block').css('display', 'none'); |
| 200 | 184 | |
| 201 | 185 | } else { |
| 202 | 186 | //company |
| 203 | - companyReplaceLabel() | |
| 204 | 187 | $('.register-company-block').css('display', 'block'); |
| 205 | 188 | } |
| 206 | 189 | ... | ... |