dolibarr  13.0.2
signature.lib.php
1 <?php
27 function showOnlineSignatureUrl($type, $ref)
28 {
29  global $conf, $langs;
30 
31  // Load translation files required by the page
32  $langs->loadLangs(array("payment", "paybox"));
33 
34  $servicename = 'Online';
35 
36  $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlineSignature", $servicename).'<br>';
37  $url = getOnlineSignatureUrl(0, $type, $ref);
38  $out .= '<input type="text" id="onlinesignatureurl" class="quatrevingtpercent" value="'.$url.'">';
39  $out .= ajax_autoselect("onlinesignatureurl", 0);
40  return $out;
41 }
42 
43 
52 function getOnlineSignatureUrl($mode, $type, $ref = '')
53 {
54  global $conf, $db, $langs;
55 
56  $ref = str_replace(' ', '', $ref);
57  $out = '';
58 
59  if ($type == 'proposal')
60  {
61  $out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<font color="#666666">' : '');
62  if ($mode == 1) $out .= 'proposal_ref';
63  if ($mode == 0) $out .= urlencode($ref);
64  $out .= ($mode ? '</font>' : '');
65  if ($mode == 1) $out .= '&hashp=<font color="#666666">hash_of_file</font>';
66  else {
67  include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
68  $propaltmp = new Propal($db);
69  $res = $propaltmp->fetch(0, $ref);
70  if ($res <= 0) return 'FailedToGetProposal';
71 
72  include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
73  $ecmfile = new EcmFiles($db);
74 
75  $ecmfile->fetch(0, '', $propaltmp->last_main_doc);
76 
77  $hashp = $ecmfile->share;
78  if (empty($hashp))
79  {
80  $out = $langs->trans("FeatureOnlineSignDisabled");
81  return $out;
82  } else {
83  $out .= '&hashp='.$hashp;
84  }
85  }
86  }
87 
88  // For multicompany
89  if (!empty($out)) $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
90 
91  return $out;
92 }
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
ajax_autoselect($htmlname, $addlink= '')
Make content of an input box selected when we click into input field.
Class to manage ECM files.
Class to manage proposals.