29 function payment_prepare_head(
Paiement $object)
37 $head[$h][0] = DOL_URL_ROOT.
'/compta/paiement/card.php?id='.$object->id;
38 $head[$h][1] = $langs->trans(
"Payment");
39 $head[$h][2] =
'payment';
48 $head[$h][0] = DOL_URL_ROOT.
'/compta/paiement/info.php?id='.$object->id;
49 $head[$h][1] = $langs->trans(
"Info");
50 $head[$h][2] =
'info';
65 function bankline_prepare_head($id)
72 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/line.php?rowid='.$id;
73 $head[$h][1] = $langs->trans(
'BankTransaction');
74 $head[$h][2] =
'bankline';
83 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/info.php?rowid='.$id;
84 $head[$h][1] = $langs->trans(
"Info");
85 $head[$h][2] =
'info';
100 function payment_supplier_prepare_head(
Paiement $object)
102 global $langs, $conf;
107 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/card.php?id='.$object->id;
108 $head[$h][1] = $langs->trans(
"Payment");
109 $head[$h][2] =
'payment';
118 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/info.php?id='.$object->id;
119 $head[$h][1] = $langs->trans(
'Info');
120 $head[$h][2] =
'info';
134 function getValidOnlinePaymentMethods($paymentmethod =
'')
136 global $conf, $langs;
138 $validpaymentmethod = array();
140 if ((empty($paymentmethod) || $paymentmethod ==
'paypal') && !empty($conf->paypal->enabled))
142 $langs->load(
"paypal");
143 $validpaymentmethod[
'paypal'] =
'valid';
145 if ((empty($paymentmethod) || $paymentmethod ==
'paybox') && !empty($conf->paybox->enabled))
147 $langs->load(
"paybox");
148 $validpaymentmethod[
'paybox'] =
'valid';
150 if ((empty($paymentmethod) || $paymentmethod ==
'stripe') && !empty($conf->stripe->enabled))
152 $langs->load(
"stripe");
153 $validpaymentmethod[
'stripe'] =
'valid';
158 return $validpaymentmethod;
168 function showOnlinePaymentUrl($type, $ref)
173 $langs->loadLangs(array(
'payment',
'stripe'));
175 $servicename = $langs->transnoentitiesnoconv(
'Online');
177 $out =
img_picto(
'',
'globe').
' '.$langs->trans(
"ToOfferALinkForOnlinePayment", $servicename).
'<br>';
178 $url = getOnlinePaymentUrl(0, $type, $ref);
179 $out .=
'<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.
'">';
195 function getOnlinePaymentUrl($mode, $type, $ref =
'', $amount =
'9.99', $freetag =
'your_tag', $localorexternal = 0)
197 global $conf, $dolibarr_main_url_root;
199 $ref = str_replace(
' ',
'', $ref);
203 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
204 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
207 $urltouse = DOL_MAIN_URL_ROOT;
208 if ($localorexternal) $urltouse = $urlwithroot;
212 $out = $urltouse.
'/public/payment/newpayment.php?amount='.($mode ?
'<font color="#666666">' :
'').$amount.($mode ?
'</font>' :
'').
'&tag='.($mode ?
'<font color="#666666">' :
'').$freetag.($mode ?
'</font>' :
'');
213 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
215 if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .=
'&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
216 else $out .=
'&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
219 } elseif ($type ==
'order')
221 $out = $urltouse.
'/public/payment/newpayment.php?source=order&ref='.($mode ?
'<font color="#666666">' :
'');
222 if ($mode == 1) $out .=
'order_ref';
223 if ($mode == 0) $out .= urlencode($ref);
224 $out .= ($mode ?
'</font>' :
'');
225 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
227 if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .=
'&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
229 $out .=
'&securekey='.($mode ?
'<font color="#666666">' :
'');
230 if ($mode == 1) $out .=
"hash('".$conf->global->PAYMENT_SECURITY_TOKEN.
"' + '".$type.
"' + order_ref)";
231 if ($mode == 0) $out .=
dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
232 $out .= ($mode ?
'</font>' :
'');
235 } elseif ($type ==
'invoice')
237 $out = $urltouse.
'/public/payment/newpayment.php?source=invoice&ref='.($mode ?
'<font color="#666666">' :
'');
238 if ($mode == 1) $out .=
'invoice_ref';
239 if ($mode == 0) $out .= urlencode($ref);
240 $out .= ($mode ?
'</font>' :
'');
241 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
243 if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .=
'&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
245 $out .=
'&securekey='.($mode ?
'<font color="#666666">' :
'');
246 if ($mode == 1) $out .=
"hash('".$conf->global->PAYMENT_SECURITY_TOKEN.
"' + '".$type.
"' + invoice_ref)";
247 if ($mode == 0) $out .=
dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
248 $out .= ($mode ?
'</font>' :
'');
251 } elseif ($type ==
'contractline')
253 $out = $urltouse.
'/public/payment/newpayment.php?source=contractline&ref='.($mode ?
'<font color="#666666">' :
'');
254 if ($mode == 1) $out .=
'contractline_ref';
255 if ($mode == 0) $out .= urlencode($ref);
256 $out .= ($mode ?
'</font>' :
'');
257 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
259 if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .=
'&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
261 $out .=
'&securekey='.($mode ?
'<font color="#666666">' :
'');
262 if ($mode == 1) $out .=
"hash('".$conf->global->PAYMENT_SECURITY_TOKEN.
"' + '".$type.
"' + contractline_ref)";
263 if ($mode == 0) $out .=
dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
264 $out .= ($mode ?
'</font>' :
'');
267 } elseif ($type ==
'member' || $type ==
'membersubscription')
269 $out = $urltouse.
'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ?
'<font color="#666666">' :
'');
270 if ($mode == 1) $out .=
'member_ref';
271 if ($mode == 0) $out .= urlencode($ref);
272 $out .= ($mode ?
'</font>' :
'');
273 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
275 if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .=
'&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
277 $out .=
'&securekey='.($mode ?
'<font color="#666666">' :
'');
278 if ($mode == 1) $out .=
"hash('".$conf->global->PAYMENT_SECURITY_TOKEN.
"' + '".$type.
"' + member_ref)";
279 if ($mode == 0) $out .=
dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
280 $out .= ($mode ?
'</font>' :
'');
284 if ($type ==
'donation')
286 $out = $urltouse.
'/public/payment/newpayment.php?source=donation&ref='.($mode ?
'<font color="#666666">' :
'');
287 if ($mode == 1) $out .=
'donation_ref';
288 if ($mode == 0) $out .= urlencode($ref);
289 $out .= ($mode ?
'</font>' :
'');
290 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
292 if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .=
'&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
294 $out .=
'&securekey='.($mode ?
'<font color="#666666">' :
'');
295 if ($mode == 1) $out .=
"hash('".$conf->global->PAYMENT_SECURITY_TOKEN.
"' + '".$type.
"' + donation_ref)";
296 if ($mode == 0) $out .=
dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
297 $out .= ($mode ?
'</font>' :
'');
303 if (!empty($out) && !empty($conf->multicompany->enabled)) $out .=
"&entity=".$conf->entity;
320 function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix =
'', $object = null)
326 if ($fromcompany->forme_juridique_code)
331 if ($fromcompany->capital)
333 $line1 .= ($line1 ?
" - " :
"").$langs->transnoentities(
"CapitalOf", $fromcompany->capital).
" ".$langs->transnoentities(
"Currency".$conf->currency);
336 if ($fromcompany->idprof1 && ($fromcompany->country_code !=
'FR' || !$fromcompany->idprof2))
338 $field = $langs->transcountrynoentities(
"ProfId1", $fromcompany->country_code);
339 if (preg_match(
'/\((.*)\)/i', $field, $reg)) $field = $reg[1];
340 $line1 .= ($line1 ?
" - " :
"").$field.
": ".$fromcompany->idprof1;
343 if ($fromcompany->idprof2)
345 $field = $langs->transcountrynoentities(
"ProfId2", $fromcompany->country_code);
346 if (preg_match(
'/\((.*)\)/i', $field, $reg)) $field = $reg[1];
347 $line1 .= ($line1 ?
" - " :
"").$field.
": ".$fromcompany->idprof2;
353 if ($fromcompany->idprof3)
355 $field = $langs->transcountrynoentities(
"ProfId3", $fromcompany->country_code);
356 if (preg_match(
'/\((.*)\)/i', $field, $reg)) $field = $reg[1];
357 $line2 .= ($line2 ?
" - " :
"").$field.
": ".$fromcompany->idprof3;
360 if ($fromcompany->idprof4)
362 $field = $langs->transcountrynoentities(
"ProfId4", $fromcompany->country_code);
363 if (preg_match(
'/\((.*)\)/i', $field, $reg)) $field = $reg[1];
364 $line2 .= ($line2 ?
" - " :
"").$field.
": ".$fromcompany->idprof4;
367 if ($fromcompany->tva_intra !=
'')
369 $line2 .= ($line2 ?
" - " :
"").$langs->transnoentities(
"VATIntraShort").
": ".$fromcompany->tva_intra;
374 print '<div class="center">'.
"\n";
377 print '<!-- object = '.$object->element.
' -->';
380 $parammessageform =
'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
381 if (!empty($conf->global->$parammessageform))
print $langs->transnoentities($conf->global->$parammessageform);
382 elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM))
print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
385 if ($object->total_vat != 0 || $object->total_tva != 0)
387 $parammessageform =
'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
388 if (!empty($conf->global->$parammessageform))
print $langs->transnoentities($conf->global->$parammessageform);
389 elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT))
print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
393 print '<font style="font-size: 10px;"><br><hr>'."\
n";
396 if (strlen($line1.$line2) > 50)
print '<br>';
399 print '</font></div>'."\n";
dol_hash($chain, $type= '0')
Returns a hash of a string.
$conf db name
Only used if Module[ID]Name translation string is not found.
getFormeJuridiqueLabel($code)
Retourne le nom traduit de la forme juridique.
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 payments of customer invoices.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
ajax_autoselect($htmlname, $addlink= '')
Make content of an input box selected when we click into input field.
print
Draft customers invoices.
print $_SERVER["PHP_SELF"] n
Edit parameters.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.