From: Aleksey Filippov Date: Fri, 15 Mar 2024 11:15:38 +0000 (+0300) Subject: fix set actual code X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=911aa690e2530ed5f8eb3e1803bcdfe52f88b796;p=yii-erp24%2F.git fix set actual code --- diff --git a/erp24/records/Admin.php b/erp24/records/Admin.php index 98cc247..9c04ccf 100755 --- a/erp24/records/Admin.php +++ b/erp24/records/Admin.php @@ -10,6 +10,7 @@ use yii\db\ActiveRecord; use yii\db\Expression; use yii\helpers\ArrayHelper; use yii\web\IdentityInterface; +use yii_app\api3\core\validators\PhoneValidator; /** * Class Admin @@ -34,6 +35,8 @@ class Admin extends ActiveRecord implements IdentityInterface public $phone; + const SHIFT_HOUR_COUNT_ADMINISTRATOR = 8; + const SHIFT_HOUR_COUNT_FLORIST = 12; const WORK_STATUS_IS_WORK = 1; const WORK_STATUS_FIRED = 4; @@ -52,6 +55,16 @@ class Admin extends ActiveRecord implements IdentityInterface self::PART_TIME_WORKER_GROUP_ID, // Подработчики -1 ]; + const ADMIN_PAYROLL_MAKE_GROUP_IDS = [ + 30, + 35, + 40, + self::PART_TIME_WORKER_GROUP_ID, // Подработчики + self::ADMINISTRATOR_GROUP_ID, // Администраторы + 72, // + 90, // Подработчики (архив) + -1, + ]; const ADMIN_WRITE_OFFS_SINGLE_STORE_GROUP_IDS = [ 30, @@ -61,6 +74,13 @@ class Admin extends ActiveRecord implements IdentityInterface self::PART_TIME_WORKER_GROUP_ID, // Подработчики -1 ]; + const ADMIN_WORK_GROUP_IDS = [ + 30, + 35, + 40, + self::ADMINISTRATOR_GROUP_ID, // Администраторы + 72, // + ]; public $imageFile; @@ -69,7 +89,7 @@ class Admin extends ActiveRecord implements IdentityInterface public static function tableName() { - return '{{%admin}}'; + return 'admin'; } public function rules() @@ -91,6 +111,7 @@ class Admin extends ActiveRecord implements IdentityInterface [['group_name', 'pass_user', 'grazhdanstvo', 'passport_seriya'], 'string', 'max' => 120], [['login_user'], 'string', 'max' => 29], [['mobile', 'photo', 'snils'], 'string', 'max' => 25], + ['mobile', PhoneValidator::class], [['description', 'adress_fakt'], 'string', 'max' => 255], [['avatarka'], 'string', 'max' => 125], [['passport_nomer'], 'string', 'max' => 12], @@ -372,6 +393,23 @@ class Admin extends ActiveRecord implements IdentityInterface ->column(); } + public static function getAdminGuidNames(): array + { + $groupIds = Admin::ADMIN_CABINET_GROUP_IDS; + $notInStoreIds = Admin::NOT_IN_STORE_IDS; + + $adminFloristPrepared = Admin::getAdmins('', $groupIds, 'ASC', null, '', $notInStoreIds, true); + + $adminGuidNames = []; + foreach ($adminFloristPrepared as $key => $row) { + if (!empty($row['exportImportTable'])) { + $adminGuidNames[$row['exportImportTable']['export_val']] = $row['name']; + } + } + + return $adminGuidNames; + } + /** * @param $ids * @param $groupId @@ -441,10 +479,10 @@ class Admin extends ActiveRecord implements IdentityInterface } elseif ($orderByName == 'DESC') { $query->orderBy([self::tableName() . '.name_full' => SORT_DESC]); } + } else { + $query->orderBy([self::tableName() . '.store_id' => SORT_ASC]); } - $query->orderBy([self::tableName() . '.store_id' => SORT_ASC]); - $action = $query->createCommand()->getRawSql(); return $query->asArray()->all();