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';
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 ==
'paybox') &&
isModEnabled(
'paybox')) {
177 $langs->load(
"stripe");
179 $validpaymentmethod[
'paybox'] = array(
'label' =>
'PayBox',
'status' =>
'valid');
181 $validpaymentmethod[
'paybox'] =
'valid';
184 if ((empty($paymentmethod) || $paymentmethod ==
'stripe') &&
isModEnabled(
'stripe')) {
185 $langs->load(
"stripe");
187 $validpaymentmethod[
'stripe'] = array(
'label' =>
'Stripe',
'status' =>
'valid');
189 $validpaymentmethod[
'stripe'] =
'valid';
196 'paymentmethod' => $paymentmethod,
198 'validpaymentmethod' => &$validpaymentmethod
201 $reshook = $hookmanager->executeHooks(
'getValidPayment', $parameters, $tmpobject, $action);
204 } elseif (!empty($hookmanager->resArray[
'validpaymentmethod'])) {
206 $validpaymentmethod = array_merge($validpaymentmethod, $hookmanager->resArray[
'validpaymentmethod']);
208 $validpaymentmethod = $hookmanager->resArray[
'validpaymentmethod'];
212 return $validpaymentmethod;
223function showOnlinePaymentUrl($type, $ref, $amount = 0)
228 $langs->loadLangs(array(
'payment',
'stripe'));
232 $out =
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForOnlinePayment", $servicename).
'</span><br>';
233 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
234 $out .=
'<div class="urllink"><input type="text" id="onlinepaymenturl" spellcheck="false" class="quatrevingtpercentminusx" value="'.$url.
'">';
235 $out .=
'<a class="" href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
250function getHtmlOnlinePaymentLink($type, $ref, $label =
'', $amount = 0)
252 $url = getOnlinePaymentUrl(0, $type, $ref, $amount);
253 $label = $label ? $label : $url;
254 return '<a href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.$label.
'</a>';
269function getOnlinePaymentUrl($mode, $type, $ref =
'', $amount = 0, $freetag =
'your_tag', $localorexternal = 1)
277 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
280 $urltouse = DOL_MAIN_URL_ROOT;
283 if ((
string) $localorexternal ==
'1') {
284 $urltouse = $urlwithroot;
285 } elseif ((
string) $localorexternal !=
'0') {
286 $urltouse = $localorexternal;
289 if ($type ==
'free') {
290 $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>' :
'');
299 } elseif ($type ==
'order') {
300 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
305 $out .= urlencode($ref);
307 $out .= ($mode ?
'</span>' :
'');
312 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
314 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + order_ref)";
319 $out .= ($mode ?
'</span>' :
'');
322 } elseif ($type ==
'invoice') {
323 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
325 $out .=
'invoice_ref';
328 $out .= urlencode($ref);
330 $out .= ($mode ?
'</span>' :
'');
335 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
337 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
342 $out .= ($mode ?
'</span>' :
'');
345 } elseif ($type ==
'contractline') {
346 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
348 $out .=
'contractline_ref';
351 $out .= urlencode($ref);
353 $out .= ($mode ?
'</span>' :
'');
358 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
360 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + contractline_ref)";
365 $out .= ($mode ?
'</span>' :
'');
368 } elseif ($type ==
'member' || $type ==
'membersubscription') {
370 $out = $urltouse.
'/public/payment/newpayment.php?source=member';
371 $out .=
'&amount='.price2num($amount,
'MT');
372 $out .=
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
374 $out .=
'member_ref';
377 $out .= urlencode($ref);
379 $out .= ($mode ?
'</span>' :
'');
384 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
386 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$newtype.
"' + member_ref)";
391 $out .= ($mode ?
'</span>' :
'');
394 } elseif ($type ==
'donation') {
395 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
397 $out .=
'donation_ref';
400 $out .= urlencode($ref);
402 $out .= ($mode ?
'</span>' :
'');
407 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
409 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + donation_ref)";
414 $out .= ($mode ?
'</span>' :
'');
417 } elseif ($type ==
'boothlocation') {
418 $out = $urltouse.
'/public/payment/newpayment.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
420 $out .=
'invoice_ref';
423 $out .= urlencode($ref);
425 $out .= ($mode ?
'</span>' :
'');
430 $out .=
'&securekey='.($mode ?
'<span style="color: #666666">' :
'');
432 $out .=
"hash('" .
getDolGlobalString(
'PAYMENT_SECURITY_TOKEN').
"' + '".$type.
"' + invoice_ref)";
437 $out .= ($mode ?
'</span>' :
'');
444 $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 '.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.