Add a right navigation on list of stripe charges
This commit is contained in:
parent
a886629d08
commit
39fba83f26
@ -80,6 +80,28 @@ $stripeacc = $stripe->getStripeAccount($service);
|
|||||||
|
|
||||||
if (!$rowid)
|
if (!$rowid)
|
||||||
{
|
{
|
||||||
|
$option = array('limit' => $limit + 1);
|
||||||
|
if (GETPOSTISSET('starting_after_'.$page)) $option['starting_after'] = GETPOST('starting_after_'.$page, 'alphanohtml');
|
||||||
|
if ($stripeacc)
|
||||||
|
{
|
||||||
|
$list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$list = \Stripe\Charge::all($option);
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = count($list->data);
|
||||||
|
$totalnboflines = '';
|
||||||
|
|
||||||
|
$param = '';
|
||||||
|
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
|
$param.='&starting_after_'.($page+1).'='.$list->data[($limit-1)]->id;
|
||||||
|
//$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id;
|
||||||
|
|
||||||
|
$moreforfilter = '';
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
@ -92,7 +114,7 @@ if (!$rowid)
|
|||||||
$title = $langs->trans("StripeChargeList");
|
$title = $langs->trans("StripeChargeList");
|
||||||
$title .= ($stripeacc ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)');
|
$title .= ($stripeacc ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)');
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', 'hidepaginationprevious', $limit);
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||||
@ -108,29 +130,23 @@ if (!$rowid)
|
|||||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
if ($stripeacc)
|
|
||||||
{
|
|
||||||
$list=\Stripe\Charge::all(array("limit" => $limit), array("stripe_account" => $stripeacc));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$list=\Stripe\Charge::all(array("limit" => $limit));
|
|
||||||
}
|
|
||||||
|
|
||||||
//print $list;
|
//print $list;
|
||||||
|
$i = 0;
|
||||||
foreach ($list->data as $charge)
|
foreach ($list->data as $charge)
|
||||||
{
|
{
|
||||||
|
if ($i >= $limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ($charge->refunded=='1') {
|
if ($charge->refunded=='1') {
|
||||||
$status = img_picto($langs->trans("refunded"), 'statut6');
|
$status = img_picto($langs->trans("refunded"), 'statut6');
|
||||||
} elseif ($charge->paid=='1') {
|
} elseif ($charge->paid=='1') {
|
||||||
$status = img_picto($langs->trans("".$charge->status.""), 'statut4');
|
$status = img_picto($langs->trans((string) $charge->status), 'statut4');
|
||||||
} else {
|
} else {
|
||||||
$label="Message: ".$charge->failure_message."<br>";
|
$label = $langs->trans("Message").": ".$charge->failure_message."<br>";
|
||||||
$label.="Réseau: ".$charge->outcome->network_status."<br>";
|
$label.= $langs->trans("Network").": ".$charge->outcome->network_status."<br>";
|
||||||
$label.="Statut: ".$langs->trans("".$charge->outcome->seller_message."");
|
$label.= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message);
|
||||||
$status = $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1);
|
$status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($charge->payment_method_details->type=='card') {
|
if ($charge->payment_method_details->type=='card') {
|
||||||
@ -145,13 +161,14 @@ if (!$rowid)
|
|||||||
$type = $langs->trans("iDEAL");
|
$type = $langs->trans("iDEAL");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($charge->payment_intent)) {
|
// Why this ?
|
||||||
|
/*if (! empty($charge->payment_intent)) {
|
||||||
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
||||||
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
|
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
|
||||||
} else {
|
} else {
|
||||||
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
|
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// The metadata FULLTAG is defined by the online payment page
|
// The metadata FULLTAG is defined by the online payment page
|
||||||
$FULLTAG = $charge->metadata->FULLTAG;
|
$FULLTAG = $charge->metadata->FULLTAG;
|
||||||
@ -192,7 +209,9 @@ if (!$rowid)
|
|||||||
}
|
}
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
|
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
|
||||||
|
if ($charge->payment_intent) print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Stripe customer
|
// Stripe customer
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if (!empty($conf->stripe->enabled) && !empty($stripeacc)) $connect = $stripeacc.'/';
|
if (!empty($conf->stripe->enabled) && !empty($stripeacc)) $connect = $stripeacc.'/';
|
||||||
@ -206,6 +225,7 @@ if (!$rowid)
|
|||||||
print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>';
|
print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>';
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Link
|
// Link
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($societestatic->id > 0)
|
if ($societestatic->id > 0)
|
||||||
@ -217,7 +237,8 @@ if (!$rowid)
|
|||||||
print $memberstatic->getNomUrl(1);
|
print $memberstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
// Origine
|
|
||||||
|
// Origin
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($charge->metadata->dol_type=="order" || $charge->metadata->dol_type=="commande") {
|
if ($charge->metadata->dol_type=="order" || $charge->metadata->dol_type=="commande") {
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
@ -228,6 +249,7 @@ if (!$rowid)
|
|||||||
print $FULLTAG;
|
print $FULLTAG;
|
||||||
}
|
}
|
||||||
} elseif ($charge->metadata->dol_type=="invoice" || $charge->metadata->dol_type=="facture") {
|
} elseif ($charge->metadata->dol_type=="invoice" || $charge->metadata->dol_type=="facture") {
|
||||||
|
print $charge->metadata->dol_type.' '.$charge->metadata->dol_id.' - ';
|
||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
$object->fetch($charge->metadata->dol_id);
|
$object->fetch($charge->metadata->dol_id);
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
@ -239,6 +261,7 @@ if (!$rowid)
|
|||||||
print $FULLTAG;
|
print $FULLTAG;
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<td class="center">'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."</td>\n";
|
print '<td class="center">'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."</td>\n";
|
||||||
// Type
|
// Type
|
||||||
@ -253,8 +276,9 @@ if (!$rowid)
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -3161,7 +3161,12 @@ div.pagination li.paginationafterarrows {
|
|||||||
.paginationatbottom {
|
.paginationatbottom {
|
||||||
margin-top: 9px;
|
margin-top: 9px;
|
||||||
}
|
}
|
||||||
|
table.hidepaginationprevious .paginationprevious {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
table.hidepaginationnext .paginationnext {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3149,6 +3149,13 @@ div.pagination li.paginationafterarrows {
|
|||||||
.paginationatbottom {
|
.paginationatbottom {
|
||||||
margin-top: 9px;
|
margin-top: 9px;
|
||||||
}
|
}
|
||||||
|
table.hidepaginationprevious .paginationprevious {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
table.hidepaginationnext .paginationnext {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Prepare to remove class pair - impair
|
/* Prepare to remove class pair - impair
|
||||||
.noborder > tbody > tr:nth-child(even) td {
|
.noborder > tbody > tr:nth-child(even) td {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user