From: Alexander Smirnov Date: Mon, 13 Jan 2025 11:45:51 +0000 (+0300) Subject: [ERP-279] уникальный мобильный, уборка окрамляющих пробелов в имени X-Git-Tag: 1.7~87^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=0e15540d2c94caf096f93d293abb7a39c91d0fa1;p=erp24_rep%2Fyii-erp24%2F.git [ERP-279] уникальный мобильный, уборка окрамляющих пробелов в имени --- diff --git a/erp24/actions/grade/AdminUpdateAction.php b/erp24/actions/grade/AdminUpdateAction.php index c4db7f36..428b67ba 100644 --- a/erp24/actions/grade/AdminUpdateAction.php +++ b/erp24/actions/grade/AdminUpdateAction.php @@ -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; diff --git a/erp24/records/Admin.php b/erp24/records/Admin.php index a9cab097..dc292360 100755 --- a/erp24/records/Admin.php +++ b/erp24/records/Admin.php @@ -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],