24if (!defined(
'NOTOKENRENEWAL')) {
 
   25  define(
'NOTOKENRENEWAL', 
'1'); 
 
   27if (!defined(
'NOREQUIREHTML')) {
 
   28  define(
'NOREQUIREHTML', 
'1');
 
   30if (!defined(
'NOREQUIREAJAX')) {
 
   31  define(
'NOREQUIREAJAX', 
'1');
 
   38if (!defined(
'NOREQUIREMENU')) {
 
   39  define(
'NOREQUIREMENU', 
'1');
 
   42if (!defined(
"NOLOGIN")) {
 
   43  define(
"NOLOGIN", 
'1');
 
   45if (!defined(
'NOIPCHECK')) {
 
   46  define(
'NOIPCHECK', 
'1'); 
 
   48if (!defined(
'NOBROWSERNOTIF')) {
 
   49  define(
'NOBROWSERNOTIF', 
'1');
 
   51$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));  
 
   52if (is_numeric($entity)) {
 
   53  define(
"DOLENTITY", $entity);
 
   55include 
'../../main.inc.php';
 
   56require_once DOL_DOCUMENT_ROOT . 
'/core/lib/files.lib.php';
 
   58$action = 
GETPOST(
'action', 
'aZ09');
 
   60$signature = 
GETPOST(
'signaturebase64');
 
   63$SECUREKEY = 
GETPOST(
"securekey"); 
 
   64$online_sign_name = 
GETPOST(
"onlinesignname");
 
   73if ($type == 
'proposal') {
 
   75} elseif ($type == 
'contract') {
 
   77} elseif ($type == 
'fichinter') {
 
   80  $securekeyseed = 
getDolGlobalString(strtoupper($type).
'_ONLINE_SIGNATURE_SECURITY_TOKEN');
 
   83if (empty($SECUREKEY) || !
dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled(
'multicompany') ? 
'' : $entity), $SECUREKEY, 
'0')) {
 
   88$hookmanager->initHooks(array(
'ajaxonlinesign'));
 
  104if ($action == 
"importSignature") {
 
  105  $issignatureok = (!empty($signature) && $signature[0] == 
"image/png;base64");
 
  106  if ($issignatureok) {
 
  107    $signature = $signature[1];
 
  108    $data = base64_decode($signature);
 
  110    if ($mode == 
"propale" || $mode == 
'proposal') {
 
  111      require_once DOL_DOCUMENT_ROOT . 
'/comm/propal/class/propal.class.php';
 
  112      require_once DOL_DOCUMENT_ROOT . 
'/core/lib/pdf.lib.php';
 
  116      $upload_dir = !empty($conf->propal->multidir_output[
$object->entity]) ? $conf->propal->multidir_output[
$object->entity] : $conf->propal->dir_output;
 
  121      $langs->loadLangs(array(
"main", 
"companies"));
 
  124      $filename = 
"signatures/" . $date . 
"_signature.png";
 
  125      if (!is_dir($upload_dir . 
"signatures/")) {
 
  126        if (!
dol_mkdir($upload_dir . 
"signatures/")) {
 
  127          $response = 
"Error mkdir. Failed to create dir " . $upload_dir . 
"signatures/";
 
  133        $return = file_put_contents($upload_dir . $filename, $data);
 
  134        if ($return == 
false) {
 
  136          $response = 
'Error file_put_content: failed to create signature file.';
 
  142        $last_main_doc_file = 
$object->last_main_doc;
 
  143        $directdownloadlink = 
$object->getLastMainDocLink(
'proposal');    
 
  145        if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
 
  147          $newpdffilename = $upload_dir . $ref . 
"_signed-" . $date . 
".pdf";
 
  148          $sourcefile = $upload_dir . $ref . 
".pdf";
 
  151            $parameters = array(
'sourcefile' => $sourcefile, 
'newpdffilename' => $newpdffilename);
 
  152            $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters, 
$object, $action); 
 
  157            if (empty($reshook)) {
 
  160              if (class_exists(
'TCPDF')) {
 
  161                $pdf->setPrintHeader(
false);
 
  162                $pdf->setPrintFooter(
false);
 
  167                $pdf->SetCompression(
false);
 
  171              $pagecount = $pdf->setSourceFile($sourcefile);        
 
  174              $param[
'online_sign_name'] = $online_sign_name;
 
  175              $param[
'pathtoimage'] = $upload_dir . $filename;
 
  178              for ($i = 1; $i < ($pagecount + 1); $i++) {
 
  180                  $tppl = $pdf->importPage($i);
 
  181                  $s = $pdf->getTemplatesize($tppl);
 
  182                  $pdf->AddPage($s[
'h'] > $s[
'w'] ? 
'P' : 
'L');
 
  183                  $pdf->useTemplate($tppl);
 
  184                  $propalsignonspecificpage = 
getDolGlobalInt(
"PROPAL_SIGNATURE_ON_SPECIFIC_PAGE");
 
  185                  if ($propalsignonspecificpage < 0) {
 
  186                    $propalsignonspecificpage = $pagecount - abs($propalsignonspecificpage);
 
  189                  if (
getDolGlobalString(
"PROPAL_SIGNATURE_ON_ALL_PAGES") || $propalsignonspecificpage == $i) {
 
  196                      $param[
'xforimgstart'] = (empty($s[
'w']) ? 120 : round($s[
'w'] / 2) + 15);
 
  201                      $param[
'yforimgstart'] = (empty($s[
'h']) ? 240 : $s[
'h'] - 60);
 
  206                      $param[
'wforimg'] = $s[
'w'] - 20 - $param[
'xforimgstart'];
 
  212                  dol_syslog(
"Error when manipulating the PDF " . $sourcefile . 
" by onlineSign: " . $e->getMessage(), LOG_ERR);
 
  213                  $response = $e->getMessage();
 
  225                  $param[
'xforimgstart'] = (empty($s[
'w']) ? 120 : round($s[
'w'] / 2) + 15);
 
  230                  $param[
'yforimgstart'] = (empty($s[
'h']) ? 240 : $s[
'h'] - 60);
 
  235                  $param[
'wforimg'] = $s[
'w'] - 20 - $param[
'xforimgstart'];
 
  242              $pdf->Output($newpdffilename, 
"F");
 
  245              $object->indexFile($newpdffilename, 1);
 
  248        } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
 
  262        $sql = 
"UPDATE " . MAIN_DB_PREFIX . 
"propal";
 
  263        $sql .= 
" SET fk_statut = " . ((int) $object::STATUS_SIGNED) . 
", note_private = '" . $db->escape(
$object->note_private) . 
"',";
 
  264        $sql .= 
" date_signature = '" . $db->idate(
dol_now()) . 
"',";
 
  265        $sql .= 
" online_sign_ip = '" . $db->escape($online_sign_ip) . 
"'";
 
  266        if ($online_sign_name) {
 
  267          $sql .= 
", online_sign_name = '" . $db->escape($online_sign_name) . 
"'";
 
  269        $sql .= 
" WHERE rowid = " . ((int) 
$object->id);
 
  272        $resql = $db->query($sql);
 
  276          $num = $db->affected_rows($resql);
 
  280          if (method_exists(
$object, 
'call_trigger')) {
 
  282            $user = 
new User($db);
 
  283            $user->fetch(
$object->user_validation_id);
 
  284            $object->context = array(
'closedfromonlinesignature' => 
'closedfromonlinesignature');
 
  285            $result = 
$object->call_trigger(
'PROPAL_CLOSE_SIGNED', $user);
 
  288              $response = 
"error in trigger " . 
$object->error;
 
  290              $response = 
"success";
 
  293            $response = 
"success";
 
  297          $response = 
"error sql";
 
  302          $response = 
"success";
 
  308    } elseif ($mode == 
'contract') {
 
  309      require_once DOL_DOCUMENT_ROOT . 
'/contrat/class/contrat.class.php';
 
  310      require_once DOL_DOCUMENT_ROOT . 
'/core/lib/pdf.lib.php';
 
  314      $upload_dir = !empty($conf->contrat->multidir_output[
$object->entity]) ? $conf->contrat->multidir_output[
$object->entity] : $conf->contrat->dir_output;
 
  318      $filename = 
"signatures/" . $date . 
"_signature.png";
 
  319      if (!is_dir($upload_dir . 
"signatures/")) {
 
  320        if (!
dol_mkdir($upload_dir . 
"signatures/")) {
 
  321          $response = 
"Error mkdir. Failed to create dir " . $upload_dir . 
"signatures/";
 
  327        $return = file_put_contents($upload_dir . $filename, $data);
 
  328        if ($return == 
false) {
 
  330          $response = 
'Error file_put_content: failed to create signature file.';
 
  336        $last_main_doc_file = 
$object->last_main_doc;
 
  337        $directdownloadlink = 
$object->getLastMainDocLink(
'contrat');    
 
  339        if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
 
  341          $newpdffilename = $upload_dir . $ref . 
"_signed-" . $date . 
".pdf";
 
  342          $sourcefile = $upload_dir . $ref . 
".pdf";
 
  345            $parameters = array(
'sourcefile' => $sourcefile, 
'newpdffilename' => $newpdffilename);
 
  346            $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters, 
$object, $action); 
 
  351            if (empty($reshook)) {
 
  354              if (class_exists(
'TCPDF')) {
 
  355                $pdf->setPrintHeader(
false);
 
  356                $pdf->setPrintFooter(
false);
 
  361                $pdf->SetCompression(
false);
 
  365              $pagecount = $pdf->setSourceFile($sourcefile);        
 
  368              $param[
'online_sign_name'] = $online_sign_name;
 
  369              $param[
'pathtoimage'] = $upload_dir . $filename;
 
  372              for ($i = 1; $i < ($pagecount + 1); $i++) {
 
  374                  $tppl = $pdf->importPage($i);
 
  375                  $s = $pdf->getTemplatesize($tppl);
 
  376                  $pdf->AddPage($s[
'h'] > $s[
'w'] ? 
'P' : 
'L');
 
  377                  $pdf->useTemplate($tppl);
 
  386                      $param[
'xforimgstart'] = 10;
 
  391                      $param[
'yforimgstart'] = (empty($s[
'h']) ? 240 : $s[
'h'] - 65);
 
  396                      $param[
'wforimg'] = $s[
'w'] / 2 - $param[
'xforimgstart'];
 
  402                  dol_syslog(
"Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
 
  403                  $response = $e->getMessage();
 
  412                $param[
'xforimgstart'] = 10;
 
  413                $param[
'yforimgstart'] = (empty($s[
'h']) ? 240 : $s[
'h'] - 65);
 
  414                $param[
'wforimg'] = $s[
'w'] / 2 - $param[
'xforimgstart'];
 
  420              $pdf->Output($newpdffilename, 
"F");
 
  423              $object->indexFile($newpdffilename, 1);
 
  427            $response = 
"success";
 
  429        } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
 
  437    } elseif ($mode == 
'fichinter') {
 
  438      require_once DOL_DOCUMENT_ROOT . 
'/fichinter/class/fichinter.class.php';
 
  439      require_once DOL_DOCUMENT_ROOT . 
'/core/lib/pdf.lib.php';
 
  443      $upload_dir = !empty($conf->ficheinter->multidir_output[
$object->entity]) ? $conf->ficheinter->multidir_output[
$object->entity] : $conf->ficheinter->dir_output;
 
  444      $upload_dir .= 
'/'.dol_sanitizeFileName(
$object->ref).
'/';
 
  446      $langs->loadLangs(array(
"main", 
"companies"));
 
  452      $filename = 
"signatures/" . $date . 
"_signature.png";
 
  453      if (!is_dir($upload_dir . 
"signatures/")) {
 
  454        if (!
dol_mkdir($upload_dir . 
"signatures/")) {
 
  455          $response = 
"Error mkdir. Failed to create dir " . $upload_dir . 
"signatures/";
 
  461        $return = file_put_contents($upload_dir . $filename, $data);
 
  462        if ($return == 
false) {
 
  464          $response = 
'Error file_put_content: failed to create signature file.';
 
  470        $last_main_doc_file = 
$object->last_main_doc;
 
  471        $directdownloadlink = 
$object->getLastMainDocLink(
'fichinter');    
 
  473        if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
 
  475          $newpdffilename = $upload_dir . $ref . 
"_signed-" . $date . 
".pdf";
 
  476          $sourcefile = $upload_dir . $ref . 
".pdf";
 
  479            $parameters = array(
'sourcefile' => $sourcefile, 
'newpdffilename' => $newpdffilename);
 
  480            $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters, 
$object, $action); 
 
  485            if (empty($reshook)) {
 
  488              if (class_exists(
'TCPDF')) {
 
  489                $pdf->setPrintHeader(
false);
 
  490                $pdf->setPrintFooter(
false);
 
  495                $pdf->SetCompression(
false);
 
  499              $pagecount = $pdf->setSourceFile($sourcefile);        
 
  502              $param[
'online_sign_name'] = $online_sign_name;
 
  503              $param[
'pathtoimage'] = $upload_dir . $filename;
 
  506              for ($i = 1; $i < ($pagecount + 1); $i++) {
 
  508                  $tppl = $pdf->importPage($i);
 
  509                  $s = $pdf->getTemplatesize($tppl);
 
  510                  $pdf->AddPage($s[
'h'] > $s[
'w'] ? 
'P' : 
'L');
 
  511                  $pdf->useTemplate($tppl);
 
  520                      $param[
'xforimgstart'] = 111;
 
  525                      $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 60);
 
  530                      $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
 
  536                  dol_syslog(
"Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
 
  537                  $response = $e->getMessage();
 
  546                $param[
'xforimgstart'] = 111;
 
  547                $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 60);
 
  548                $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
 
  554              $pdf->Output($newpdffilename, 
"F");
 
  557              $object->indexFile($newpdffilename, 1);
 
  561            $response = 
"success";
 
  563        } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
 
  571    } elseif ($mode == 
"societe_rib") {
 
  572      $langs->load(
'withdrawals');
 
  573      require_once DOL_DOCUMENT_ROOT . 
'/societe/class/companybankaccount.class.php';
 
  574      require_once DOL_DOCUMENT_ROOT . 
'/core/lib/pdf.lib.php';
 
  575      $modelpath = 
"core/modules/bank/doc/";
 
  585        $langs->loadLangs(array(
"main", 
"companies"));
 
  588        $filename = 
"signatures/" . $date . 
"_signature.png";
 
  589        if (!
dol_is_dir($upload_dir . 
"signatures/")) {
 
  590          if (!
dol_mkdir($upload_dir . 
"signatures/")) {
 
  591            $response = 
"Error mkdir. Failed to create dir " . $upload_dir . 
"signatures/";
 
  596          $response = 
"Error directory " . $upload_dir . 
"signatures/ is not writable";
 
  600          $response = 
"Error directory " . DOL_DATA_ROOT.
"/admin/temp/ is not writable";
 
  605          $return = file_put_contents($upload_dir . $filename, $data);
 
  606          if ($return == 
false) {
 
  608            $response = 
'Error file_put_content: failed to create signature file.';
 
  614          $last_main_doc_file = 
$object->last_main_doc;
 
  615          $last_modelpdf = 
$object->model_pdf;
 
  616          $directdownloadlink = 
$object->getLastMainDocLink(
'company');    
 
  618          if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
 
  620            $newpdffilename = 
'';
 
  621            if ($last_modelpdf == 
'sepamandate') {
 
  626              $parameters = array(
'sourcefile' => $sourcefile, 
'newpdffilename' => $newpdffilename);
 
  627              $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters, 
$object, $action); 
 
  632              if (empty($reshook)) {
 
  635                if (class_exists(
'TCPDF')) {
 
  636                  $pdf->setPrintHeader(
false);
 
  637                  $pdf->setPrintFooter(
false);
 
  642                  $pdf->SetCompression(
false);
 
  646                $pagecount = $pdf->setSourceFile($sourcefile);        
 
  649                for ($i = 1; $i < ($pagecount + 1); $i++) {
 
  651                    $tppl = $pdf->importPage($i);
 
  652                    $s = $pdf->getTemplatesize($tppl);
 
  653                    $pdf->AddPage($s[
'h'] > $s[
'w'] ? 
'P' : 
'L');
 
  654                    $pdf->useTemplate($tppl);
 
  656                    dol_syslog(
"Error when manipulating the PDF " . $sourcefile . 
" by onlineSign: " . $e->getMessage(), LOG_ERR);
 
  657                    $response = $e->getMessage();
 
  667                $dirmodels = array(
'/');
 
  668                if (is_array($conf->modules_parts[
'models'])) {
 
  669                  $dirmodels = array_merge($dirmodels, $conf->modules_parts[
'models']);
 
  671                foreach ($dirmodels as $reldir) {
 
  672                  $file = 
"pdf_" . $last_modelpdf . 
".modules.php";
 
  675                  if (file_exists($file)) {
 
  677                    $classname = 
'pdf_' . $last_modelpdf;
 
  682                if ($filefound === 
'') {
 
  683                  $response = $langs->trans(
"Error") . 
' Failed to load doc generator with modelpaths=' . $modelpath . 
' - modele=' . $last_modelpdf;
 
  688                if (!$error && $classname !== 
'') {
 
  692                  $objPDF = 
new $classname($db);
 
  694                  $pdf->SetFont($default_font, 
'', $default_font_size - 1);
 
  696                  $xForDate = $objPDF->marge_gauche;
 
  697                  $yForDate = $objPDF->page_hauteur - $objPDF->heightforinfotot - $objPDF->heightforfreetext - $objPDF->heightforfooter + 10;
 
  698                  $pdf->SetXY($xForDate, $yForDate);
 
  701                  $xforimgstart = $objPDF->xPosSignArea;
 
  702                  $yforimgstart = $yForDate - 5;
 
  703                  $wforimg = $s[
'w'] - 20 - $xforimgstart;
 
  706                  $param[
'online_sign_name'] = $online_sign_name;
 
  707                  $param[
'pathtoimage'] = $upload_dir . $filename;
 
  712                  $param[
'xforimgstart'] = $xforimgstart;
 
  713                  $param[
'yforimgstart'] = $yforimgstart;
 
  714                  $param[
'wforimg'] = $wforimg;
 
  719                $pdf->Output($newpdffilename, 
"F");
 
  722                $object->indexFile($newpdffilename, 1);
 
  725          } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
 
  735        $response = 
"cannot find BAN/RIB";
 
  743        $sql = 
"UPDATE " . MAIN_DB_PREFIX . 
$object->table_element;
 
  745        $sql .= 
" date_signature = '" . $db->idate(
dol_now()) . 
"',";
 
  746        $sql .= 
" online_sign_ip = '" . $db->escape($online_sign_ip) . 
"'";
 
  747        if ($online_sign_name) {
 
  748          $sql .= 
", online_sign_name = '" . $db->escape($online_sign_name) . 
"'";
 
  752        $sql .= 
" WHERE rowid = " . ((int) 
$object->id);
 
  755        $resql = $db->query($sql);
 
  759          $num = $db->affected_rows($resql);
 
  763          $response = 
"success";
 
  766          $response = 
"error sql";
 
  771          $response = 
"success";
 
  777    } elseif ($mode == 
'expedition') {
 
  778      require_once DOL_DOCUMENT_ROOT . 
'/expedition/class/expedition.class.php';
 
  779      require_once DOL_DOCUMENT_ROOT . 
'/core/lib/pdf.lib.php';
 
  784      $upload_dir = $conf->expedition->dir_output.
"/sending/";
 
  785      $upload_dir .= 
'/'.dol_sanitizeFileName(
$object->ref).
'/';
 
  787      $langs->loadLangs(array(
"main", 
"companies"));
 
  793      $filename = 
"signatures/" . $date . 
"_signature.png";
 
  794      if (!is_dir($upload_dir . 
"signatures/")) {
 
  795        if (!
dol_mkdir($upload_dir . 
"signatures/")) {
 
  796          $response = 
"Error mkdir. Failed to create dir " . $upload_dir . 
"signatures/";
 
  802        $return = file_put_contents($upload_dir . $filename, $data);
 
  803        if ($return == 
false) {
 
  805          $response = 
'Error file_put_content: failed to create signature file.';
 
  810        $last_main_doc_file = 
$object->last_main_doc;
 
  812        if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
 
  815          $defaulttemplate = 
'';    
 
  816          $object->generateDocument($defaulttemplate, $langs);
 
  818        $last_main_doc_file = 
$object->last_main_doc;
 
  819        $directdownloadlink = 
$object->getLastMainDocLink(
'expedition');    
 
  821        if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
 
  823          $newpdffilename = $upload_dir . $ref . 
"_signed-" . $date . 
".pdf";
 
  824          $sourcefile = $upload_dir . $ref . 
".pdf";
 
  827            $parameters = array(
'sourcefile' => $sourcefile, 
'newpdffilename' => $newpdffilename);
 
  828            $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters, 
$object, $action); 
 
  833            if (empty($reshook)) {
 
  836              if (class_exists(
'TCPDF')) {
 
  837                $pdf->setPrintHeader(
false);
 
  838                $pdf->setPrintFooter(
false);
 
  843                $pdf->SetCompression(
false);
 
  847              $pagecount = $pdf->setSourceFile($sourcefile);        
 
  850              $param[
'online_sign_name'] = $online_sign_name;
 
  851              $param[
'pathtoimage'] = $upload_dir . $filename;
 
  854              for ($i = 1; $i < ($pagecount + 1); $i++) {
 
  856                  $tppl = $pdf->importPage($i);
 
  857                  $s = $pdf->getTemplatesize($tppl);
 
  858                  $pdf->AddPage($s[
'h'] > $s[
'w'] ? 
'P' : 
'L');
 
  859                  $pdf->useTemplate($tppl);
 
  865                    $param[
'xforimgstart'] = 111;
 
  866                    $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 60);
 
  867                    $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
 
  872                  dol_syslog(
"Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
 
  873                  $response = $e->getMessage();
 
  882                $param[
'xforimgstart'] = 111;
 
  883                $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 60);
 
  884                $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
 
  890              $pdf->Output($newpdffilename, 
"F");
 
  893              $object->indexFile($newpdffilename, 1);
 
  897            $response = 
"success";
 
  899        } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
 
  911        $sql = 
"UPDATE " . MAIN_DB_PREFIX . 
"expedition";
 
  912        $sql .= 
" SET signed_status = " . ((int) $object::STATUS_SIGNED) ;
 
  913        $sql .= 
" WHERE rowid = " . ((int) 
$object->id);
 
  916        $resql = $db->query($sql);
 
  920          $num = $db->affected_rows($resql);
 
  925          $response = 
"success";
 
  934    $response = 
'error signature_not_found';
 
  939  http_response_code(501);
 
  957  $xforimgstart = $params[
'xforimgstart'];
 
  958  $yforimgstart = $params[
'yforimgstart'];
 
  959  $wforimg = $params[
'wforimg'];
 
  961  $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4);
 
  962  $pdf->SetFont($default_font, 
'', $default_font_size - 1);
 
  963  $pdf->SetTextColor(80, 80, 80);
 
  964  $pdf->MultiCell($wforimg, 4, $langs->trans(
"Signature") . 
': ' . 
dol_print_date(
dol_now(), 
"day", 
false, $langs, 
true). 
' - '.$params[
'online_sign_name'], 0, 
'L');
 
  968  $pdf->Image($params[
'pathtoimage'], $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4));
 
 
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
 
Class to manage bank accounts description of third parties.
 
Class to manage contracts.
 
Class to manage shipments.
 
Class to manage interventions.
 
Class to manage proposals.
 
Class to manage Dolibarr users.
 
dol_is_writable($folderorfile)
Test if directory or filename is writable.
 
dol_is_file($pathoffile)
Return if path is a file.
 
dol_is_dir($folder)
Test if filename is a directory.
 
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.
 
dol_now($mode='auto')
Return date for now.
 
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
 
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
 
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
getUserRemoteIP()
Return the IP of remote user.
 
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
 
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
 
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
 
dolPrintSignatureImage(TCPDF $pdf, $langs, $params)
Output the signature file into the PDF object.
 
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
 
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
 
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
 
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
 
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...