Merge pull request #16032 from frederic34/patch-1

fix colspan too small
This commit is contained in:
Laurent Destailleur 2021-01-21 13:34:41 +01:00 committed by GitHub
commit 8eee4a79e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1114,22 +1114,21 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$i++; $i++;
} }
} }
} else dol_print_error($db); } else {
dol_print_error($db);
}
} }
// Show remote sources (not already shown as local source) // Show remote sources (not already shown as local source)
if (is_array($listofsources) && count($listofsources)) if (is_array($listofsources) && count($listofsources)) {
{ foreach ($listofsources as $src) {
foreach ($listofsources as $src)
{
if (!empty($arrayofstripecard[$src->id])) continue; // Already in previous list if (!empty($arrayofstripecard[$src->id])) continue; // Already in previous list
$nbremote++; $nbremote++;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Local ID // Local ID
if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) {
{
print '<td>'; print '<td>';
print '</td>'; print '</td>';
} }
@ -1142,8 +1141,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
if (!empty($stripeacc)) $connect = $stripeacc.'/'; if (!empty($stripeacc)) $connect = $stripeacc.'/';
//$url='https://dashboard.stripe.com/'.$connect.'test/sources/'.$src->id; //$url='https://dashboard.stripe.com/'.$connect.'test/sources/'.$src->id;
$url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$src->id; $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$src->id;
if ($servicestatus) if ($servicestatus) {
{
//$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id;
$url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$src->id; $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$src->id;
} }
@ -1151,73 +1149,58 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '</td>'; print '</td>';
// Img of credit card // Img of credit card
print '<td>'; print '<td>';
if ($src->object == 'card') if ($src->object == 'card') {
{
print img_credit_card($src->brand); print img_credit_card($src->brand);
} elseif ($src->object == 'source' && $src->type == 'card') } elseif ($src->object == 'source' && $src->type == 'card') {
{
print img_credit_card($src->card->brand); print img_credit_card($src->card->brand);
} elseif ($src->object == 'source' && $src->type == 'sepa_debit') } elseif ($src->object == 'source' && $src->type == 'sepa_debit') {
{
print '<span class="fa fa-university fa-2x fa-fw"></span>'; print '<span class="fa fa-university fa-2x fa-fw"></span>';
} elseif ($src->object == 'payment_method' && $src->type == 'card') } elseif ($src->object == 'payment_method' && $src->type == 'card') {
{
print img_credit_card($src->card->brand); print img_credit_card($src->card->brand);
} elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') {
{
print '<span class="fa fa-university fa-2x fa-fw"></span>'; print '<span class="fa fa-university fa-2x fa-fw"></span>';
} }
print'</td>'; print'</td>';
// Information // Information
print '<td valign="middle">'; print '<td valign="middle">';
if ($src->object == 'card') if ($src->object == 'card') {
{
print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.'';
print '</td><td>'; print '</td><td>';
if ($src->country) if ($src->country) {
{
$img = picto_from_langcode($src->country); $img = picto_from_langcode($src->country);
print $img ? $img.' ' : ''; print $img ? $img.' ' : '';
print getCountry($src->country, 1); print getCountry($src->country, 1);
} else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>'; } else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'source' && $src->type == 'card') } elseif ($src->object == 'source' && $src->type == 'card') {
{
print '<span class="opacitymedium">'.$src->owner->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '<span class="opacitymedium">'.$src->owner->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.'';
print '</td><td>'; print '</td><td>';
if ($src->card->country) if ($src->card->country) {
{
$img = picto_from_langcode($src->card->country); $img = picto_from_langcode($src->card->country);
print $img ? $img.' ' : ''; print $img ? $img.' ' : '';
print getCountry($src->card->country, 1); print getCountry($src->card->country, 1);
} else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>'; } else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'source' && $src->type == 'sepa_debit') } elseif ($src->object == 'source' && $src->type == 'sepa_debit') {
{
print 'SEPA debit'; print 'SEPA debit';
print '</td><td>'; print '</td><td>';
if ($src->sepa_debit->country) if ($src->sepa_debit->country) {
{
$img = picto_from_langcode($src->sepa_debit->country); $img = picto_from_langcode($src->sepa_debit->country);
print $img ? $img.' ' : ''; print $img ? $img.' ' : '';
print getCountry($src->sepa_debit->country, 1); print getCountry($src->sepa_debit->country, 1);
} else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>'; } else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'payment_method' && $src->type == 'card') } elseif ($src->object == 'payment_method' && $src->type == 'card') {
{
print '<span class="opacitymedium">'.$src->billing_details->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '<span class="opacitymedium">'.$src->billing_details->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.'';
print '</td><td>'; print '</td><td>';
if ($src->card->country) if ($src->card->country) {
{
$img = picto_from_langcode($src->card->country); $img = picto_from_langcode($src->card->country);
print $img ? $img.' ' : ''; print $img ? $img.' ' : '';
print getCountry($src->card->country, 1); print getCountry($src->card->country, 1);
} else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>'; } else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') {
{
print 'SEPA debit'; print 'SEPA debit';
print '</td><td>'; print '</td><td>';
if ($src->sepa_debit->country) if ($src->sepa_debit->country) {
{
$img = picto_from_langcode($src->sepa_debit->country); $img = picto_from_langcode($src->sepa_debit->country);
print $img ? $img.' ' : ''; print $img ? $img.' ' : '';
print getCountry($src->sepa_debit->country, 1); print getCountry($src->sepa_debit->country, 1);
@ -1229,8 +1212,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
// Default // Default
print '<td class="center" width="50">'; print '<td class="center" width="50">';
if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) || if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) ||
(!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) {
{
print '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id.'&source='.$src->id.'&action=setassourcedefault&token='.newToken().'">'; print '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id.'&source='.$src->id.'&action=setassourcedefault&token='.newToken().'">';
print img_picto($langs->trans("Default"), 'off'); print img_picto($langs->trans("Default"), 'off');
print '</a>'; print '</a>';
@ -1252,8 +1234,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
if ($user->rights->societe->creer) if ($user->rights->societe->creer) {
{
print '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id.'&source='.$src->id.'&action=deletecard&token='.newToken().'">'; print '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id.'&source='.$src->id.'&action=deletecard&token='.newToken().'">';
print img_picto($langs->trans("Delete"), 'delete'); print img_picto($langs->trans("Delete"), 'delete');
print '</a>'; print '</a>';
@ -1264,10 +1245,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
} }
} }
if ($nbremote == 0 && $nblocal == 0) if ($nbremote == 0 && $nblocal == 0) {
{ $colspan = (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD) ? 10 : 9);
$colspan = 8;
if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) $colspan++;
print '<tr><td class="opacitymedium" colspan="'.$colspan.'">'.$langs->trans("None").'</td></tr>'; print '<tr><td class="opacitymedium" colspan="'.$colspan.'">'.$langs->trans("None").'</td></tr>';
} }
print "</table>"; print "</table>";