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';
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';
162function getValidOnlinePaymentMethods($paymentmethod =
'', $mode = 0)
164 global $langs, $hookmanager, $action;
166 $validpaymentmethod = array();
168 if ((empty($paymentmethod) || $paymentmethod ==
'paypal') &&
isModEnabled(
'paypal')) {
169 $langs->load(
"paypal");
171 $validpaymentmethod[
'paypal'] = array(
'label' =>
'PayPal',
'status' =>
'valid');
173 $validpaymentmethod[
'paypal'] =
'valid';
176 if ((empty($paymentmethod) || $paymentmethod ==
'stripe') &&
isModEnabled(
'stripe')) {
177 $langs->load(
"stripe");
179 $validpaymentmethod[
'stripe'] = array(
'label' =>
'Stripe',
'status' =>
'valid');
181 $validpaymentmethod[
'stripe'] =
'valid';
188 'paymentmethod' => $paymentmethod,
190 'validpaymentmethod' => &$validpaymentmethod
193 $reshook = $hookmanager->executeHooks(
'getValidPayment', $parameters, $tmpobject, $action);
196 } elseif (!empty($hookmanager->resArray[
'validpaymentmethod'])) {
198 $validpaymentmethod = array_merge($validpaymentmethod, $hookmanager->resArray[
'validpaymentmethod']);
200 $validpaymentmethod = $hookmanager->resArray[
'validpaymentmethod'];
204 return $validpaymentmethod;
215function showOnlinePaymentUrl($type, $ref, $amount = 0)
220 $langs->loadLangs(array(
'payment',
'stripe'));
224 $out =
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForOnlinePayment", $servicename).
'</span><br>';
225 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
226 $out .=
'<div class="urllink"><input type="text" id="onlinepaymenturl" spellcheck="false" class="quatrevingtpercentminusx" value="'.$url.
'">';
227 $out .=
'<a class="" href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
229 $out .= ajax_autoselect(
"onlinepaymenturl",
'');
242function getHtmlOnlinePaymentLink($type, $ref, $label =
'', $amount = 0)
244 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
245 $label = $label ? $label : $url;
246 return '<a href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.$label.
'</a>';
261function getOnlinePaymentUrl($mode, $type, $ref =
'', $amount = 0, $freetag =
'your_tag', $localorexternal = 1)
269 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
272 $urltouse = DOL_MAIN_URL_ROOT;
275 if ((
string) $localorexternal ==
'1') {
276 $urltouse = $urlwithroot;
277 } elseif ((
string) $localorexternal !=
'0') {
278 $urltouse = $localorexternal;
281 if ($type ==
'free') {
282 $out = $urltouse.
'/public/payment/newpayment.php?amount='.($mode ?
'<span style="color: #666666">' :
'').
price2num($amount,
'MT').($mode ?
'</span>' :
'').
'&tag='.($mode ?
'<span style="color: #666666">' :
'').urlencode($freetag).($mode ?
'</span>' :
'');
287 } elseif ($type ==
'order') {
288 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
293 $out .= urlencode($ref);
295 $out .= ($mode ?
'</span>' :
'');
297 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
299 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + order_ref)";
304 $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>' :
'');
316 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
318 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
323 $out .= ($mode ?
'</span>' :
'');
325 } elseif ($type ==
'contractline') {
326 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
328 $out .=
'contractline_ref';
331 $out .= urlencode($ref);
333 $out .= ($mode ?
'</span>' :
'');
335 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
337 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + contractline_ref)";
342 $out .= ($mode ?
'</span>' :
'');
344 } elseif ($type ==
'member' || $type ==
'membersubscription') {
346 $out = $urltouse.
'/public/payment/newpayment.php?source=member';
347 $out .=
'&amount='.price2num($amount,
'MT');
348 $out .=
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
350 $out .=
'member_ref';
353 $out .= urlencode($ref);
355 $out .= ($mode ?
'</span>' :
'');
357 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
359 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$newtype.
"' + member_ref)";
364 $out .= ($mode ?
'</span>' :
'');
366 } elseif ($type ==
'donation') {
367 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
369 $out .=
'donation_ref';
372 $out .= urlencode($ref);
374 $out .= ($mode ?
'</span>' :
'');
376 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
378 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + donation_ref)";
383 $out .= ($mode ?
'</span>' :
'');
385 } elseif ($type ==
'boothlocation') {
386 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
388 $out .=
'invoice_ref';
391 $out .= urlencode($ref);
393 $out .= ($mode ?
'</span>' :
'');
395 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
397 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
402 $out .= ($mode ?
'</span>' :
'');
408 $out .=
"&entity=".$conf->entity;
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
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, $allowothertags=array())
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 '.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.