add transfer#list pdf download, fix helper#fixascii function
This commit is contained in:
@@ -50,6 +50,10 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
||||
[['description'], 'string', 'max' => 255],
|
||||
[['product_number'], 'unique' ],
|
||||
[['barcode'], 'unique' ],
|
||||
// a1 and a2 need to be unique together, only a1 will receive error message
|
||||
// ['a1', 'unique', 'targetAttribute' => ['a1', 'a2']]
|
||||
['barcode', 'unique', 'targetAttribute' => ['id_account', 'barcode']],
|
||||
['product_number', 'unique', 'targetAttribute' => ['id_account', 'product_number']],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -143,13 +147,13 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
||||
|
||||
if ( $forceIncludeObjectWithId == null){
|
||||
$query = Product::find()->andWhere(['status' => Product::STATUS_ACTIVE])->orderBy(['product.name' => SORT_ASC]);
|
||||
if ( $account )
|
||||
if ( Helper::isProductVisibilityAccount() && $account )
|
||||
$query->andWhere(["product.id_account" => $account]);
|
||||
|
||||
$result = $query->all();
|
||||
}else{
|
||||
$query = Product::find()->andWhere( ['or', ['status' => Product::STATUS_ACTIVE], ['id_product' => $forceIncludeObjectWithId ] ])->orderBy(['product.name' => SORT_ASC]);
|
||||
if ( $account )
|
||||
if ( Helper::isProductVisibilityAccount() && $account )
|
||||
$query->andWhere(["product.id_account" => $account]);
|
||||
|
||||
$result = $query->all();
|
||||
@@ -163,16 +167,20 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
||||
$result = [];
|
||||
$product = null;
|
||||
|
||||
$products = Product::find()
|
||||
$query = Product::find()
|
||||
->andWhere(
|
||||
['or',
|
||||
['product_number' => $query ],
|
||||
['barcode' => $query ],
|
||||
]
|
||||
)->andWhere(['status' =>Product::STATUS_ACTIVE])
|
||||
->andFilterWhere(['product.id_account' => $account])
|
||||
->all();
|
||||
)->andWhere(['status' =>Product::STATUS_ACTIVE]);
|
||||
|
||||
if ( Helper::isProductVisibilityAccount() && $account ){
|
||||
$query->andFilterWhere(['product.id_account' => $account]);
|
||||
}
|
||||
|
||||
|
||||
$products = $query->all();
|
||||
|
||||
if ( count($products) == 1 ){
|
||||
$product = $products[0];
|
||||
|
||||
Reference in New Issue
Block a user