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">';
97 $stripe =
new Stripe($this->db);
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">';
113 $stripe =
new Stripe($this->db);
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">';
130 $stripe =
new Stripe($this->db);
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">';
148 $stripe =
new Stripe($this->db);
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;
197 $stripe =
new Stripe($this->db);
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>';