1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Finance module for HiPanel |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/hipanel-module-finance |
6
|
|
|
* @package hipanel-module-finance |
7
|
|
|
* @license BSD-3-Clause |
8
|
|
|
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hipanel\modules\finance\models; |
12
|
|
|
|
13
|
|
|
use hipanel\base\SearchModelTrait; |
14
|
|
|
use Yii; |
15
|
|
|
|
16
|
|
View Code Duplication |
class PriceSearch extends Price |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
use SearchModelTrait { |
19
|
|
|
searchAttributes as defaultSearchAttributes; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
protected function searchAttributes() |
23
|
|
|
{ |
24
|
|
|
return array_merge(self::defaultSearchAttributes(), [ |
25
|
|
|
'object_name_ilike', |
26
|
|
|
'buyer_ilike', |
27
|
|
|
'plan_owner_ilike', |
28
|
|
|
'model_group_name_ilike', |
29
|
|
|
'model_partno_ilike', |
30
|
|
|
]); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function attributeLabels() |
34
|
|
|
{ |
35
|
|
|
return array_merge(parent::attributeLabels(), [ |
36
|
|
|
'currency_in' => Yii::t('hipanel', 'Currency'), |
37
|
|
|
'object_name_ilike' => Yii::t('hipanel.finance.price', 'Object name'), |
38
|
|
|
'plan_name_ilike' => Yii::t('hipanel.finance.price', 'Tariff plan name'), |
39
|
|
|
'buyer_ilike' => Yii::t('hipanel.finance.price', 'Tariff plan buyer'), |
40
|
|
|
'plan_owner_ilike' => Yii::t('hipanel.finance.price', 'Tariff plan owner'), |
41
|
|
|
'model_group_name_ilike' => Yii::t('hipanel.finance.price', 'Group model name'), |
42
|
|
|
'model_partno_ilike' => Yii::t('hipanel.finance.price', 'Model partno'), |
43
|
|
|
]); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.