diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 9d9a1c84597a1..595583a63f115 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -26,9 +26,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 +63,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 +81,8 @@ if (! $rowid) { print '
'; - if ($optioncss != '') { - print ''; - } + if ($optioncss != '') + print ''; print ''; print ''; print ''; @@ -94,7 +91,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 +112,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 { @@ -162,10 +159,11 @@ $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)) { @@ -175,15 +173,14 @@ } $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 +195,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,13 +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"; }