21 require
'../main.inc.php';
22 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
23 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
24 require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
26 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
29 if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
32 $langs->loadLangs(array(
'compta',
'salaries',
'bills',
'hrm',
'stripe'));
35 $socid =
GETPOST(
"socid",
"int");
36 if ($user->socid) $socid = $user->socid;
39 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
40 $rowid =
GETPOST(
"rowid",
'alpha');
41 $sortfield =
GETPOST(
"sortfield",
'alpha');
42 $sortorder =
GETPOST(
"sortorder",
'alpha');
44 if (empty($page) || $page == -1) { $page = 0; }
45 $offset = $limit * $page;
46 $pageprev = $page - 1;
47 $pagenext = $page + 1;
55 $form =
new Form($db);
56 $societestatic =
new Societe($db);
61 llxHeader(
'', $langs->trans(
"StripePayoutList"));
63 if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) ||
GETPOST(
'forcesandbox',
'alpha'))) {
64 $service =
'StripeTest';
66 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning');
68 $service =
'StripeLive';
72 $stripeacc = $stripe->getStripeAccount($service);
79 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
80 if ($optioncss !=
'') {
81 print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
83 print '<input type="hidden" name="token" value="'.newToken().
'">';
84 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
85 print '<input type="hidden" name="action" value="list">';
86 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
87 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
88 print '<input type="hidden" name="page" value="'.$page.
'">';
90 $title = $langs->trans(
"StripePayoutList");
91 $title .= ($stripeaccount ?
' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.
')' :
' (Stripe connection with keys from Stripe module setup)');
93 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'title_accountancy.png', 0,
'',
'', $limit);
95 print '<div class="div-table-responsive">';
96 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
98 print '<tr class="liste_titre">';
115 $payout = \Stripe\Payout::all(array(
"limit" => $limit), array(
"stripe_account" => $stripeacc));
117 $payout = \Stripe\Payout::all(array(
"limit" => $limit));
120 foreach ($payout->data as $payout)
148 $societestatic->fetch($charge->metadata->idcustomer);
149 $societestatic->id = $charge->metadata->idcustomer;
150 $societestatic->lastname = $obj->lastname;
151 $societestatic->firstname = $obj->firstname;
152 $societestatic->admin = $obj->admin;
153 $societestatic->login = $obj->login;
154 $societestatic->email = $obj->email;
155 $societestatic->socid = $obj->fk_soc;
157 print
'<tr class="oddeven">';
160 if (!empty($stripeacc)) $connect = $stripeacc.
'/';
162 $url =
'https://dashboard.stripe.com/'.$connect.
'test/payouts/'.$payout->id;
163 if ($servicestatus) {
164 $url =
'https://dashboard.stripe.com/'.$connect.
'payouts/'.$payout->id;
167 print
"<td><a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
" ".$payout->id.
"</a></td>\n";
196 print
'<td class="center">'.dol_print_date($payout->created,
'%d/%m/%Y %H:%M').
"</td>\n";
198 print
'<td class="center">'.dol_print_date($payout->arrival_date,
'%d/%m/%Y %H:%M').
"</td>\n";
200 print
'<td>'.$payout->description.
'</td>';
202 print
'<td class="right">'.price(($payout->amount) / 100, 0,
'', 1, -1, -1, strtoupper($payout->currency)).
"</td>";
204 print
"<td class='right'>";
205 if ($payout->status ==
'paid') {
206 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut4');
207 } elseif ($payout->status ==
'pending') {
208 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut7');
209 } elseif ($payout->status ==
'in_transit') {
210 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut7');
211 } elseif ($payout->status ==
'failed') {
212 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut7');
213 } elseif ($payout->status ==
'canceled') {
214 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut8');
220 print
'<tr><td colspan="6">'.$e->getMessage().
'</td></td>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage bank accounts.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Class to manage members of a foundation.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
print
Draft customers invoices.