Skip to content

Commit 296eaa4

Browse files
committed
Clean code to avoid warning property does not exists
1 parent 55a6a99 commit 296eaa4

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

myaccount/index.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
}
307307

308308
// Define if the thirdparty is a reseller
309-
$mythirdpartyaccount->isareseller = 0;
309+
$mythirdpartyaccount->isareseller = 0; // TODO Use $mythirdpartyaccount->context['isareseller']
310310
if (getDolGlobalInt('SELLYOURSAAS_DEFAULT_RESELLER_CATEG') > 0) {
311311
$categorie=new Categorie($db);
312312
$categorie->fetch(getDolGlobalString('SELLYOURSAAS_DEFAULT_RESELLER_CATEG'));
@@ -316,22 +316,22 @@
316316
}
317317

318318
// Define if the thirdparty is a module provider
319-
$mythirdpartyaccount->isamoduleprovider = array();
319+
$mythirdpartyaccount->context['isamoduleprovider'] = array(); // TODO Use $mythirdpartyaccount->context['isamoduleprovider']
320320
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');
323321
$sql = "SELECT p.rowid FROM ".MAIN_DB_PREFIX."product as p";
324322
$sql.= " JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
325323
$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+
327326
$resql=$db->query($sql);
327+
328328
if ($resql) {
329329
$num_rows = $db->num_rows($resql);
330330
$i = 0;
331331
while ($i < $num_rows) {
332332
$obj = $db->fetch_object($resql);
333333
if ($obj) {
334-
$mythirdpartyaccount->isamoduleprovider[] = $obj->rowid;
334+
$mythirdpartyaccount->context['isamoduleprovider'][$obj->rowid] = $obj->rowid;
335335
}
336336
$i++;
337337
}
@@ -423,13 +423,13 @@
423423

424424
$listofcontractidmodulesupplier = array();
425425
// 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'))) {
427427
$sql = 'SELECT DISTINCT c.rowid';
428428
$sql.= ' FROM '.MAIN_DB_PREFIX.'contrat as c';
429429
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as d ON d.fk_contrat = c.rowid';
430430
$sql.= ', '.MAIN_DB_PREFIX.'product as p';
431431
$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'])).")";
433433
$sql.= " AND d.statut = 4";
434434

435435
if ($search_instance_name) {
@@ -2461,7 +2461,7 @@
24612461
';
24622462
}
24632463

2464-
if (count($mythirdpartyaccount->isamoduleprovider) > 0) {
2464+
if (count($mythirdpartyaccount->context['isamoduleprovider']) > 0) {
24652465
print '
24662466
<li class="nav-item'.(($mode == 'mymodulecustomerinstances' || $mode == 'mymodulecustomerbilling') ? ' active' : '').' dropdown">
24672467
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-suitcase"></i> '.$langs->trans("ModuleProviderArea").'</a>

myaccount/tpl/mymodulecustomerbilling.tpl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@
263263
$sql.= ' WHERE fd.fk_facture = f.rowid';
264264
$sql.= ' AND fd.fk_product = p.rowid';
265265
$sql.= ' AND fpf.fk_product = p.rowid';
266-
$sql.= ' AND fd.fk_product IN ('.implode(",", $mythirdpartyaccount->isamoduleprovider).')';
266+
$sql.= ' AND fd.fk_product IN ('.implode(",", $mythirdpartyaccount->context['isamoduleprovider']).')';
267267

268268
$sql.=$db->order($sortfield2, $sortorder2);
269269

@@ -407,7 +407,7 @@
407407
//$sql.=' WHERE fe.reseller IN ('.join(',', $listofcustomeridreseller).')';
408408
$sql.= ', '.MAIN_DB_PREFIX.'facturedet as fd';
409409
$sql.= ' WHERE fd.fk_facture = f.rowid';
410-
$sql.=' AND fd.fk_product IN ('.implode(",", $mythirdpartyaccount->isamoduleprovider).')';
410+
$sql.=' AND fd.fk_product IN ('.implode(",", $mythirdpartyaccount->context['isamoduleprovider']).')';
411411
$sql.=' AND fk_statut <> '.Facture::STATUS_DRAFT;
412412
$sql.=' AND paye = 1';
413413

myaccount/tpl/mymodulecustomerinstances.tpl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
} else {
295295
$total_ht = 0;
296296
foreach ($templateinvoice->lines as $key => $templateline) {
297-
if (in_array($templateline->fk_product, $mythirdpartyaccount->isamoduleprovider)) {
297+
if (in_array($templateline->fk_product, $mythirdpartyaccount->context['isamoduleprovider'])) {
298298
$total_ht += $templateline->total_ht;
299299
}
300300
}
@@ -351,15 +351,15 @@
351351
<div class="areaforresources" style="padding-bottom: 12px;">';
352352
foreach ($contract->lines as $keyline => $line) {
353353
//var_dump($line);
354-
if ($line->fk_product > 0 && !in_array($line->fk_product, $mythirdpartyaccount->isamoduleprovider)) {
354+
if ($line->fk_product > 0 && !in_array($line->fk_product, $mythirdpartyaccount->context['isamoduleprovider'])) {
355355
continue;
356356
}
357357

358358
print '<div class="resource inline-block boxresource">';
359359
$resourceformula='';
360360
$tmpproduct = new Product($db);
361361
if ($line->fk_product > 0) {
362-
362+
363363
$tmpproduct->fetch($line->fk_product);
364364

365365
$maxHeight=40;

0 commit comments

Comments
 (0)