Merge pull request #11938 from ptibogxiv/patch-265

FIX new display for stripe account
This commit is contained in:
Laurent Destailleur 2019-09-27 14:00:55 +02:00 committed by GitHub
commit 9bf952cae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1307,19 +1307,21 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc));
print '<table class="liste" width="100%">'."\n";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Status').'</td>';
print '<td>'.$langs->trans('Amount').'</td>';
print '<td>'.$langs->trans('Currency').'</td>';
print '<td>'.$langs->trans('Available').'</td>';
print '<td>'.$langs->trans('Pending').'</td>';
print '<td>'.$langs->trans('Total').'</td>';
print '</tr>';
$currencybalance = array();
if (is_array($balance->available) && count($balance->available))
{
foreach ($balance->available as $cpt)
{
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
if (! in_array($cpt->currency, $arrayzerounitcurrency)) $amount = $cpt->amount / 100;
else $amount = $cpt->amount;
print '<tr><td>'.$langs->trans("Available").'</td><td>'.price($amount, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).' </td><td>'.$langs->trans("Currency".strtoupper($cpt->currency)).'</td></tr>';
if (! in_array($cpt->currency, $arrayzerounitcurrency)) $currencybalance[$cpt->currency]->available=$cpt->amount / 100;
else $currencybalance[$cpt->currency]->available=$cpt->amount;
$currencybalance[$cpt->currency]->currency=$cpt->currency;
}
}
@ -1328,11 +1330,19 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
foreach ($balance->pending as $cpt)
{
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
if (! in_array($cpt->currency, $arrayzerounitcurrency)) $amount = $cpt->amount / 100;
else $amount = $cpt->amount;
print '<tr><td>'.$langs->trans("Pending").'</td><td>'.price($amount, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).' </td><td>'.$langs->trans("Currency".strtoupper($cpt->currency)).'</td></tr>';
if (! in_array($cpt->currency, $arrayzerounitcurrency)) $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount / 100;
else $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount;
}
}
if (is_array($currencybalance))
{
foreach ($currencybalance as $cpt)
{
print '<tr><td>'.$langs->trans("Currency".strtoupper($cpt->currency)).'</td><td>'.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td><td>'.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td><td>'.price($cpt->available+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td></tr>';
}
}
print '</table>';
print '<br>';
}