28 require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
31 $langs->load(
"stripe@stripe");
44 private $config = array();
48 public $results = array();
72 global $db, $conf, $user, $langs,
$form;
74 if (
isModEnabled(
'stripe') && (empty($conf->global->STRIPE_LIVE) ||
GETPOST(
'forcesandbox',
'alpha'))) {
75 $service =
'StripeTest';
76 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning');
78 $service =
'StripeLive';
81 if (is_array($parameters) && !empty($parameters)) {
82 foreach ($parameters as $key => $value) {
88 if (is_object($object) && $object->element ==
'societe') {
89 $this->resprints .=
'<tr><td>';
90 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
91 $this->resprints .= $langs->trans(
'StripeCustomer');
92 $this->resprints .=
'<td><td class="right">';
94 $this->resprints .=
'</td></tr></table>';
95 $this->resprints .=
'</td>';
96 $this->resprints .=
'<td colspan="3">';
98 if ($stripe->getStripeAccount($service) && $object->client != 0) {
99 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
100 $this->resprints .= $customer->id;
102 $this->resprints .= $langs->trans(
"NoStripe");
104 $this->resprints .=
'</td></tr>';
105 } elseif (is_object($object) && $object->element ==
'member') {
106 $this->resprints .=
'<tr><td>';
107 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
108 $this->resprints .= $langs->trans(
'StripeCustomer');
109 $this->resprints .=
'<td><td class="right">';
110 $this->resprints .=
'</td></tr></table>';
111 $this->resprints .=
'</td>';
112 $this->resprints .=
'<td colspan="3">';
114 if ($stripe->getStripeAccount($service) && $object->fk_soc > 0) {
115 $object->fetch_thirdparty();
116 $customer = $stripe->customerStripe($object->thirdparty, $stripe->getStripeAccount($service));
117 $this->resprints .= $customer->id;
119 $this->resprints .= $langs->trans(
"NoStripe");
121 $this->resprints .=
'</td></tr>';
123 $this->resprints .=
'<tr><td>';
124 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
125 $this->resprints .= $langs->trans(
'SubscriptionStripe');
126 $this->resprints .=
'<td><td class="right">';
127 $this->resprints .=
'</td></tr></table>';
128 $this->resprints .=
'</td>';
129 $this->resprints .=
'<td colspan="3">';
132 $object->fetch_thirdparty();
133 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
134 $this->resprints .= $customer->id;
136 $this->resprints .= $langs->trans(
"NoStripe");
138 $this->resprints .=
'</td></tr>';
139 } elseif (is_object($object) && $object->element ==
'adherent_type') {
140 $this->resprints .=
'<tr><td>';
141 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
142 $this->resprints .= $langs->trans(
'PlanStripe');
143 $this->resprints .=
'<td><td class="right">';
145 $this->resprints .=
'</td></tr></table>';
146 $this->resprints .=
'</td>';
147 $this->resprints .=
'<td colspan="3">';
150 $object->fetch_thirdparty();
151 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
152 $this->resprints .= $customer->id;
154 $this->resprints .= $langs->trans(
"NoStripe");
156 $this->resprints .=
'</td></tr>';
171 global $db, $conf, $user, $langs,
$form;
172 if (is_object($object) && $object->element ==
'facture') {
174 $sql =
'SELECT pf.amount';
175 $sql .=
' FROM '.MAIN_DB_PREFIX.
'paiement_facture as pf';
176 $sql .=
' WHERE pf.fk_facture = '.((int) $object->id);
180 $result = $this->
db->query($sql);
183 $num = $this->
db->num_rows($result);
186 $objp = $this->
db->fetch_object($result);
187 $totalpaid += $objp->amount;
194 $resteapayer = $object->total_ttc - $totalpaid;
198 if ($resteapayer > 0) {
199 if ($stripe->getStripeAccount($conf->entity)) {
200 $langs->load(
"withdrawals");
201 print
'<a class="butActionDelete" href="'.dol_buildpath(
'/stripeconnect/payment.php?facid='.$object->id.
'&action=create', 1).
'" title="'.
dol_escape_htmltag($langs->trans(
"StripeConnectPay")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
203 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
205 } elseif ($resteapayer == 0) {
206 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
209 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
211 } elseif (is_object($object) && $object->element ==
'invoice_supplier') {
212 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"StripeConnectPay")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
213 } elseif (is_object($object) && $object->element ==
'member') {
214 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"StripeAutoSubscription")).
'">'.$langs->trans(
"StripeAutoSubscription").
'</a>';
Class Actions Stripe Connect.
__construct($db)
Constructor.
addMoreActionsButtons($parameters, &$object, &$action)
addMoreActionsButtons
formObjectOptions($parameters, &$object, &$action)
formObjectOptions
const STATUS_DRAFT
Draft status.
const STATUS_ABANDONED
Classified abandoned and no payment done.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
isModEnabled($module)
Is Dolibarr module enabled.
$conf db
API class for accounts.