|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace hipanel\modules\finance\models; |
|
4
|
|
|
|
|
5
|
|
|
use Yii; |
|
6
|
|
|
|
|
7
|
|
|
class Sale extends \hipanel\base\Model |
|
8
|
|
|
{ |
|
9
|
|
|
use \hipanel\base\ModelTrait; |
|
10
|
|
|
|
|
11
|
|
|
const SALE_TYPE_IP = 'ip'; |
|
12
|
|
|
const SALE_TYPE_SERVER = 'server'; |
|
13
|
|
|
const SALE_TYPE_ACCOUNT = 'account'; |
|
14
|
|
|
const SALE_TYPE_CLIENT = 'client'; |
|
15
|
|
|
|
|
16
|
|
|
public function rules() |
|
17
|
|
|
{ |
|
18
|
|
|
return array_merge(parent::rules(), [ |
|
19
|
|
|
[['id', 'buyer_id', 'seller_id', 'object_id', 'tariff_id'], 'integer'], |
|
20
|
|
|
[[ |
|
21
|
|
|
'object', |
|
22
|
|
|
'object_like', |
|
23
|
|
|
'seller', |
|
24
|
|
|
'login', |
|
25
|
|
|
'buyer', |
|
26
|
|
|
'tariff', |
|
27
|
|
|
'time', |
|
28
|
|
|
'expires', |
|
29
|
|
|
'renewed_num', |
|
30
|
|
|
'sub_factor', |
|
31
|
|
|
'tariff_type', |
|
32
|
|
|
'is_grouping', |
|
33
|
|
|
'from_old', |
|
34
|
|
|
], 'string'], |
|
35
|
|
|
]); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function attributeLabels() |
|
39
|
|
|
{ |
|
40
|
|
|
return array_merge(parent::attributeLabels(), [ |
|
41
|
|
|
'time' => Yii::t('hipanel:finance:sale', 'Time'), |
|
42
|
|
|
'object' => Yii::t('hipanel:finance:sale', 'Object'), |
|
43
|
|
|
'object_like' => Yii::t('hipanel:finance:sale', 'Object'), |
|
44
|
|
|
'buyer' => Yii::t('hipanel:finance:sale', 'Buyer'), |
|
45
|
|
|
'buyer_id' => Yii::t('hipanel:finance:sale', 'Buyer'), |
|
46
|
|
|
'seller' => Yii::t('hipanel:finance:sale', 'Seller'), |
|
47
|
|
|
'seller_id' => Yii::t('hipanel:finance:sale', 'Seller'), |
|
48
|
|
|
'tariff_id' => Yii::t('hipanel:finance', 'Tariff'), |
|
49
|
|
|
'tariff_type' => Yii::t('hipanel', 'Type'), |
|
50
|
|
|
]); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getTypes() |
|
54
|
|
|
{ |
|
55
|
|
|
return [ |
|
56
|
|
|
self::SALE_TYPE_SERVER => Yii::t('hipanel:finance', 'Servers'), |
|
57
|
|
|
self::SALE_TYPE_IP => 'IP', |
|
58
|
|
|
self::SALE_TYPE_ACCOUNT => Yii::t('hipanel:hosting', 'Accounts'), |
|
59
|
|
|
self::SALE_TYPE_CLIENT => Yii::t('hipanel', 'Clients'), |
|
60
|
|
|
]; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|