32 global $langs, $conf, $db;
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';
53 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
55 $upload_dir = $conf->compta->payment->dir_output.
'/'.
$object->ref;
56 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
58 $head[$h][0] = DOL_URL_ROOT.
'/compta/paiement/document.php?id='.
$object->id;
59 $head[$h][1] = $langs->trans(
'Documents');
60 if (($nbFiles + $nbLinks) > 0) {
61 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
63 $head[$h][2] =
'documents';
78function bankline_prepare_head($id)
85 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/line.php?rowid='.$id;
86 $head[$h][1] = $langs->trans(
'BankTransaction');
87 $head[$h][2] =
'bankline';
96 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/info.php?rowid='.$id;
97 $head[$h][1] = $langs->trans(
"Info");
98 $head[$h][2] =
'info';
115 global $db, $langs, $conf;
120 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/card.php?id='.
$object->id;
121 $head[$h][1] = $langs->trans(
"Payment");
122 $head[$h][2] =
'payment';
131 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/info.php?id='.
$object->id;
132 $head[$h][1] = $langs->trans(
'Info');
133 $head[$h][2] =
'info';
136 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
137 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
138 $upload_dir = $conf->fournisseur->payment->dir_output.
'/'.
$object->ref;
139 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
141 $head[$h][0] = DOL_URL_ROOT.
'/fourn/paiement/document.php?id='.
$object->id;
142 $head[$h][1] = $langs->trans(
'Documents');
143 if (($nbFiles + $nbLinks) > 0) {
144 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
146 $head[$h][2] =
'documents';
160function getValidOnlinePaymentMethods($paymentmethod =
'')
162 global $langs, $hookmanager, $action;
164 $validpaymentmethod = array();
166 if ((empty($paymentmethod) || $paymentmethod ==
'paypal') && isModEnabled(
'paypal')) {
167 $langs->load(
"paypal");
168 $validpaymentmethod[
'paypal'] =
'valid';
170 if ((empty($paymentmethod) || $paymentmethod ==
'paybox') && isModEnabled(
'paybox')) {
171 $langs->loadLangs(array(
"paybox",
"stripe"));
172 $validpaymentmethod[
'paybox'] =
'valid';
174 if ((empty($paymentmethod) || $paymentmethod ==
'stripe') && isModEnabled(
'stripe')) {
175 $langs->load(
"stripe");
176 $validpaymentmethod[
'stripe'] =
'valid';
182 'paymentmethod' => $paymentmethod,
183 'validpaymentmethod' => &$validpaymentmethod
186 $reshook = $hookmanager->executeHooks(
'getValidPayment', $parameters, $tmpobject, $action);
189 } elseif (!empty($hookmanager->resArray[
'validpaymentmethod'])) {
191 $validpaymentmethod = array_merge($validpaymentmethod, $hookmanager->resArray[
'validpaymentmethod']);
193 $validpaymentmethod = $hookmanager->resArray[
'validpaymentmethod'];
197 return $validpaymentmethod;
208function showOnlinePaymentUrl($type, $ref, $amount = 0)
213 $langs->loadLangs(array(
'payment',
'stripe'));
217 $out =
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForOnlinePayment", $servicename).
'</span><br>';
218 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
219 $out .=
'<div class="urllink"><input type="text" id="onlinepaymenturl" class="quatrevingtpercentminusx" value="'.$url.
'">';
220 $out .=
'<a class="" href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
235function getHtmlOnlinePaymentLink($type, $ref, $label =
'', $amount = 0)
237 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
238 $label = $label ? $label : $url;
239 return '<a href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.$label.
'</a>';
254function getOnlinePaymentUrl($mode, $type, $ref =
'', $amount = 0, $freetag =
'your_tag', $localorexternal = 1)
256 global $conf, $dolibarr_main_url_root;
261 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
262 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
265 $urltouse = DOL_MAIN_URL_ROOT;
268 if ($localorexternal) {
269 $urltouse = $urlwithroot;
272 if ($type ==
'free') {
273 $out = $urltouse.
'/public/payment/newpayment.php?amount='.($mode ?
'<span style="color: #666666">' :
'').
price2num($amount,
'MT').($mode ?
'</span>' :
'').
'&tag='.($mode ?
'<span style="color: #666666">' :
'').$freetag.($mode ?
'</span>' :
'');
282 } elseif ($type ==
'order') {
283 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
288 $out .= urlencode($ref);
290 $out .= ($mode ?
'</span>' :
'');
295 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
297 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + order_ref)";
302 $out .= ($mode ?
'</span>' :
'');
305 } elseif ($type ==
'invoice') {
306 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
308 $out .=
'invoice_ref';
311 $out .= urlencode($ref);
313 $out .= ($mode ?
'</span>' :
'');
318 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
320 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
325 $out .= ($mode ?
'</span>' :
'');
328 } elseif ($type ==
'contractline') {
329 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
331 $out .=
'contractline_ref';
334 $out .= urlencode($ref);
336 $out .= ($mode ?
'</span>' :
'');
341 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
343 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + contractline_ref)";
348 $out .= ($mode ?
'</span>' :
'');
351 } elseif ($type ==
'member' || $type ==
'membersubscription') {
353 $out = $urltouse.
'/public/payment/newpayment.php?source=member';
354 $out .=
'&amount='.price2num($amount,
'MT');
355 $out .=
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
357 $out .=
'member_ref';
360 $out .= urlencode($ref);
362 $out .= ($mode ?
'</span>' :
'');
367 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
369 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$newtype.
"' + member_ref)";
374 $out .= ($mode ?
'</span>' :
'');
377 } elseif ($type ==
'donation') {
378 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
380 $out .=
'donation_ref';
383 $out .= urlencode($ref);
385 $out .= ($mode ?
'</span>' :
'');
390 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
392 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + donation_ref)";
397 $out .= ($mode ?
'</span>' :
'');
400 } elseif ($type ==
'boothlocation') {
401 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
403 $out .=
'invoice_ref';
406 $out .= urlencode($ref);
408 $out .= ($mode ?
'</span>' :
'');
413 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
415 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
420 $out .= ($mode ?
'</span>' :
'');
426 if (!empty($out) && isModEnabled(
'multicompany')) {
427 $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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 dolibarr global constant string value.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.