33 global $langs, $conf, $db;
38 $head[$h][0] = DOL_URL_ROOT.
'/compta/paiement/card.php?id='.
$object->id;
39 $head[$h][1] = $langs->trans(
"Payment");
40 $head[$h][2] =
'payment';
49 $head[$h][0] = DOL_URL_ROOT.
'/compta/paiement/info.php?id='.
$object->id;
50 $head[$h][1] = $langs->trans(
"Info");
51 $head[$h][2] =
'info';
54 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
56 $upload_dir = $conf->compta->payment->dir_output.
'/'.
$object->ref;
57 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
59 $head[$h][0] = DOL_URL_ROOT.
'/compta/paiement/document.php?id='.
$object->id;
60 $head[$h][1] = $langs->trans(
'Documents');
61 if (($nbFiles + $nbLinks) > 0) {
62 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
64 $head[$h][2] =
'documents';
79function bankline_prepare_head(
$id)
86 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/line.php?rowid='.
$id;
87 $head[$h][1] = $langs->trans(
'BankTransaction');
88 $head[$h][2] =
'bankline';
97 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/info.php?rowid='.
$id;
98 $head[$h][1] = $langs->trans(
"Info");
99 $head[$h][2] =
'info';
116 global $db, $langs, $conf;
121 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/card.php?id='.
$object->id;
122 $head[$h][1] = $langs->trans(
"Payment");
123 $head[$h][2] =
'payment';
132 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/info.php?id='.
$object->id;
133 $head[$h][1] = $langs->trans(
'Info');
134 $head[$h][2] =
'info';
137 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
138 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
139 $upload_dir = $conf->fournisseur->payment->dir_output.
'/'.
$object->ref;
140 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
142 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/document.php?id='.
$object->id;
143 $head[$h][1] = $langs->trans(
'Documents');
144 if (($nbFiles + $nbLinks) > 0) {
145 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
147 $head[$h][2] =
'documents';
161function getValidOnlinePaymentMethods($paymentmethod =
'')
163 global $langs, $hookmanager, $action;
165 $validpaymentmethod = array();
167 if ((empty($paymentmethod) || $paymentmethod ==
'paypal') && isModEnabled(
'paypal')) {
168 $langs->load(
"paypal");
169 $validpaymentmethod[
'paypal'] =
'valid';
171 if ((empty($paymentmethod) || $paymentmethod ==
'paybox') && isModEnabled(
'paybox')) {
172 $langs->loadLangs(array(
"paybox",
"stripe"));
173 $validpaymentmethod[
'paybox'] =
'valid';
175 if ((empty($paymentmethod) || $paymentmethod ==
'stripe') && isModEnabled(
'stripe')) {
176 $langs->load(
"stripe");
177 $validpaymentmethod[
'stripe'] =
'valid';
183 'paymentmethod' => $paymentmethod,
184 'validpaymentmethod' => &$validpaymentmethod
187 $reshook = $hookmanager->executeHooks(
'getValidPayment', $parameters, $tmpobject, $action);
190 } elseif (!empty($hookmanager->resArray[
'validpaymentmethod'])) {
192 $validpaymentmethod = array_merge($validpaymentmethod, $hookmanager->resArray[
'validpaymentmethod']);
194 $validpaymentmethod = $hookmanager->resArray[
'validpaymentmethod'];
198 return $validpaymentmethod;
209function showOnlinePaymentUrl($type, $ref, $amount = 0)
214 $langs->loadLangs(array(
'payment',
'stripe'));
218 $out =
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForOnlinePayment", $servicename).
'</span><br>';
219 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
220 $out .=
'<div class="urllink"><input type="text" id="onlinepaymenturl" spellcheck="false" class="quatrevingtpercentminusx" value="'.$url.
'">';
221 $out .=
'<a class="" href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
236function getHtmlOnlinePaymentLink($type, $ref, $label =
'', $amount = 0)
238 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
239 $label = $label ? $label : $url;
240 return '<a href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.$label.
'</a>';
255function getOnlinePaymentUrl($mode, $type, $ref =
'', $amount = 0, $freetag =
'your_tag', $localorexternal = 1)
257 global $conf, $dolibarr_main_url_root;
262 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
263 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
266 $urltouse = DOL_MAIN_URL_ROOT;
269 if ($localorexternal) {
270 $urltouse = $urlwithroot;
273 if ($type ==
'free') {
274 $out = $urltouse.
'/public/payment/newpayment.php?amount='.($mode ?
'<span style="color: #666666">' :
'').$amount.($mode ?
'</span>' :
'').
'&tag='.($mode ?
'<span style="color: #666666">' :
'').$freetag.($mode ?
'</span>' :
'');
283 } elseif ($type ==
'order') {
284 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
289 $out .= urlencode($ref);
291 $out .= ($mode ?
'</span>' :
'');
296 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
298 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + order_ref)";
303 $out .= ($mode ?
'</span>' :
'');
306 } elseif ($type ==
'invoice') {
307 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
309 $out .=
'invoice_ref';
312 $out .= urlencode($ref);
314 $out .= ($mode ?
'</span>' :
'');
319 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
321 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
326 $out .= ($mode ?
'</span>' :
'');
329 } elseif ($type ==
'contractline') {
330 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
332 $out .=
'contractline_ref';
335 $out .= urlencode($ref);
337 $out .= ($mode ?
'</span>' :
'');
342 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
344 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + contractline_ref)";
349 $out .= ($mode ?
'</span>' :
'');
352 } elseif ($type ==
'member' || $type ==
'membersubscription') {
354 $out = $urltouse.
'/public/payment/newpayment.php?source=member';
355 $out .=
'&amount='.$amount;
356 $out .=
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
358 $out .=
'member_ref';
361 $out .= urlencode($ref);
363 $out .= ($mode ?
'</span>' :
'');
368 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
370 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$newtype.
"' + member_ref)";
375 $out .= ($mode ?
'</span>' :
'');
378 } elseif ($type ==
'donation') {
379 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
381 $out .=
'donation_ref';
384 $out .= urlencode($ref);
386 $out .= ($mode ?
'</span>' :
'');
391 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
393 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + donation_ref)";
398 $out .= ($mode ?
'</span>' :
'');
401 } elseif ($type ==
'boothlocation') {
402 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
404 $out .=
'invoice_ref';
407 $out .= urlencode($ref);
409 $out .= ($mode ?
'</span>' :
'');
414 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
416 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
421 $out .= ($mode ?
'</span>' :
'');
427 if (!empty($out) && isModEnabled(
'multicompany')) {
428 $out .=
"&entity=".$conf->entity;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage payments of customer invoices.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.