31function showOnlineSignatureUrl($type, $ref, $obj =
null, $mode =
'')
36 $langs->loadLangs(array(
"payment",
"stripe"));
38 $servicename =
'Online';
41 if ($mode !=
'short') {
42 $out .=
img_picto(
'',
'globe',
'class="pictofixedwidth"');
44 $out .=
'<span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForOnlineSignature", $servicename).
'</span><br>';
45 $url = getOnlineSignatureUrl(0, $type, $ref, 1, $obj);
46 $out .=
'<div class="urllink">';
47 if ($url == $langs->trans(
"FeatureOnlineSignDisabled")) {
50 $out .=
'<input type="text" id="onlinesignatureurl" class="'.($mode ==
'short' ?
'centpercentminusx' :
'quatrevingtpercentminusx').
'" value="'.$url.
'">';
52 $out .=
'<a class="" href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
54 $out .= ajax_autoselect(
"onlinesignatureurl",
'');
69function getOnlineSignatureUrl($mode, $type, $ref =
'', $localorexternal = 1, $obj =
null)
79 dol_syslog(__FUNCTION__.
" using global object is deprecated, please give obj as argument", LOG_WARNING);
88 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
91 $urltouse = DOL_MAIN_URL_ROOT;
92 if ($localorexternal) {
93 $urltouse = $urlwithroot;
96 global $dolibarr_main_instance_unique_id;
97 $defaultsalt = substr(
dol_hash(
'dolibarr'.$dolibarr_main_instance_unique_id,
'sha256'), 0, 32);
101 if ($type ==
'proposal') {
102 $securekeyseed =
getDolGlobalString(
'PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
103 if (strpos($securekeyseed,
"\0") !==
false) {
105 return 'Invalid parameter PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
108 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ?
'<span style="color: #666666">' :
'');
110 $out .=
'proposal_ref';
113 $out .= urlencode($ref);
115 $out .= ($mode ?
'</span>' :
'');
117 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + proposal_ref)";
119 $out .=
'&securekey='.urlencode(
dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : $obj->entity) :
''),
'hash'));
145 } elseif ($type ==
'contract') {
146 $securekeyseed =
getDolGlobalString(
'CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
147 if (strpos($securekeyseed,
"\0") !==
false) {
149 return 'Invalid parameter CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
152 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=contract&ref='.($mode ?
'<span style="color: #666666">' :
'');
154 $out .=
'contract_ref';
157 $out .= urlencode($ref);
159 $out .= ($mode ?
'</span>' :
'');
161 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + contract_ref)";
163 $out .=
'&securekey='.urlencode(
dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : (int) $obj->entity) :
''),
'hash'));
165 } elseif ($type ==
'fichinter') {
166 $securekeyseed =
getDolGlobalString(
'FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
167 if (strpos($securekeyseed,
"\0") !==
false) {
169 return 'Invalid parameter FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
172 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=fichinter&ref='.($mode ?
'<span style="color: #666666">' :
'');
174 $out .=
'fichinter_ref';
177 $out .= urlencode($ref);
179 $out .= ($mode ?
'</span>' :
'');
181 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + fichinter_ref)";
183 $out .=
'&securekey='.urlencode(
dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : (int) $obj->entity) :
''),
'hash'));
187 if (strpos($securekeyseed,
"\0") !==
false) {
189 return 'Invalid parameter '.dol_strtoupper($type).
'_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
192 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
194 $out .= $type.
'_ref';
197 $out .= urlencode($ref);
199 $out .= ($mode ?
'</span>' :
'');
201 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + $type + '_ref)";
203 $out .=
'&securekey='.urlencode(
dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : (int) $obj->entity) :
''),
'hash'));
209 $out .=
"&entity=".(empty($obj->entity) ?
'' : (int) $obj->entity);
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
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)
dol_strtoupper($string, $encoding="UTF-8")
Convert a string to upper.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.