Merge pull request #9507 from frederic34/stripetransac

clean code indentation completely broken
This commit is contained in:
Laurent Destailleur 2018-09-15 17:27:20 +02:00 committed by GitHub
commit 8ceee52d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 210 additions and 196 deletions

View File

@ -1,14 +1,15 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 ThibaultFOUCART <support@ptibogxiv.net> * Copyright (C) 2018 ThibaultFOUCART <support@ptibogxiv.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -47,9 +48,9 @@ $confirm = GETPOST('confirm');
$facid = GETPOST('facid','int'); $facid = GETPOST('facid','int');
$socname = GETPOST('socname'); $socname = GETPOST('socname');
$source = GETPOST('source_id'); $source = GETPOST('source_id');
$accountid = GETPOST('accountid'); $accountid = GETPOST('accountid');
$paymentnum = GETPOST('num_paiement'); $paymentnum = GETPOST('num_paiement');
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
@ -218,15 +219,12 @@ if (empty($reshook))
/* /*
* Action add_paiement * Action add_paiement
*/ */
if ($action == 'add_paiement') if ($action == 'add_paiement') {
{ if ($error) {
if ($error) $action = 'create';
{ if (!$source) {
$action = 'create'; setEventMessages($langs->transnoentities('NoSource'), null, 'errors');
if (!$source) }
{
setEventMessages($langs->transnoentities('NoSource'), null, 'errors');
}
$error++; $error++;
} }
// Le reste propre a cette action s'affiche en bas de page. // Le reste propre a cette action s'affiche en bas de page.
@ -301,7 +299,7 @@ if (empty($reshook))
} }
elseif (preg_match('/src_/i',$source)) elseif (preg_match('/src_/i',$source))
{ {
$customer2 = $customerstripe=$stripe->customerStripe($facture->thirdparty, $stripeacc, $servicestatus); $customer2 = $customerstripe=$stripe->customerStripe($facture->thirdparty, $stripeacc, $servicestatus);
$src = $customer2->sources->retrieve("$source"); $src = $customer2->sources->retrieve("$source");
if ($src->type=='card') if ($src->type=='card')
@ -406,16 +404,14 @@ if (empty($reshook))
* View * View
*/ */
$form=new Form($db); $form = new Form($db);
llxHeader(); llxHeader();
if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox','alpha')) if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox','alpha')) {
{
$service = 'StripeLive'; $service = 'StripeLive';
$servicestatus = 0; $servicestatus = 0;
} } else {
else {
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning'); dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning');
} }
@ -568,7 +564,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans('Invoice').'</span></td><td>'.$facture->getNomUrl(4)."</td></tr>\n"; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans('Invoice').'</span></td><td>'.$facture->getNomUrl(4)."</td></tr>\n";
}*/ }*/
// Third party // Third party
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans('Company').'</span></td><td>'.$facture->thirdparty->getNomUrl(4)."</td></tr>\n"; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans('Company').'</span></td><td>'.$facture->thirdparty->getNomUrl(4)."</td></tr>\n";
// Bank account // Bank account
@ -583,22 +579,22 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
} }
// Cheque number // Cheque number
// print '<tr><td>'.$langs->trans('Numero'); //print '<tr><td>'.$langs->trans('Numero');
// print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>'; //print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
// print '</td>'; //print '</td>';
// print '<td><input name="num_paiement" type="text" value="'.$paymentnum.'"></td></tr>'; //print '<td><input name="num_paiement" type="text" value="'.$paymentnum.'"></td></tr>';
// Check transmitter // Check transmitter
// print '<tr><td class="'.(GETPOST('paiementcode')=='CHQ'?'fieldrequired ':'').'fieldrequireddyn">'.$langs->trans('CheckTransmitter'); //print '<tr><td class="'.(GETPOST('paiementcode')=='CHQ'?'fieldrequired ':'').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
// print ' <em>('.$langs->trans("ChequeMaker").')</em>'; //print ' <em>('.$langs->trans("ChequeMaker").')</em>';
// print '</td>'; //print '</td>';
// print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur').'"></td></tr>'; //print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur').'"></td></tr>';
// Bank name // Bank name
// print '<tr><td>'.$langs->trans('Bank'); //print '<tr><td>'.$langs->trans('Bank');
// print ' <em>('.$langs->trans("ChequeBank").')</em>'; //print ' <em>('.$langs->trans("ChequeBank").')</em>';
// print '</td>'; //print '</td>';
// print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank').'"></td></tr>'; //print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank').'"></td></tr>';
// Comments // Comments
print '<tr><td>'.$langs->trans('Comments').'</td>'; print '<tr><td>'.$langs->trans('Comments').'</td>';
@ -607,145 +603,155 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
$customerstripe=$stripe->customerStripe($facture->thirdparty, $stripeacc, $servicestatus); $customerstripe=$stripe->customerStripe($facture->thirdparty, $stripeacc, $servicestatus);
print '<br>'; print '<br>';
print_barre_liste($langs->trans('StripeSourceList').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); print_barre_liste($langs->trans('StripeSourceList').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
print '<table class="liste" width="100%">'."\n"; print '<table class="liste" width="100%">'."\n";
// Titles with sort buttons // Titles with sort buttons
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td align="left"></td>'; print '<td align="left"></td>';
print '<td align="left">'.$langs->trans('Type').'</td>'; print '<td align="left">'.$langs->trans('Type').'</td>';
print '<td align="left">'.$langs->trans('Informations').'</td>'; print '<td align="left">'.$langs->trans('Informations').'</td>';
print '<td align="left"></td>'; print '<td align="left"></td>';
print "<td></td></tr>\n"; print "<td></td></tr>\n";
foreach ($customerstripe->sources->data as $src) { foreach ($customerstripe->sources->data as $src) {
print '<tr>'; print '<tr>';
print '<td align="center" width="20" '; print '<td align="center" width="20" ';
if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) {
print'><input type="radio" id="source_id" class="flat" name="source_id" value="'.$src->id.'"'; print'class="opacitymedium"';
if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { }
print '><input type="radio" id="source_id" class="flat" name="source_id" value="'.$src->id.'"';
if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) {
print ' disabled'; print ' disabled';
} elseif (($customerstripe->default_source==$src->id && $action != 'add_paiement') or ($source==$src->id && $action == 'add_paiement')) { } elseif (($customerstripe->default_source==$src->id && $action != 'add_paiement') or ($source==$src->id && $action == 'add_paiement')) {
print ' checked'; print ' checked';
} }
print '></td>'; print '></td>';
print '<td '; print '<td ';
if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) {
print'class="opacitymedium"';
}
print' >'; print' >';
if ($src->object=='card') if ($src->object=='card') {
{ print img_credit_card($src->brand);
print img_credit_card($src->brand); } elseif ($src->object=='source' && $src->type=='card') {
} print img_credit_card($src->card->brand);
elseif ($src->object=='source' && $src->type=='card') } elseif ($src->object=='source' && $src->type=='sepa_debit') {
{ print '<span class="fa fa-university fa-2x fa-fw"></span>';
print img_credit_card($src->card->brand); }
} print '</td>';
elseif ($src->object=='source' && $src->type=='sepa_debit') print '<td ';
{ if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) {
print '<span class="fa fa-university fa-2x fa-fw"></span>'; print'class="opacitymedium"';
} }
print '</td>'; print' >';
print '<td '; if ($src->object=='card') {
if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.'';
print' >'; print '</td><td>';
if ($src->object=='card'){ if ($src->country) {
print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; $img = picto_from_langcode($src->country);
print '</td><td>'; print $img?$img.' ':'';
if ($src->country) print getCountry($src->country,1);
{ } else {
$img=picto_from_langcode($src->country); print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
print $img?$img.' ':''; }
print getCountry($src->country,1); } elseif ($src->object=='source' && $src->type=='card') {
} print $src->owner->name.'<br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.'';
else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>'; print '</td><td>';
} if ($src->card->country) {
elseif ($src->object=='source' && $src->type=='card'){ $img = picto_from_langcode($src->card->country);
print $src->owner->name.'<br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print $img?$img.' ':'';
print '</td><td>'; print getCountry($src->card->country,1);
if ($src->card->country) } else {
{ print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
$img=picto_from_langcode($src->card->country); }
print $img?$img.' ':''; } elseif ($src->object=='source' && $src->type=='sepa_debit') {
print getCountry($src->card->country,1); print 'info sepa';
} print '</td><td>';
else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>'; if ($src->sepa_debit->country) {
} $img = picto_from_langcode($src->sepa_debit->country);
elseif ($src->object=='source' && $src->type=='sepa_debit'){ print $img?$img.' ':'';
print 'info sepa'; print getCountry($src->sepa_debit->country,1);
print '</td><td>'; } else {
if ($src->sepa_debit->country) print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
{ }
$img=picto_from_langcode($src->sepa_debit->country); }
print $img?$img.' ':''; print '</td>';
print getCountry($src->sepa_debit->country,1);
}
else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
}
print '</td>';
// Default // Default
print '<td align="center" width="50" '; print '<td align="center" width="50" ';
if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"';} if (($action == 'add_paiement' && $src->id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) {
print'>'; print'class="opacitymedium"';
}
print'>';
if (($customerstripe->default_source==$src->id)) { if (($customerstripe->default_source==$src->id)) {
print "<SPAN class=' fa fa-star fa-2x'></SPAN>"; print "<SPAN class=' fa fa-star fa-2x'></SPAN>";
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// TODO more dolibarize with new stripe function and stripeconnect // TODO more dolibarize with new stripe function and stripeconnect
//if ($stripe->getStripeCustomerAccount($facture->socid)) { //if ($stripe->getStripeCustomerAccount($facture->socid)) {
//$account=\Stripe\Account::retrieve("".$stripe->getStripeCustomerAccount($facture->socid).""); // $account=\Stripe\Account::retrieve("".$stripe->getStripeCustomerAccount($facture->socid)."");
//} //}
if (($account->type=='custom' or $account->type=='express') && $entity==1) { if (($account->type=='custom' or $account->type=='express') && $entity==1) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td align="center" width="20" '; print '<td align="center" width="20" ';
if ($action == 'add_paiement' && $stripe->getStripeCustomerAccount($facture->socid)!=$source) { print'class="opacitymedium"';} if ($action == 'add_paiement' && $stripe->getStripeCustomerAccount($facture->socid)!=$source) {
print'><input type="radio" id="source_id" class="flat" name="source_id" value="'.$conf->global->STRIPE_EXTERNAL_ACCOUNT.'"'; print'class="opacitymedium"';
if ((empty($input) && $action != 'add_paiement') or ($source==$conf->global->STRIPE_EXTERNAL_ACCOUNT && $action == 'add_paiement')) { }
print ' checked'; print'><input type="radio" id="source_id" class="flat" name="source_id" value="'.$conf->global->STRIPE_EXTERNAL_ACCOUNT.'"';
} elseif ($action == 'add_paiement' && $conf->global->STRIPE_EXTERNAL_ACCOUNT!=$source) { if ((empty($input) && $action != 'add_paiement') or ($source==$conf->global->STRIPE_EXTERNAL_ACCOUNT && $action == 'add_paiement')) {
print ' disabled'; print ' checked';
} } elseif ($action == 'add_paiement' && $conf->global->STRIPE_EXTERNAL_ACCOUNT!=$source) {
print '></td><td '; print ' disabled';
if ($action == 'add_paiement' && $stripe->getStripeCustomerAccount($facture->socid)!=$source) { print'class="opacitymedium"';} }
print '><span class="fa fa-cc-stripe fa-3x fa-fw"></span></td>'; print '></td><td ';
if ($action == 'add_paiement' && $stripe->getStripeCustomerAccount($facture->socid)!=$source) {
print'class="opacitymedium"';
}
print '><span class="fa fa-cc-stripe fa-3x fa-fw"></span></td>';
print '<td '; print '<td ';
if ($action == 'add_paiement' && $stripe->getStripeCustomerAccount($facture->socid)!=$source) { print'class="opacitymedium"';} if ($action == 'add_paiement' && $stripe->getStripeCustomerAccount($facture->socid)!=$source) {
print'>'.$langs->trans('sold'); print'class="opacitymedium"';
print'</td><td '; }
if ($action == 'add_paiement' && $src->id!=$source) { print'class="opacitymedium"';} print'>'.$langs->trans('sold');
print'>'; print'</td><td ';
if ($action == 'add_paiement' && $src->id!=$source) {
print'class="opacitymedium"';
}
print'>';
print '</td>'; print '</td>';
// Default // Default
print '<td align="center" width="50" '; print '<td align="center" width="50" ';
if ($action == 'add_paiement' && $src->id!=$source) { print'class="opacitymedium"';} if ($action == 'add_paiement' && $src->id!=$source) {
print'>'; print'class="opacitymedium"';
// if (($customer->default_source!=$src->id)) { }
// print img_picto($langs->trans("Disabled"),'off'); print'>';
// } else { //if (($customer->default_source!=$src->id)) {
// print img_picto($langs->trans("Default"),'on'); // print img_picto($langs->trans("Disabled"),'off');
// } //} else {
print '</td>'; // print img_picto($langs->trans("Default"),'on');
print '</tr>'; //}
} print '</td>';
if (empty($input)&&!$stripe->getStripeCustomerAccount($facture->socid)) print '</tr>';
{ }
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>'; if (empty($input)&&!$stripe->getStripeCustomerAccount($facture->socid)) {
} print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
}
print "</table>"; print "</table>";
/* /*
@ -756,14 +762,14 @@ print '</tr>';
$sql.= ' f.datef as df, f.fk_soc as socid'; $sql.= ' f.datef as df, f.fk_soc as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) { if (!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)';
} }
$sql.= ' WHERE f.entity = '.$conf->entity; $sql.= ' WHERE f.entity = '.$conf->entity;
$sql.= ' AND (f.fk_soc = '.$facture->socid; $sql.= ' AND (f.fk_soc = '.$facture->socid;
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) { if (!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')'; $sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
} }
@ -1023,10 +1029,11 @@ print '</tr>';
$preselectedchoice=$addwarning?'no':'yes'; $preselectedchoice=$addwarning?'no':'yes';
print '<br>'; print '<br>';
if (!empty($totalpayment)) $text=$langs->trans('ConfirmCustomerPayment',$totalpayment,$langs->trans("Currency".$conf->currency)); if (!empty($totalpayment)) {
if (!empty($multicurrency_totalpayment)) $text = $langs->trans('ConfirmCustomerPayment', $totalpayment, $langs->trans("Currency".$conf->currency));
{ }
$text.='<br>'.$langs->trans('ConfirmCustomerPayment',$multicurrency_totalpayment,$langs->trans("paymentInInvoiceCurrency")); if (!empty($multicurrency_totalpayment)) {
$text.='<br>'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency"));
} }
if (GETPOST('closepaidinvoices')) if (GETPOST('closepaidinvoices'))
{ {

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2018 PtibogXIV <support@ptibogxiv.net> /* Copyright (C) 2018 PtibogXIV <support@ptibogxiv.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -25,7 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; 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.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.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 // Load translation files required by the page
$langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe')); $langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe'));
@ -77,25 +80,26 @@ $stripeaccount = $stripe->getStripeAccount($service);
if (! $rowid) { if (! $rowid) {
print '<FORM method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
if ($optioncss != '') if ($optioncss != '') {
print '<INPUT type="hidden" name="optioncss" value="' . $optioncss . '">'; print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
print '<INPUT type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; }
print '<INPUT type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<INPUT type="hidden" name="action" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<INPUT type="hidden" name="sortfield" value="' . $sortfield . '">'; print '<input type="hidden" name="action" value="list">';
print '<INPUT type="hidden" name="sortorder" value="' . $sortorder . '">'; print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
print '<INPUT type="hidden" name="page" value="' . $page . '">'; print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
print '<input type="hidden" name="page" value="' . $page . '">';
$title=$langs->trans("StripeTransactionList"); $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 '.$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_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
print '<DIV class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<TABLE class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; print '<table class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
print '<TR class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
//print_liste_field_titre("StripeCustomerId",$_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("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
@ -105,9 +109,9 @@ if (! $rowid) {
print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"');
print "</TR>\n"; print "</tr>\n";
print "</TR>\n"; print "</tr>\n";
if ($stripeaccount) if ($stripeaccount)
{ {
@ -155,14 +159,14 @@ if (! $rowid) {
$societestatic->email = $obj->email; $societestatic->email = $obj->email;
$societestatic->societe_id = $obj->fk_soc; $societestatic->societe_id = $obj->fk_soc;
print '<TR class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
print "<TD><A href='" . DOL_URL_ROOT . "/stripe/transaction.php?rowid=" . $txn->source . "'>" . $txn->source . "</A></TD>\n"; print "<td><a href='" . DOL_URL_ROOT . "/stripe/transaction.php?rowid=" . $txn->source . "'>" . $txn->source . "</A></td>\n";
// Stripe customer // Stripe customer
//print "<TD>".$charge->customer."</TD>\n"; //print "<td>".$charge->customer."</td>\n";
// Link // Link
/*print "<TD>"; /*print "<td>";
if ($societestatic->id > 0) if ($societestatic->id > 0)
{ {
print $societestatic->getNomUrl(1); print $societestatic->getNomUrl(1);
@ -171,8 +175,9 @@ if (! $rowid) {
{ {
print $memberstatic->getNomUrl(1); print $memberstatic->getNomUrl(1);
} }
print "</TD>\n";*/ print "</td>\n";*/
// Origine // Origine
//print "<TD>"; //print "<TD>";
////if ($charge->metadata->dol_type=="order"){ ////if ($charge->metadata->dol_type=="order"){
// $object = new Commande($db); // $object = new Commande($db);
@ -185,27 +190,29 @@ if (! $rowid) {
//} //}
//print "</TD>\n"; //print "</TD>\n";
// Date payment // Date payment
print '<TD align="center">' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "</TD>\n"; print '<td align="center">' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "</td>\n";
// Type // Type
print '<TD>' . $txn->type . '</TD>'; print '<td>' . $txn->type . '</td>';
// Amount // Amount
print "<TD align=\"right\">" . price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "</TD>"; print "<td align=\"right\">" . price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "</td>";
print "<TD align=\"right\">" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "</TD>"; print "<td align=\"right\">" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "</td>";
// Status // Status
print "<TD align='right'>"; print "<td align='right'>";
if ($txn->status=='available') if ($txn->status=='available')
{print img_picto($langs->trans("".$txn->status.""),'statut4');} {
print img_picto($langs->trans("".$txn->status.""),'statut4');}
elseif ($txn->status=='pending') elseif ($txn->status=='pending')
{print img_picto($langs->trans("".$txn->status.""),'statut7');} {print img_picto($langs->trans("".$txn->status.""),'statut7');}
elseif ($txn->status=='failed') elseif ($txn->status=='failed')
{print img_picto($langs->trans("".$txn->status.""),'statut8');} {
print '</TD>'; print img_picto($langs->trans("".$txn->status.""),'statut8');}
print "</TR>\n"; print '</td>';
print "</tr>\n";
} }
print "</TABLE>"; print "</table>";
print '</DIV>'; print '</div>';
print '</FORM>'; print '</form>';
} else {} }
// End of page // End of page
llxFooter(); llxFooter();