]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-279] уникальный мобильный, уборка окрамляющих пробелов в имени
authorAlexander Smirnov <fredeom@mail.ru>
Mon, 13 Jan 2025 11:45:51 +0000 (14:45 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Mon, 13 Jan 2025 11:45:51 +0000 (14:45 +0300)
erp24/actions/grade/AdminUpdateAction.php
erp24/records/Admin.php

index c4db7f36b7454bff746cdf394e6223d84b5849ac..428b67ba4ecf4698d3255568572df7ab13a11904 100644 (file)
@@ -24,6 +24,7 @@ class AdminUpdateAction extends Action
         if (Yii::$app->user->can("updateAdminSettings", ['id' => $model->id])) {
             if (Yii::$app->request->isPost) {
                 $attributes = Yii::$app->request->post()['Admin'];
+                $attributes['name'] = trim($attributes['name']);
                 foreach (['parent_admin_id', 'org_id'] as $fieldName) {
                     if (empty($attributes[$fieldName])) {
                         $attributes[$fieldName] = 0;
index a9cab09753796e493138c50cd3fa7ef593af86a4..dc2923602bd3f996965d0ca8f6bd28b252232e07 100755 (executable)
@@ -119,6 +119,7 @@ class Admin extends ActiveRecord implements IdentityInterface
             [['login_user'], 'string', 'max' => 29],
             [['mobile', 'photo', 'snils'], 'string', 'max' => 25],
             ['mobile', PhoneValidator::class],
+            ['mobile', 'unique'],
             [['description', 'adress_fakt'], 'string', 'max' => 255],
             [['avatarka'], 'string', 'max' => 125],
             [['passport_nomer'], 'string', 'max' => 12],