add inventory group

This commit is contained in:
2016-02-29 20:51:54 +01:00
parent 3926498f3e
commit b196b86746
19 changed files with 589 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ class Product extends \common\models\BaseFitnessActiveRecord {
{
return [
[['id_product_category', 'id_account', 'name'], 'required'],
[['id_product_category', 'id_account', 'purchase_price', 'sale_price', 'profit_margins', 'status'], 'integer'],
[['id_inventory_group', 'id_product_category', 'id_account', 'purchase_price', 'sale_price', 'profit_margins', 'status'], 'integer'],
[['product_number', 'barcode'], 'string', 'max' => 20],
[['product_number', 'barcode'], 'filter', 'filter' => 'trim', 'skipOnArray' => true],
[['name'], 'string', 'max' => 128],
@@ -87,6 +87,7 @@ class Product extends \common\models\BaseFitnessActiveRecord {
'description' => Yii::t('common/product', 'Description'),
'created_at' => Yii::t('common/product', 'Created At'),
'updated_at' => Yii::t('common/product', 'Updated At'),
'id_inventory_group' => Yii::t('common/product', 'Leltár csoport'),
];
}
@@ -99,6 +100,20 @@ class Product extends \common\models\BaseFitnessActiveRecord {
public function getAccountName() {
return $this->account->name;
}
public function getInventoryGroup() {
return $this->hasOne ( InventoryGroup::className (), [
'id_inventory_group' => 'id_inventory_group'
] );
}
public function getInventoryGroupName() {
$result = "";
$inventoryGroup = $this->inventoryGroup;
if ( isset($inventoryGroup)){
$result = $inventoryGroup->name;
}
return $result;
}
public function getProductCategory() {
return $this->hasOne ( ProductCategory::className (), [