|
|
@@ -52,14 +52,21 @@ use common\components\ActiveRecordCommon ; |
|
|
|
* @property double $price |
|
|
|
* @property double $pweight |
|
|
|
* @property string $recipe |
|
|
|
* @property string $unit |
|
|
|
* @property double $step |
|
|
|
*/ |
|
|
|
class Product extends ActiveRecordCommon |
|
|
|
{ |
|
|
|
var $total = 0; |
|
|
|
var $apply_distributions = false ; |
|
|
|
|
|
|
|
const SALE_MODE_UNIT = 'unit' ; |
|
|
|
const SALE_MODE_WEIGHT = 'weight' ; |
|
|
|
public static $unitsArray = [ |
|
|
|
'piece' => ['unit' => 'pièce', 'coefficient' => 1], |
|
|
|
'g' => ['unit' => 'g', 'coefficient' => 1000], |
|
|
|
'kg' => ['unit' => 'kg', 'coefficient' => 1], |
|
|
|
'mL' => ['unit' => 'mL', 'coefficient' => 1000], |
|
|
|
'L' => ['unit' => 'L', 'coefficient' => 1], |
|
|
|
]; |
|
|
|
|
|
|
|
/** |
|
|
|
* @inheritdoc |
|
|
@@ -78,9 +85,9 @@ class Product extends ActiveRecordCommon |
|
|
|
[['name', 'id_producer'], 'required'], |
|
|
|
[['active', 'order', 'quantity_max', 'id_producer'], 'integer'], |
|
|
|
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'unavailable','apply_distributions'], 'boolean'], |
|
|
|
[['price', 'weight'], 'number'], |
|
|
|
[['price', 'weight', 'step'], 'number'], |
|
|
|
[[ 'photo'], 'file'], |
|
|
|
[['name', 'description', 'photo'], 'string', 'max' => 255], |
|
|
|
[['name', 'description', 'photo', 'unit'], 'string', 'max' => 255], |
|
|
|
[['recipe'], 'string', 'max' => 1000], |
|
|
|
]; |
|
|
|
} |
|
|
@@ -109,7 +116,9 @@ class Product extends ActiveRecordCommon |
|
|
|
'order' => 'Ordre', |
|
|
|
'quantity_max' => 'Quantité max par défaut', |
|
|
|
'unavailable' => 'Épuisé', |
|
|
|
'apply_distributions' => 'Appliquer ces modifications dans les distributions futures' |
|
|
|
'apply_distributions' => 'Appliquer ces modifications dans les distributions futures', |
|
|
|
'unit' => 'Unité', |
|
|
|
'step' => 'Pas' |
|
|
|
]; |
|
|
|
} |
|
|
|
|