From: Alexander Smirnov Date: Thu, 8 Aug 2024 16:06:09 +0000 (+0300) Subject: [ERP-135] Добавлены фильтры на visible = 1 и view = 1 X-Git-Tag: 1.7~224^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=c210a70a96ef880da563fa484a0a3001b4a3b59d;p=erp24_rep%2Fyii-erp24%2F.git [ERP-135] Добавлены фильтры на visible = 1 и view = 1 --- diff --git a/erp24/actions/teambonus/SettingsAction.php b/erp24/actions/teambonus/SettingsAction.php index 0ad6bce9..84ae0185 100644 --- a/erp24/actions/teambonus/SettingsAction.php +++ b/erp24/actions/teambonus/SettingsAction.php @@ -62,7 +62,7 @@ class SettingsAction extends Action { $months [$i] = ['Январь','Февраль','Март','Апрель','Май','Июнь', 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'][$i-1]; } - $stores = ArrayHelper::map(CityStore::find()->all(), 'id', 'name'); + $stores = ArrayHelper::map(CityStore::find()->andWhere(['visible' => '1'])->all(), 'id', 'name'); $tbSettings = []; $teambonusSettings = TeambonusSettings::find()->where(['year' => $filterModel->year, 'month' => $filterModel->month]) diff --git a/erp24/api3/core/services/ReportService.php b/erp24/api3/core/services/ReportService.php index 273d4711..741637c9 100644 --- a/erp24/api3/core/services/ReportService.php +++ b/erp24/api3/core/services/ReportService.php @@ -420,7 +420,7 @@ class ReportService $reports = []; - $cityStoreNames = ArrayHelper::map(CityStore::find()->all(), 'id', 'name'); + $cityStoreNames = ArrayHelper::map(CityStore::find()->where(['visible' => '1'])->all(), 'id', 'name'); $eitStores = ExportImportTable::find()->where(['export_val' => $data->stores]) ->select(['entity_id', 'export_val']) diff --git a/erp24/controllers/TimetableFactController.php b/erp24/controllers/TimetableFactController.php index a2341a93..944380b2 100644 --- a/erp24/controllers/TimetableFactController.php +++ b/erp24/controllers/TimetableFactController.php @@ -81,7 +81,7 @@ class TimetableFactController extends Controller $timetableFactModelQuery->orderBy(['date_shift' => SORT_DESC]); } - $storeArr = CityStore::find()->all(); + $storeArr = CityStore::find()->andWhere(['visible' => '1'])->all(); $stores = [0 => 'Любой']; foreach ($storeArr as $store) { $stores[$store->id] = $store->name; diff --git a/erp24/forms/timetable/TabelSearchForm.php b/erp24/forms/timetable/TabelSearchForm.php index 53147b2f..197a7566 100755 --- a/erp24/forms/timetable/TabelSearchForm.php +++ b/erp24/forms/timetable/TabelSearchForm.php @@ -52,6 +52,7 @@ class TabelSearchForm extends Model $stores = CityStore::find() ->select(['name', 'id']) ->andWhere(['id' => $_SESSION["store_arr_dostup"]]) + ->andWhere(['visible' => '1']) ->indexBy('id') ->cache(3600) ->column(); diff --git a/erp24/forms/timetable/TabelSearchFormFact.php b/erp24/forms/timetable/TabelSearchFormFact.php index 40be10f7..4d3073ca 100755 --- a/erp24/forms/timetable/TabelSearchFormFact.php +++ b/erp24/forms/timetable/TabelSearchFormFact.php @@ -52,6 +52,7 @@ class TabelSearchFormFact extends Model return CityStore::find() ->select(['name', 'id']) ->andWhere(['id' => $_SESSION["store_arr_dostup"]]) + ->andWhere(['visible' => '1']) ->indexBy('id') ->cache(3600) ->column(); diff --git a/erp24/records/Admin.php b/erp24/records/Admin.php index 9c04ccf9..b4fdb19f 100755 --- a/erp24/records/Admin.php +++ b/erp24/records/Admin.php @@ -361,7 +361,7 @@ class Admin extends ActiveRecord implements IdentityInterface public function getStore(): ActiveQueryInterface { - return $this->hasOne(CityStore::class, ['id' => 'store_id']); + return $this->hasOne(CityStore::class, ['id' => 'store_id'])->andWhere(['visible' => '1']); } /** diff --git a/erp24/records/CityStore.php b/erp24/records/CityStore.php index 8bfbc4eb..e8b9dc77 100755 --- a/erp24/records/CityStore.php +++ b/erp24/records/CityStore.php @@ -231,6 +231,7 @@ class CityStore extends ActiveRecord $values = self::find() ->andWhere(['id' => DashboardSales::getActiveCityStore()]) + ->andWhere(['visible' => '1']) ->orderBy([self::tableName() . '.name' => SORT_ASC]) ->all(); @@ -295,7 +296,7 @@ class CityStore extends ActiveRecord public static function getNames(array $storeIds = []): array { - $query = self::find()->select(['name', 'id']); + $query = self::find()->select(['name', 'id'])->andWhere(['visible' => '1']); if (!empty($storeIds)) { $query->andWhere(['id' => $storeIds]); diff --git a/erp24/records/Products1c.php b/erp24/records/Products1c.php index f356eae0..11b180ee 100644 --- a/erp24/records/Products1c.php +++ b/erp24/records/Products1c.php @@ -70,6 +70,7 @@ class Products1c extends \yii\db\ActiveRecord ->select(['name', 'id']) ->indexBy('id') ->andWhere('tip=:tip', [':tip' => $tip]) + ->andWhere(['view' => 1]) ->column(); } diff --git a/erp24/records/WriteOffsErpSearch.php b/erp24/records/WriteOffsErpSearch.php index 25514153..3bab7a10 100644 --- a/erp24/records/WriteOffsErpSearch.php +++ b/erp24/records/WriteOffsErpSearch.php @@ -79,6 +79,7 @@ class WriteOffsErpSearch extends WriteOffsErp $query->joinWith(['cityStore']); // add conditions that should always apply here + $query->andWhere(['city_store.visible' => '1']); $dataProvider = new ActiveDataProvider([ 'query' => $query,