From 2ed0a72db552c35e80a423f317fefe261761f82b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 13 Sep 2018 11:10:58 +0200 Subject: [PATCH] Fix currency display in transaction.php --- htdocs/stripe/transaction.php | 47 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 415ed32a62a..f9784cfbb65 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -99,7 +99,7 @@ if (! $rowid) { print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); + //print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", 'align="left"', $sortfield, $sortorder); print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); @@ -118,14 +118,14 @@ if (! $rowid) { $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); } - foreach ($txn->data as $txn) + foreach ($txn->data as $txn) { //$charge = $txn; //var_dump($txn); - + // The metadata FULLTAG is defined by the online payment page /*$FULLTAG=$charge->metadata->FULLTAG; - + // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata @@ -145,7 +145,7 @@ if (! $rowid) { { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -156,7 +156,7 @@ if (! $rowid) { $societestatic->societe_id = $obj->fk_soc; print ''; - + // Ref print "" . $txn->source . "\n"; // Stripe customer @@ -173,28 +173,32 @@ if (! $rowid) { } print "\n";*/ // Origine - print ""; - print $FULLTAG; - if ($charge->metadata->source=="order"){ - $object = new Commande($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_order')." ".$object->ref.""; - } elseif ($charge->metadata->source=="invoice"){ - $object = new Facture($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_invoice')." ".$object->ref.""; - } - print "\n"; + //print ""; + ////if ($charge->metadata->dol_type=="order"){ + // $object = new Commande($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_order')." ".$object->ref.""; + //} elseif ($charge->metadata->dol_type=="invoice"){ + // $object = new Facture($db); + // $object->fetch($charge->metadata->dol_id); + // print "".img_picto('', 'object_invoice')." ".$object->ref.""; + //} + //print "\n"; // Date payment print '' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "\n"; // Type print '' . $txn->type . ''; // Amount - print "" . price(($txn->amount) / 100) . ""; - print "" . price(($txn->fee) / 100) . ""; + print "" . price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; + print "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; // Status print ""; - print $txn->status; +if ($txn->status=='available') + {print img_picto($langs->trans("".$txn->status.""),'statut4');} +elseif ($txn->status=='pending') + {print img_picto($langs->trans("".$txn->status.""),'statut7');} +elseif ($txn->status=='failed') + {print img_picto($langs->trans("".$txn->status.""),'statut8');} print ''; print "\n"; } @@ -203,6 +207,5 @@ if (! $rowid) { print ''; } else {} -// End of page llxFooter(); $db->close();