dolibarr  7.0.0-beta
signature.lib.php
1 <?php
27 function showOnlineSignatureUrl($type,$ref)
28 {
29  global $conf, $langs;
30 
31  $langs->load("payment");
32  $langs->load("paybox");
33  $servicename='Online';
34 
35  $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlineSignature",$servicename).'<br>';
36  $url = getOnlineSignatureUrl(0, $type, $ref);
37  $out.= '<input type="text" id="onlinesignatureurl" class="quatrevingtpercent" value="'.$url.'">';
38  $out.= ajax_autoselect("onlinesignatureurl", 0);
39  return $out;
40 }
41 
42 
51 function getOnlineSignatureUrl($mode, $type, $ref='')
52 {
53  global $conf, $db, $langs;
54 
55  $ref=str_replace(' ','',$ref);
56  $out='';
57 
58  if ($type == 'proposal')
59  {
60  $out=DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode?'<font color="#666666">':'');
61  if ($mode == 1) $out.='proposal_ref';
62  if ($mode == 0) $out.=urlencode($ref);
63  $out.=($mode?'</font>':'');
64  if ($mode == 1) $out.='&hashp=<font color="#666666">hash_of_file</font>';
65  else
66  {
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  }
83  else
84  {
85  $out.='&hashp='.$hashp;
86  }
87  }
88  }
89 
90  // For multicompany
91  if (! empty($out)) $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
92 
93  return $out;
94 }
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
ajax_autoselect($htmlname, $addlink='')
Make content of an input box selected when we click into input field.
Definition: ajax.lib.php:367
Class to manage ECM files.
Class to manage proposals.