dolibarr  9.0.0
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('','object_globe.png').' '.$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  {
68  include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
69  $propaltmp=new Propal($db);
70  $res = $propaltmp->fetch(0, $ref);
71  if ($res <= 0) return 'FailedToGetProposal';
72 
73  include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
74  $ecmfile=new EcmFiles($db);
75 
76  $ecmfile->fetch(0, '', $propaltmp->last_main_doc);
77 
78  $hashp=$ecmfile->share;
79  if (empty($hashp))
80  {
81  $out = $langs->trans("FeatureOnlineSignDisabled");
82  return $out;
83  }
84  else
85  {
86  $out.='&hashp='.$hashp;
87  }
88  }
89  }
90 
91  // For multicompany
92  if (! empty($out)) $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
93 
94  return $out;
95 }
ajax_autoselect($htmlname, $addlink='')
Make content of an input box selected when we click into input field.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it&#39;s its name (generic function)
Class to manage ECM files.
Class to manage proposals.