From d0fafe8f0f1299cfdd73eb5cf823b7c2372bf1dc Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:49:13 +0200 Subject: [PATCH 1/5] fix link with connect transaction.php --- htdocs/stripe/transaction.php | 81 ++++++++++++++++------------------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 9d9a1c84597a1..2a62144a6e14e 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,6 +1,5 @@ - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2018 PtibogXIV * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,9 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if (! empty($conf->accounting->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; -} +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); @@ -65,16 +62,16 @@ if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) { $service = 'StripeTest'; - $servicestatus = '0'; + $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } else { $service = 'StripeLive'; - $servicestatus = '1'; + $servicestatus = '1'; } -$stripeaccount = $stripe->getStripeAccount($service); +$stripeacc = $stripe->getStripeAccount($service); /*if (empty($stripeaccount)) { print $langs->trans('ErrorStripeAccountNotDefined'); @@ -83,9 +80,8 @@ if (! $rowid) { print '
'; - if ($optioncss != '') { - print ''; - } + if ($optioncss != '') + print ''; print ''; print ''; print ''; @@ -94,7 +90,7 @@ print ''; $title=$langs->trans("StripeTransactionList"); - $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (Stripe connection with keys from Stripe module setup)'); + $title.=($stripeaccount?' (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); @@ -115,9 +111,9 @@ print "\n"; - if ($stripeaccount) + if ($stripeacc) { - $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeaccount)); + $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); } else { @@ -128,10 +124,10 @@ { //$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 @@ -151,7 +147,7 @@ { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -162,28 +158,28 @@ $societestatic->societe_id = $obj->fk_soc; print ''; - + + // Ref + if (!empty($stripeacc)) $connect=$stripeacc.'/'; + // Ref - if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; - if (preg_match('/po_/i', $txn->source)){ $origin="payouts"; } elseif (preg_match('/fee_/i', $txn->source)) { - $origin="connect/application_fees"; + $origin="connect/application_fees"; } else { - $origin="payments"; - } - + $origin="payments"; + } + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; - - if ($servicestatus) - { - $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; - } - + if ($servicestatus) + { + $url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source; + } if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') { - print "".$txn->type.""; - } else print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "\n"; + print "".$txn->type.""; + } else print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "\n"; + // Stripe customer //print "".$charge->customer."\n"; // Link @@ -198,16 +194,15 @@ } print "\n";*/ // Origine - //print ""; ////if ($charge->metadata->dol_type=="order"){ // $object = new Commande($db); // $object->fetch($charge->metadata->dol_id); - // print "".img_picto('', 'object_order')." ".$object->ref.""; + // 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 "".img_picto('', 'object_invoice')." ".$object->ref.""; //} //print "\n"; // Date payment @@ -219,21 +214,19 @@ print "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; // Status print ""; - 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'); - } +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"; } print ""; print ''; print '
'; -} +} else {} -// End of page llxFooter(); $db->close(); From 61d0aa66a57f1c28aaf141c41699744de0a51a1f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:52:08 +0200 Subject: [PATCH 2/5] Update transaction.php --- htdocs/stripe/transaction.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 2a62144a6e14e..79da90d4c10f8 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 933f253c86bb9397109a6c3bfa4de28f560b6cb2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:52:27 +0200 Subject: [PATCH 3/5] Update transaction.php --- htdocs/stripe/transaction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 79da90d4c10f8..200eb8ee15844 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -227,7 +227,7 @@ print ""; print ''; print ''; -} else {} +} llxFooter(); $db->close(); From d09b74abe5150b8a9bd72bef6f369a123d31afa6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:54:07 +0200 Subject: [PATCH 4/5] Update transaction.php --- htdocs/stripe/transaction.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 200eb8ee15844..c75b252ee4367 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -125,10 +125,10 @@ { //$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 @@ -148,7 +148,7 @@ { $memberstatic->id = 0; }*/ - + $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; $societestatic->lastname = $obj->lastname; @@ -167,11 +167,11 @@ if (preg_match('/po_/i', $txn->source)){ $origin="payouts"; } elseif (preg_match('/fee_/i', $txn->source)) { - $origin="connect/application_fees"; + $origin="connect/application_fees"; } else { - $origin="payments"; - } - + $origin="payments"; + } + $url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source; if ($servicestatus) { @@ -229,5 +229,6 @@ print ''; } +// End of page llxFooter(); $db->close(); From 60cb83cf25af445544654fbb3ed25f94338d3d7b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 21 Sep 2018 09:55:24 +0200 Subject: [PATCH 5/5] Update transaction.php --- htdocs/stripe/transaction.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index c75b252ee4367..595583a63f115 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -215,12 +215,12 @@ print "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; // Status print ""; -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');} + 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"; }