change procurement product selection, keytoggle redirect change

This commit is contained in:
2016-03-01 21:18:39 +01:00
parent b07bc4eca9
commit 80b8f5a238
12 changed files with 184 additions and 35 deletions

View File

@@ -244,6 +244,22 @@ class Product extends \common\models\BaseFitnessActiveRecord {
]);
}
public static function modelToMapIdNameLong($product,$default = null){
if ( $product == null ){
return $default;
}
return ArrayHelper::toArray($product, [
'common\models\Product' => [
'id_product',
'name' => function ($product) {
return $product->name . " - " .$product->productCategoryName . " (" . $product->accountName . ")";
},
],
]);
}
public static function sellProduct($product,$count){
$product->stock = $product->stock - $count;
}