30function showOnlineSignatureUrl($type, $ref, $obj =
null, $mode =
'')
35 $langs->loadLangs(array(
"payment",
"paybox",
"stripe"));
37 $servicename =
'Online';
40 if ($mode !=
'short') {
41 $out .=
img_picto(
'',
'globe',
'class="pictofixedwidth"');
43 $out .=
'<span class="opacitymedium">'.$langs->trans(
"ToOfferALinkForOnlineSignature", $servicename).
'</span><br>';
44 $url = getOnlineSignatureUrl(0, $type, $ref, 1, $obj);
45 $out .=
'<div class="urllink">';
46 if ($url == $langs->trans(
"FeatureOnlineSignDisabled")) {
49 $out .=
'<input type="text" id="onlinesignatureurl" class="'.($mode ==
'short' ?
'centpercentminusx' :
'quatrevingtpercentminusx').
'" value="'.$url.
'">';
51 $out .=
'<a class="" href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe',
'class="paddingleft"').
'</a>';
68function getOnlineSignatureUrl($mode, $type, $ref =
'', $localorexternal = 1, $obj =
null)
70 global $dolibarr_main_url_root;
78 dol_syslog(__FUNCTION__.
" using global object is deprecated, please give obj as argument", LOG_WARNING);
86 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
87 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
90 $urltouse = DOL_MAIN_URL_ROOT;
91 if ($localorexternal) {
92 $urltouse = $urlwithroot;
97 if ($type ==
'proposal') {
99 if (strpos($securekeyseed,
"\0") !==
false) {
101 return 'Invalid parameter PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
104 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ?
'<span style="color: #666666">' :
'');
106 $out .=
'proposal_ref';
109 $out .= urlencode($ref);
111 $out .= ($mode ?
'</span>' :
'');
113 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + proposal_ref)";
115 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : $obj->entity) :
''),
'0');
141 } elseif ($type ==
'contract') {
143 if (strpos($securekeyseed,
"\0") !==
false) {
145 return 'Invalid parameter CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
148 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=contract&ref='.($mode ?
'<span style="color: #666666">' :
'');
150 $out .=
'contract_ref';
153 $out .= urlencode($ref);
155 $out .= ($mode ?
'</span>' :
'');
157 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + contract_ref)";
159 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : (int) $obj->entity) :
''),
'0');
161 } elseif ($type ==
'fichinter') {
163 if (strpos($securekeyseed,
"\0") !==
false) {
165 return 'Invalid parameter FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
168 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=fichinter&ref='.($mode ?
'<span style="color: #666666">' :
'');
170 $out .=
'fichinter_ref';
173 $out .= urlencode($ref);
175 $out .= ($mode ?
'</span>' :
'');
177 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + fichinter_ref)";
179 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : (int) $obj->entity) :
''),
'0');
183 if (strpos($securekeyseed,
"\0") !==
false) {
185 return 'Invalid parameter '.dol_strtoupper($type).
'_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
188 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
190 $out .= $type.
'_ref';
193 $out .= urlencode($ref);
195 $out .= ($mode ?
'</span>' :
'');
197 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + $type + '_ref)";
199 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled(
'multicompany') ?
'' :
$object->entity),
'0');
204 if (!empty($out) && isModEnabled(
'multicompany')) {
205 $out .=
"&entity=".(empty($obj->entity) ?
'' : (int) $obj->entity);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
dol_strtoupper($string, $encoding="UTF-8")
Convert a string to upper.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.