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

@@ -4,7 +4,7 @@ return [
'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.44',
'version' => 'v0.0.45',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global

View File

@@ -0,0 +1,76 @@
<?php
namespace common\models;
use Yii;
use common\components\Helper;
/**
* This is the model class for table "inventory_group".
*
* @property integer $id_inventory_group
* @property string $name
* @property integer $id_product_category
* @property integer $status
* @property string $created_at
* @property string $updated_at
*/
class InventoryGroup extends \common\models\BaseFitnessActiveRecord
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'inventory_group';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_product_category', 'status'], 'integer'],
[['name'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_inventory_group' => Yii::t('common/inventory_group', 'Leltár cs. azon.'),
'name' => Yii::t('common/inventory_group', 'Név'),
'id_product_category' => Yii::t('common/inventory_group', 'Termék kategória'),
'status' => Yii::t('common/inventory_group', 'Státusz'),
'created_at' => Yii::t('common/inventory_group', 'Létrehozva'),
];
}
public function getProductCategory( ) {
return $this->hasOne(ProductCategory::className(),[ "id_product_category" => "id_product_category" ]);
}
public function getProductCategoryName( ) {
$result = "";
$cat = $this->productCategory;
if ( isset($cat)){
$result = $cat->name;
}
return $result;
}
}

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 (), [