$key is overwriting a variable from outer foreach loop

This commit is contained in:
Frédéric FRANCE 2019-12-01 20:34:05 +01:00 committed by GitHub
parent 5cb014435b
commit 36bb4eece9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,10 +253,11 @@ if ($resql) {
$paymentstatic->fetch($links[$key]['url_id']);
$tmparray = $paymentstatic->getBillsArray('');
if (is_array($tmparray)) {
foreach ($tmparray as $key => $val) {
$invoicestatic->fetch($val);
if ($accountelem)
foreach ($tmparray as $tmpkey => $tmpval) {
$invoicestatic->fetch($tmpval);
if ($accountelem) {
$accountelem .= ', ';
}
$accountelem .= $invoicestatic->ref;
}
}
@ -264,28 +265,32 @@ if ($resql) {
$paymentsupplierstatic->fetch($links[$key]['url_id']);
$tmparray = $paymentsupplierstatic->getBillsArray('');
if (is_array($tmparray)) {
foreach ($tmparray as $key => $val) {
$invoicesupplierstatic->fetch($val);
if ($accountelem)
foreach ($tmparray as $tmpkey => $tmpval) {
$invoicesupplierstatic->fetch($tmpval);
if ($accountelem) {
$accountelem .= ', ';
}
$accountelem .= $invoicesupplierstatic->ref;
}
}
} elseif ($links[$key]['type'] == 'payment_sc') {
$paymentsocialcontributionstatic->fetch($links[$key]['url_id']);
if ($accountelem)
if ($accountelem) {
$accountelem .= ', ';
}
$accountelem .= $langs->transnoentitiesnoconv("SocialContribution") . ' ' . $paymentsocialcontributionstatic->ref;
} elseif ($links[$key]['type'] == 'payment_vat') {
$paymentvatstatic->fetch($links[$key]['url_id']);
if ($accountelem)
if ($accountelem) {
$accountelem .= ', ';
}
$accountelem .= $langs->transnoentitiesnoconv("VATPayments") . ' ' . $paymentvatstatic->ref;
} elseif ($links[$key]['type'] == 'banktransfert') {
$comment = $outputlangs->transnoentitiesnoconv("Transfer");
if ($objp->amount > 0) {
if ($comment)
if ($comment) {
$comment .= ' ';
}
$banklinestatic->fetch($links[$key]['url_id']);
$bankstatic->id = $banklinestatic->fk_account;
$bankstatic->label = $banklinestatic->bank_account_label;
@ -297,8 +302,9 @@ if ($resql) {
$comment .= $bankstatic->getNomUrl(1, '');
$comment .= ')';
} else {
if ($comment)
if ($comment) {
$comment .= ' ';
}
$bankstatic->id = $objp->bankid;
$bankstatic->label = $objp->bankref;
$comment .= ' (' . $langs->transnoentitiesnoconv("from") . ' ';
@ -311,13 +317,15 @@ if ($resql) {
$comment .= ')';
}
} elseif ($links[$key]['type'] == 'company') {
if ($thirdparty)
if ($thirdparty) {
$thirdparty .= ', ';
}
$thirdparty .= dol_trunc($links[$key]['label'], 24);
$newline = 0;
} elseif ($links[$key]['type'] == 'member') {
if ($thirdparty)
if ($thirdparty) {
$accountelem .= ', ';
}
$thirdparty .= $links[$key]['label'];
$newline = 0;
}