31function showOnlineSignatureUrl($type, $ref, $obj =
null, $mode =
'')
36 $langs->loadLangs(array(
"payment",
"paybox",
"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>';
69function getOnlineSignatureUrl($mode, $type, $ref =
'', $localorexternal = 1, $obj =
null)
71 global $dolibarr_main_url_root;
79 dol_syslog(__FUNCTION__.
" using global object is deprecated, please give obj as argument", LOG_WARNING);
87 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
88 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
91 $urltouse = DOL_MAIN_URL_ROOT;
92 if ($localorexternal) {
93 $urltouse = $urlwithroot;
98 if ($type ==
'proposal') {
100 if (strpos($securekeyseed,
"\0") !==
false) {
102 return 'Invalid parameter PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
105 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ?
'<span style="color: #666666">' :
'');
107 $out .=
'proposal_ref';
110 $out .= urlencode($ref);
112 $out .= ($mode ?
'</span>' :
'');
114 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + proposal_ref)";
116 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : $obj->entity) :
''),
'0');
142 } elseif ($type ==
'contract') {
144 if (strpos($securekeyseed,
"\0") !==
false) {
146 return 'Invalid parameter CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
149 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=contract&ref='.($mode ?
'<span style="color: #666666">' :
'');
151 $out .=
'contract_ref';
154 $out .= urlencode($ref);
156 $out .= ($mode ?
'</span>' :
'');
158 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + contract_ref)";
160 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : (int) $obj->entity) :
''),
'0');
162 } elseif ($type ==
'fichinter') {
164 if (strpos($securekeyseed,
"\0") !==
false) {
166 return 'Invalid parameter FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
169 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source=fichinter&ref='.($mode ?
'<span style="color: #666666">' :
'');
171 $out .=
'fichinter_ref';
174 $out .= urlencode($ref);
176 $out .= ($mode ?
'</span>' :
'');
178 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + fichinter_ref)";
180 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? (empty($obj->entity) ?
'' : (int) $obj->entity) :
''),
'0');
184 if (strpos($securekeyseed,
"\0") !==
false) {
186 return 'Invalid parameter '.dol_strtoupper($type).
'_ONLINE_SIGNATURE_SECURITY_TOKEN. Contains a null character.';
189 $out = $urltouse.
'/public/onlinesign/newonlinesign.php?source='.$type.
'&ref='.($mode ?
'<span style="color: #666666">' :
'');
191 $out .= $type.
'_ref';
194 $out .= urlencode($ref);
196 $out .= ($mode ?
'</span>' :
'');
198 $out .=
"hash('".$securekeyseed.
"' + '".$type.
"' + $type + '_ref)";
200 $out .=
'&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled(
'multicompany') ?
'' : $obj->entity),
'0');
205 if (!empty($out) && isModEnabled(
'multicompany')) {
206 $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.