diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 2f3d184fdb9..b5f0238e9a2 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -125,15 +125,19 @@ if (!$rowid) // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata - if (! empty($tmparray['CUS'])) + if (! empty($tmparray['CUS']) && $tmparray['CUS'] > 0) { $societestatic->fetch($tmparray['CUS']); } + elseif (! empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) + { + $societestatic->fetch($charge->metadata->dol_thirdparty_id); + } else { $societestatic->id = 0; } - if (! empty($tmparray['MEM'])) + if (! empty($tmparray['MEM']) && $tmparray['MEM'] > 0) { $memberstatic->fetch($tmparray['MEM']); } @@ -142,9 +146,14 @@ if (!$rowid) $memberstatic->id = 0; } - print ''; - // Ref - print "".$charge->id."\n"; + print ''; + // Ref + $url='https://dashboard.stripe.com/test/payments/'.$charge->id; + if ($servicestatus) + { + $url='https://dashboard.stripe.com/payments/'.$charge->id; + } + print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."\n"; // Stripe customer print "".$charge->customer."\n"; // Link @@ -153,23 +162,26 @@ if (!$rowid) { print $societestatic->getNomUrl(1); } - if ($memberstatic->id > 0) + elseif ($memberstatic->id > 0) { print $memberstatic->getNomUrl(1); } print "\n"; // Origine print ""; - print $FULLTAG; - if ($charge->metadata->source=="order"){ + if ($charge->metadata->dol_type=="order"){ $object = new Commande($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_order')." ".$object->ref.""; - } elseif ($charge->metadata->source=="invoice"){ + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_order')." ".$object->ref.""; + } else print $FULLTAG; + } elseif ($charge->metadata->dol_type=="invoice"){ $object = new Facture($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_invoice')." ".$object->ref.""; - } + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_invoice')." ".$object->ref.""; + } else print $FULLTAG; + } else print $FULLTAG; print "\n"; // Date payment print ''.dol_print_date($charge->created,'%d/%m/%Y %H:%M')."\n"; @@ -190,14 +202,16 @@ if (!$rowid) // Status print ''; if ($charge->refunded=='1'){ - print $langs->trans("refunded"); + print img_picto($langs->trans("refunded"),'statut6'); } elseif ($charge->paid=='1'){ - print $langs->trans("".$charge->status.""); + + print img_picto($langs->trans("".$charge->status.""),'statut4'); + } else { $label="Message: ".$charge->failure_message."
"; $label.="Réseau: ".$charge->outcome->network_status."
"; $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); - print $form->textwithpicto($langs->trans("".$charge->status.""),$label,1); + print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""),'statut8'),$label,1); } print "\n";