From 8e778df0ff5eb9d975b3aef3a1d34cb70c41f349 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Apr 2018 14:05:07 +0200 Subject: [PATCH] Debug stripe module --- htdocs/core/modules/modStripe.class.php | 4 ++-- htdocs/langs/en_US/stripe.lang | 1 + htdocs/stripe/charge.php | 22 ++++++++++++++++------ htdocs/stripe/transaction.php | 20 ++++++++++++++------ 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index dc46b886fc4..e5b481f4daa 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -113,10 +113,10 @@ class modStripe extends DolibarrModules 'titre'=>'StripeAccount', 'mainmenu'=>'bank', 'leftmenu'=>'stripe', - 'url' => '/stripe/charge.php', + 'url' => '', 'langs' => 'stripe', 'position' => 100, - 'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 2', + 'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 1', 'perms' => '$user->rights->banque->configurer', 'target' => '', 'user' => 0 diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 536fb3f940d..607a2b5d5a8 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -49,6 +49,7 @@ OAUTH_STRIPE_LIVE_ID=Stripe Connect Client ID (ca_...) BankAccountForBankTransfer=Bank account for fund payouts StripeAccount=Stripe account StripeChargeList=List of Stripe charges +StripeTransactionList=List of Stripe transactions StripeCustomerId=Stripe customer id StripePaymentModes=Stripe payment modes LocalID=Local ID diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 413ed3ec815..9dbef701f29 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -72,14 +72,14 @@ else } $stripeaccount = $stripe->getStripeAccount($service); -if (empty($stripeaccount)) +/*if (empty($stripeaccount)) { print $langs->trans('ErrorStripeAccountNotDefined'); -} +}*/ -if (!$rowid && $stripeaccount) +if (!$rowid) { - print '
'; + print ''; if ($optioncss != '') print ''; print ''; print ''; @@ -88,7 +88,10 @@ if (!$rowid && $stripeaccount) print ''; print ''; - print_barre_liste($langs->trans("StripeChargeList"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); + $title=$langs->trans("StripeChargeList"); + $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (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 '
'; print ''."\n"; @@ -106,7 +109,14 @@ if (!$rowid && $stripeaccount) print "\n"; - $list=\Stripe\Charge::all(array("limit" => $limit), array("stripe_account" => $stripeaccount)); + if ($stripeaccount) + { + $list=\Stripe\Charge::all(array("limit" => $limit), array("stripe_account" => $stripeaccount)); + } + else + { + $list=\Stripe\Charge::all(array("limit" => $limit)); + } //print $list; foreach ($list->data as $charge) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 5390b3a170c..0da3a838576 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -71,9 +71,9 @@ if (empty($stripeaccount)) print $langs->trans('ErrorStripeAccountNotDefined'); } -if (! $rowid && $stripeaccount) { +if (! $rowid) { - print ''; + print ''; if ($optioncss != '') print ''; print ''; @@ -83,7 +83,10 @@ if (! $rowid && $stripeaccount) { print ''; print ''; - print_barre_liste($langs->trans("StripeTransactionList"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); + $title=$langs->trans("StripeTransactionList"); + $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (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 '
'; print '
' . "\n"; @@ -101,9 +104,14 @@ if (! $rowid && $stripeaccount) { print "\n"; - $stripeaccount = $stripe->getStripeAccount($service); - - $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeaccount)); + if ($stripeaccount) + { + $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeaccount)); + } + else + { + $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); + } foreach ($txn->data as $txn) { print '';