Partner Producthchange WIP 2024-07-23
This commit is contained in:
@@ -421,9 +421,32 @@ class ProductController extends mfBaseController {
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
|
||||
|
||||
|
||||
if(!$this->me->isAdmin()) {
|
||||
$my_product_ids = [];
|
||||
$my_network_ids = [];
|
||||
foreach($this->me->my_networks as $network) {
|
||||
$my_network_ids[] = $network->id;
|
||||
}
|
||||
|
||||
foreach(ProductNetworkModel::search(["network_id" => $my_network_ids]) as $pn) {
|
||||
if(!$pn->product->active) continue;
|
||||
if(!array_key_exists($pn->product_id, $my_product_ids)) {
|
||||
$my_product_ids[] = $pn->product_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return bootstrap-autocomplete format
|
||||
foreach($products as $product) {
|
||||
if(!$this->me->isAdmin()) {
|
||||
if(!in_array($product->id, $my_product_ids)) continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$result = ['value' => $product->id, 'text' => str_replace("'", "\\'", str_replace(["\n", "\r"], " ",$product->name))];
|
||||
$results[] = $result;
|
||||
if(count($results) > 15) {
|
||||
|
||||
Reference in New Issue
Block a user