70 $service =
'StripeTest';
71 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning');
73 $service =
'StripeLive';
76 if (is_array($parameters) && !empty($parameters)) {
77 foreach ($parameters as $key => $value) {
82 if (is_object($object) && $object->element ==
'societe') {
83 $this->resprints .=
'<tr><td>';
84 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
85 $this->resprints .= $langs->trans(
'StripeCustomer');
86 $this->resprints .=
'<td><td class="right">';
88 $this->resprints .=
'</td></tr></table>';
89 $this->resprints .=
'</td>';
90 $this->resprints .=
'<td colspan="3">';
91 $stripe =
new Stripe($this->db);
92 if ($stripe->getStripeAccount($service) && $object->client != 0) {
93 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
94 $this->resprints .= $customer->id;
96 $this->resprints .= $langs->trans(
"NoStripe");
98 $this->resprints .=
'</td></tr>';
99 } elseif (is_object($object) && $object->element ==
'member') {
100 $this->resprints .=
'<tr><td>';
101 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
102 $this->resprints .= $langs->trans(
'StripeCustomer');
103 $this->resprints .=
'<td><td class="right">';
104 $this->resprints .=
'</td></tr></table>';
105 $this->resprints .=
'</td>';
106 $this->resprints .=
'<td colspan="3">';
107 $stripe =
new Stripe($this->db);
108 if ($stripe->getStripeAccount($service) && $object->fk_soc > 0) {
109 $object->fetch_thirdparty();
110 $customer = $stripe->customerStripe($object->thirdparty, $stripe->getStripeAccount($service));
111 $this->resprints .= $customer->id;
113 $this->resprints .= $langs->trans(
"NoStripe");
115 $this->resprints .=
'</td></tr>';
117 $this->resprints .=
'<tr><td>';
118 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
119 $this->resprints .= $langs->trans(
'SubscriptionStripe');
120 $this->resprints .=
'<td><td class="right">';
121 $this->resprints .=
'</td></tr></table>';
122 $this->resprints .=
'</td>';
123 $this->resprints .=
'<td colspan="3">';
124 $stripe =
new Stripe($this->db);
126 $object->fetch_thirdparty();
127 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
128 $this->resprints .= $customer->id;
130 $this->resprints .= $langs->trans(
"NoStripe");
132 $this->resprints .=
'</td></tr>';
133 } elseif (is_object($object) && $object->element ==
'adherent_type') {
134 $this->resprints .=
'<tr><td>';
135 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
136 $this->resprints .= $langs->trans(
'PlanStripe');
137 $this->resprints .=
'<td><td class="right">';
139 $this->resprints .=
'</td></tr></table>';
140 $this->resprints .=
'</td>';
141 $this->resprints .=
'<td colspan="3">';
142 $stripe =
new Stripe($this->db);
144 $object->fetch_thirdparty();
145 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
146 $this->resprints .= $customer->id;
148 $this->resprints .= $langs->trans(
"NoStripe");
150 $this->resprints .=
'</td></tr>';
165 global $conf, $langs;
167 if (is_object($object) && $object->element ==
'facture') {
169 $sql =
'SELECT pf.amount';
170 $sql .=
' FROM '.MAIN_DB_PREFIX.
'paiement_facture as pf';
171 $sql .=
' WHERE pf.fk_facture = '.((int) $object->id);
175 $result = $this->db->query($sql);
178 $num = $this->db->num_rows($result);
181 $objp = $this->db->fetch_object($result);
182 $totalpaid += $objp->amount;
189 $resteapayer = $object->total_ttc - $totalpaid;
192 $stripe =
new Stripe($this->db);
193 if ($resteapayer > 0) {
194 if ($stripe->getStripeAccount($conf->entity)) {
195 $langs->load(
"withdrawals");
196 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>';
198 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
200 } elseif ($resteapayer == 0) {
201 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
204 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
206 } elseif (is_object($object) && $object->element ==
'invoice_supplier') {
207 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"StripeConnectPay")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
208 } elseif (is_object($object) && $object->element ==
'member') {
209 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"StripeAutoSubscription")).
'">'.$langs->trans(
"StripeAutoSubscription").
'</a>';