forked from hiqdev/hipanel-module-stock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPartSellByPlanForm.php
50 lines (42 loc) · 1.29 KB
/
PartSellByPlanForm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace hipanel\modules\stock\forms;
use hipanel\modules\stock\models\Part;
use Yii;
class PartSellByPlanForm extends Part
{
public static function tableName()
{
return 'part';
}
public function attributes()
{
return array_merge(parent::attributes(), ['contact_id', 'client_id', 'time', 'description', 'ids', 'plan_id', 'reason']);
}
public function rules()
{
return array_merge(parent::rules(), [
[['contact_id', 'time', 'plan_id'], 'required'],
[['plan_id'], 'integer'],
[['client_id', 'contact_id'], 'integer'],
[['description'], 'string'],
[['reason'], 'string'],
[['ids'], 'each', 'rule' => ['integer']],
]);
}
public function attributeLabels()
{
return array_merge(parent::attributeLabels(), [
'time' => Yii::t('hipanel:stock', 'Sell datetime'),
'plan_id' => Yii::t('hipanel:stock', 'Tariff plan'),
'contact_id' => Yii::t('hipanel', 'Contact'),
'description' => Yii::t('hipanel', 'Description'),
'reason' => Yii::t('hipanel', 'Reason'),
]);
}
public function scenarioActions(): array
{
return [
'sell-by-plan' => 'sell-by-plan',
];
}
}