|
306 | 306 | } |
307 | 307 |
|
308 | 308 | // Define if the thirdparty is a reseller |
309 | | -$mythirdpartyaccount->isareseller = 0; |
| 309 | +$mythirdpartyaccount->isareseller = 0; // TODO Use $mythirdpartyaccount->context['isareseller'] |
310 | 310 | if (getDolGlobalInt('SELLYOURSAAS_DEFAULT_RESELLER_CATEG') > 0) { |
311 | 311 | $categorie=new Categorie($db); |
312 | 312 | $categorie->fetch(getDolGlobalString('SELLYOURSAAS_DEFAULT_RESELLER_CATEG')); |
|
316 | 316 | } |
317 | 317 |
|
318 | 318 | // Define if the thirdparty is a module provider |
319 | | -$mythirdpartyaccount->isamoduleprovider = array(); |
| 319 | +$mythirdpartyaccount->context['isamoduleprovider'] = array(); // TODO Use $mythirdpartyaccount->context['isamoduleprovider'] |
320 | 320 | if (getDolGlobalInt('SELLYOURSAAS_ALLOW_MODULE_PROVIDER_PROGRAM') > 0) { |
321 | | - // TODO Read if there is some product prices in supplier tab of the thirdparty. If yes it is a module provider and we have the list of provided modules |
322 | | - //$mythirdpartyaccount->isamoduleprovider = array('aa', 'bbb'); |
323 | 321 | $sql = "SELECT p.rowid FROM ".MAIN_DB_PREFIX."product as p"; |
324 | 322 | $sql.= " JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; |
325 | 323 | $sql.= " ON pfp.fk_product = p.rowid"; |
326 | | - $sql.= " WHERE pfp.fk_soc = ".$mythirdpartyaccount->id; |
| 324 | + $sql.= " WHERE pfp.fk_soc = ".((int) $mythirdpartyaccount->id); |
| 325 | + |
327 | 326 | $resql=$db->query($sql); |
| 327 | + |
328 | 328 | if ($resql) { |
329 | 329 | $num_rows = $db->num_rows($resql); |
330 | 330 | $i = 0; |
331 | 331 | while ($i < $num_rows) { |
332 | 332 | $obj = $db->fetch_object($resql); |
333 | 333 | if ($obj) { |
334 | | - $mythirdpartyaccount->isamoduleprovider[] = $obj->rowid; |
| 334 | + $mythirdpartyaccount->context['isamoduleprovider'][$obj->rowid] = $obj->rowid; |
335 | 335 | } |
336 | 336 | $i++; |
337 | 337 | } |
|
423 | 423 |
|
424 | 424 | $listofcontractidmodulesupplier = array(); |
425 | 425 | // Load list of child instance for module supplier |
426 | | -if (!empty($mythirdpartyaccount->isamoduleprovider) && in_array($mode, array('mymodulecustomerinstances', 'mymodulecustomerbilling'))) { |
| 426 | +if (!empty($mythirdpartyaccount->context['isamoduleprovider']) && in_array($mode, array('mymodulecustomerinstances', 'mymodulecustomerbilling'))) { |
427 | 427 | $sql = 'SELECT DISTINCT c.rowid'; |
428 | 428 | $sql.= ' FROM '.MAIN_DB_PREFIX.'contrat as c'; |
429 | 429 | $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as d ON d.fk_contrat = c.rowid'; |
430 | 430 | $sql.= ', '.MAIN_DB_PREFIX.'product as p'; |
431 | 431 | $sql.= " WHERE d.fk_product = p.rowid"; |
432 | | - $sql.= " AND d.fk_product IN (".(implode(",", $mythirdpartyaccount->isamoduleprovider)).")"; |
| 432 | + $sql.= " AND d.fk_product IN (".(implode(",", $mythirdpartyaccount->context['isamoduleprovider'])).")"; |
433 | 433 | $sql.= " AND d.statut = 4"; |
434 | 434 |
|
435 | 435 | if ($search_instance_name) { |
|
2461 | 2461 | '; |
2462 | 2462 | } |
2463 | 2463 |
|
2464 | | -if (count($mythirdpartyaccount->isamoduleprovider) > 0) { |
| 2464 | +if (count($mythirdpartyaccount->context['isamoduleprovider']) > 0) { |
2465 | 2465 | print ' |
2466 | 2466 | <li class="nav-item'.(($mode == 'mymodulecustomerinstances' || $mode == 'mymodulecustomerbilling') ? ' active' : '').' dropdown"> |
2467 | 2467 | <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-suitcase"></i> '.$langs->trans("ModuleProviderArea").'</a> |
|
0 commit comments