25if (!defined(
'NOTOKENRENEWAL')) {
26 define(
'NOTOKENRENEWAL',
'1');
28if (!defined(
'NOREQUIREHTML')) {
29 define(
'NOREQUIREHTML',
'1');
31if (!defined(
'NOREQUIREAJAX')) {
32 define(
'NOREQUIREAJAX',
'1');
39if (!defined(
'NOREQUIREMENU')) {
40 define(
'NOREQUIREMENU',
'1');
43if (!defined(
"NOLOGIN")) {
44 define(
"NOLOGIN",
'1');
46if (!defined(
'NOIPCHECK')) {
47 define(
'NOIPCHECK',
'1');
49if (!defined(
'NOBROWSERNOTIF')) {
50 define(
'NOBROWSERNOTIF',
'1');
52$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
53if (is_numeric($entity)) {
54 define(
"DOLENTITY", $entity);
56include
'../../main.inc.php';
57require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
66$action =
GETPOST(
'action',
'aZ09');
68$signature =
GETPOST(
'signaturebase64');
75$SECUREKEY =
GETPOST(
"securekey");
76$online_sign_name =
GETPOST(
"onlinesignname");
85if ($type ==
'proposal') {
87} elseif ($type ==
'contract') {
89} elseif ($type ==
'fichinter') {
92 $securekeyseed =
getDolGlobalString(strtoupper($type).
'_ONLINE_SIGNATURE_SECURITY_TOKEN');
95if (empty($SECUREKEY) || !
dol_verifyHash($securekeyseed . $type . $ref . (!
isModEnabled(
'multicompany') ?
'' : $entity), $SECUREKEY,
'0')) {
100$hookmanager->initHooks(array(
'ajaxonlinesign'));
116if ($action ==
"importSignature") {
117 $issignatureok = (!empty($signature) && $signature[0] ==
"image/png;base64");
118 if ($issignatureok) {
119 $signature = $signature[1];
120 $data = base64_decode($signature);
122 if ($mode ==
"propale" || $mode ==
'proposal') {
123 require_once DOL_DOCUMENT_ROOT .
'/comm/propal/class/propal.class.php';
124 require_once DOL_DOCUMENT_ROOT .
'/core/lib/pdf.lib.php';
128 $upload_dir = !empty($conf->propal->multidir_output[
$object->entity ?? $conf->entity]) ? $conf->propal->multidir_output[
$object->entity ?? $conf->entity] : $conf->propal->dir_output;
133 $langs->loadLangs(array(
"main",
"companies"));
136 $filename =
"signatures/" . $date .
"_signature.png";
137 if (!is_dir($upload_dir .
"signatures/")) {
138 if (!
dol_mkdir($upload_dir .
"signatures/")) {
139 $response =
"Error mkdir. Failed to create dir " . $upload_dir .
"signatures/";
145 $return = file_put_contents($upload_dir.$filename, $data);
146 if ($return ===
false) {
148 $response =
'Error file_put_content: failed to create signature file.';
156 $last_main_doc_file =
$object->last_main_doc;
157 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
159 if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
160 $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME);
161 $ref_pdf = preg_replace(
'/_signed-(\d+)/',
'', $ref_pdf);
163 $newpdffilename = $upload_dir . $ref_pdf .
"_signed-" . $date .
".pdf";
164 $sourcefile = $upload_dir . $ref_pdf .
".pdf";
167 $parameters = array(
'sourcefile' => $sourcefile,
'newpdffilename' => $newpdffilename);
168 $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters,
$object, $action);
173 if (empty($reshook)) {
176 if (class_exists(
'TCPDF')) {
177 $pdf->setPrintHeader(
false);
178 $pdf->setPrintFooter(
false);
183 $pdf->SetCompression(
false);
187 $pagecount = $pdf->setSourceFile($sourcefile);
190 $param[
'online_sign_name'] = $online_sign_name;
191 $param[
'pathtoimage'] = $upload_dir . $filename;
193 $propalsignonspecificpage =
getDolGlobalInt(
"PROPAL_SIGNATURE_ON_SPECIFIC_PAGE");
196 for ($i = 1; $i < ($pagecount + 1); $i++) {
198 $tppl = $pdf->importPage($i);
199 $s = $pdf->getTemplatesize($tppl);
200 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
201 $pdf->useTemplate($tppl);
202 if ($propalsignonspecificpage < 0) {
203 $propalsignonspecificpage = $pagecount - abs($propalsignonspecificpage);
206 if (empty($propalsignonspecificpage)) {
211 if (preg_match(
'/PAGESIGN=(\d+)/', $keywords, $reg)) {
212 $propalsignonspecificpage = (int) $reg[1];
216 if (
getDolGlobalString(
"PROPAL_SIGNATURE_ON_ALL_PAGES") || $propalsignonspecificpage == $i) {
223 $param[
'xforimgstart'] = (empty($s[
'w']) ? 120 : round($s[
'w'] / 2) + 15);
228 $param[
'yforimgstart'] = (empty($s[
'h']) ? 240 : $s[
'h'] - 60);
233 $param[
'wforimg'] = $s[
'w'] - 20 - $param[
'xforimgstart'];
239 dol_syslog(
"Error when manipulating the PDF " . $sourcefile .
" by onlineSign: " . $e->getMessage(), LOG_ERR);
240 $response = $e->getMessage();
245 if (!
getDolGlobalString(
"PROPAL_SIGNATURE_ON_ALL_PAGES") && !$propalsignonspecificpage) {
251 $param[
'xforimgstart'] = (empty($s[
'w']) ? 120 : round($s[
'w'] / 2) + 15);
256 $param[
'yforimgstart'] = (empty($s[
'h']) ? 240 : $s[
'h'] - 60);
261 $param[
'wforimg'] = $s[
'w'] - 20 - $param[
'xforimgstart'];
268 $pdf->Output($newpdffilename,
"F");
271 $object->indexFile($newpdffilename, 1);
274 } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
288 $sql =
"UPDATE " . MAIN_DB_PREFIX .
"propal";
289 $sql .=
" SET fk_statut = " . ((int) $object::STATUS_SIGNED) .
", note_private = '" . $db->escape(
$object->note_private) .
"',";
290 $sql .=
" date_signature = '" . $db->idate(
dol_now()) .
"',";
291 $sql .=
" online_sign_ip = '" . $db->escape($online_sign_ip) .
"'";
292 if ($online_sign_name) {
293 $sql .=
", online_sign_name = '" . $db->escape($online_sign_name) .
"'";
295 $sql .=
" WHERE rowid = " . ((int)
$object->id);
298 $resql = $db->query($sql);
302 $num = $db->affected_rows($resql);
306 if (method_exists(
$object,
'call_trigger')) {
308 $user =
new User($db);
309 $user->fetch(
$object->user_validation_id);
310 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
311 $result =
$object->call_trigger(
'PROPAL_CLOSE_SIGNED', $user);
314 $response =
"error in trigger " .
$object->error;
318 $result = $soc->setAsCustomer();
321 $response = $db->lasterror();
323 $response =
"success";
327 $response =
"success";
331 $response =
"error sql";
336 $response =
"success";
342 } elseif ($mode ==
'contract') {
343 require_once DOL_DOCUMENT_ROOT .
'/contrat/class/contrat.class.php';
344 require_once DOL_DOCUMENT_ROOT .
'/core/lib/pdf.lib.php';
348 $upload_dir = !empty($conf->contrat->multidir_output[
$object->entity ?? $conf->entity]) ? $conf->contrat->multidir_output[
$object->entity ?? $conf->entity] : $conf->contrat->dir_output;
352 $filename =
"signatures/" . $date .
"_signature.png";
353 if (!is_dir($upload_dir .
"signatures/")) {
354 if (!
dol_mkdir($upload_dir .
"signatures/")) {
355 $response =
"Error mkdir. Failed to create dir " . $upload_dir .
"signatures/";
361 $return = file_put_contents($upload_dir . $filename, $data);
362 if ($return ===
false) {
364 $response =
'Error file_put_content: failed to create signature file.';
372 $last_main_doc_file =
$object->last_main_doc;
373 $directdownloadlink =
$object->getLastMainDocLink(
'contrat');
375 if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
376 $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME);
378 $newpdffilename = $upload_dir . $ref_pdf .
"_signed-" . $date .
".pdf";
379 $sourcefile = $upload_dir . $ref_pdf .
".pdf";
382 $parameters = array(
'sourcefile' => $sourcefile,
'newpdffilename' => $newpdffilename);
383 $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters,
$object, $action);
388 if (empty($reshook)) {
391 if (class_exists(
'TCPDF')) {
392 $pdf->setPrintHeader(
false);
393 $pdf->setPrintFooter(
false);
398 $pdf->SetCompression(
false);
402 $pagecount = $pdf->setSourceFile($sourcefile);
405 $param[
'online_sign_name'] = $online_sign_name;
406 $param[
'pathtoimage'] = $upload_dir . $filename;
409 for ($i = 1; $i < ($pagecount + 1); $i++) {
411 $tppl = $pdf->importPage($i);
412 $s = $pdf->getTemplatesize($tppl);
413 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
414 $pdf->useTemplate($tppl);
423 $param[
'xforimgstart'] = (empty($s[
'w']) ? 110 : $s[
'w'] / 2 - 0);
428 $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 62);
433 $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
439 dol_syslog(
"Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
440 $response = $e->getMessage();
449 $param[
'xforimgstart'] = (empty($s[
'w']) ? 110 : $s[
'w'] / 2 - 0);
450 $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 62);
451 $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
457 $pdf->Output($newpdffilename,
"F");
460 $object->indexFile($newpdffilename, 1);
464 $response =
"success";
466 } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
473 $user =
new User($db);
474 $object->setSignedStatus($user, Contrat::$SIGNED_STATUSES[
'STATUS_SIGNED_RECEIVER_ONLINE'], 0,
'CONTRACT_MODIFY');
476 } elseif ($mode ==
'fichinter') {
477 require_once DOL_DOCUMENT_ROOT .
'/fichinter/class/fichinter.class.php';
478 require_once DOL_DOCUMENT_ROOT .
'/core/lib/pdf.lib.php';
482 $upload_dir = !empty($conf->ficheinter->multidir_output[
$object->entity ?? $conf->entity]) ? $conf->ficheinter->multidir_output[
$object->entity ?? $conf->entity] : $conf->ficheinter->dir_output;
483 $upload_dir .=
'/'.dol_sanitizeFileName(
$object->ref).
'/';
485 $langs->loadLangs(array(
"main",
"companies"));
491 $filename =
"signatures/" . $date .
"_signature.png";
492 if (!is_dir($upload_dir .
"signatures/")) {
493 if (!
dol_mkdir($upload_dir .
"signatures/")) {
494 $response =
"Error mkdir. Failed to create dir " . $upload_dir .
"signatures/";
500 $return = file_put_contents($upload_dir . $filename, $data);
501 if ($return ===
false) {
503 $response =
'Error file_put_content: failed to create signature file.';
511 $last_main_doc_file =
$object->last_main_doc;
512 $directdownloadlink =
$object->getLastMainDocLink(
'fichinter');
514 if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
515 $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME);
517 $newpdffilename = $upload_dir . $ref_pdf .
"_signed-" . $date .
".pdf";
518 $sourcefile = $upload_dir . $ref_pdf .
".pdf";
521 $parameters = array(
'sourcefile' => $sourcefile,
'newpdffilename' => $newpdffilename);
522 $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters,
$object, $action);
527 if (empty($reshook)) {
530 if (class_exists(
'TCPDF')) {
531 $pdf->setPrintHeader(
false);
532 $pdf->setPrintFooter(
false);
537 $pdf->SetCompression(
false);
541 $pagecount = $pdf->setSourceFile($sourcefile);
544 $param[
'online_sign_name'] = $online_sign_name;
545 $param[
'pathtoimage'] = $upload_dir . $filename;
548 for ($i = 1; $i < ($pagecount + 1); $i++) {
550 $tppl = $pdf->importPage($i);
551 $s = $pdf->getTemplatesize($tppl);
552 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
553 $pdf->useTemplate($tppl);
562 $param[
'xforimgstart'] = (empty($s[
'w']) ? 110 : $s[
'w'] / 2 - 2);
567 $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 38);
572 $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 20);
578 dol_syslog(
"Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
579 $response = $e->getMessage();
588 $param[
'xforimgstart'] = (empty($s[
'w']) ? 110 : $s[
'w'] / 2 - 2);
589 $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 38);
590 $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 20);
596 $pdf->Output($newpdffilename,
"F");
599 $object->indexFile($newpdffilename, 1);
603 $response =
"success";
605 } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
612 $user =
new User($db);
613 $object->setSignedStatus($user, Fichinter::$SIGNED_STATUSES[
'STATUS_SIGNED_RECEIVER_ONLINE'], 0,
'FICHINTER_MODIFY');
615 } elseif ($mode ==
"societe_rib") {
616 $langs->load(
'withdrawals');
617 require_once DOL_DOCUMENT_ROOT .
'/societe/class/companybankaccount.class.php';
618 require_once DOL_DOCUMENT_ROOT .
'/core/lib/pdf.lib.php';
619 $modelpath =
"core/modules/bank/doc/";
629 $langs->loadLangs(array(
"main",
"companies"));
632 $filename =
"signatures/" . $date .
"_signature.png";
633 if (!
dol_is_dir($upload_dir .
"signatures/")) {
634 if (!
dol_mkdir($upload_dir .
"signatures/")) {
635 $response =
"Error mkdir. Failed to create dir " . $upload_dir .
"signatures/";
640 $response =
"Error directory " . $upload_dir .
"signatures/ is not writable";
644 $response =
"Error directory " . DOL_DATA_ROOT.
"/admin/temp/ is not writable";
649 $return = file_put_contents($upload_dir . $filename, $data);
650 if ($return ===
false) {
652 $response =
'Error file_put_content: failed to create signature file.';
660 $last_main_doc_file =
$object->last_main_doc;
661 $last_modelpdf =
$object->model_pdf;
662 $directdownloadlink =
$object->getLastMainDocLink(
'company');
664 if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
666 $newpdffilename =
'';
667 if ($last_modelpdf ==
'sepamandate') {
675 $sourcefile = DOL_DATA_ROOT .
'/' . $last_main_doc_file;
676 $newpdffilename = preg_replace(
'/\.pdf$/i',
'_signed-' . $date .
'.pdf', $sourcefile);
679 $parameters = array(
'sourcefile' => $sourcefile,
'newpdffilename' => $newpdffilename);
680 $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters,
$object, $action);
685 if (empty($reshook)) {
688 if (class_exists(
'TCPDF')) {
689 $pdf->setPrintHeader(
false);
690 $pdf->setPrintFooter(
false);
695 $pdf->SetCompression(
false);
699 $pagecount = $pdf->setSourceFile($sourcefile);
702 for ($i = 1; $i < ($pagecount + 1); $i++) {
704 $tppl = $pdf->importPage($i);
705 $s = $pdf->getTemplatesize($tppl);
706 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
707 $pdf->useTemplate($tppl);
709 dol_syslog(
"Error when manipulating the PDF " . $sourcefile .
" by onlineSign: " . $e->getMessage(), LOG_ERR);
710 $response = $e->getMessage();
720 $dirmodels = array(
'/');
721 if (is_array($conf->modules_parts[
'models'])) {
722 $dirmodels = array_merge($dirmodels, $conf->modules_parts[
'models']);
724 foreach ($dirmodels as $reldir) {
725 $file =
"pdf_" . $last_modelpdf .
".modules.php";
728 if (file_exists($file)) {
730 $classname =
'pdf_' . $last_modelpdf;
735 if ($filefound ===
'') {
736 $response = $langs->trans(
"Error") .
' Failed to load doc generator with modelpaths=' . $modelpath .
' - modele=' . $last_modelpdf;
741 if (!$error && $classname !==
'') {
745 $objPDF =
new $classname($db);
747 $pdf->SetFont($default_font,
'', $default_font_size - 1);
749 $xForDate = $objPDF->marge_gauche;
750 $yForDate = $objPDF->page_hauteur - $objPDF->heightforinfotot - $objPDF->heightforfreetext - $objPDF->heightforfooter + 10;
751 $pdf->SetXY($xForDate, $yForDate);
754 $xforimgstart = $objPDF->xPosSignArea;
755 $yforimgstart = $yForDate - 5;
756 $wforimg = $s[
'w'] - 20 - $xforimgstart;
759 $param[
'online_sign_name'] = $online_sign_name;
760 $param[
'pathtoimage'] = $upload_dir . $filename;
765 $param[
'xforimgstart'] = $xforimgstart;
766 $param[
'yforimgstart'] = $yforimgstart;
767 $param[
'wforimg'] = $wforimg;
772 $pdf->Output($newpdffilename,
"F");
775 $object->indexFile($newpdffilename, 1);
778 } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
788 $response =
"cannot find BAN/RIB";
796 $sql =
"UPDATE " . MAIN_DB_PREFIX .
$object->table_element;
798 $sql .=
" date_signature = '" . $db->idate(
dol_now()) .
"',";
799 $sql .=
" online_sign_ip = '" . $db->escape($online_sign_ip) .
"'";
800 if ($online_sign_name) {
801 $sql .=
", online_sign_name = '" . $db->escape($online_sign_name) .
"'";
805 $sql .=
" WHERE rowid = " . ((int)
$object->id);
808 $resql = $db->query($sql);
812 $num = $db->affected_rows($resql);
816 $response =
"success";
819 $response =
"error sql";
824 $response =
"success";
830 } elseif ($mode ==
'expedition') {
831 require_once DOL_DOCUMENT_ROOT .
'/expedition/class/expedition.class.php';
832 require_once DOL_DOCUMENT_ROOT .
'/core/lib/pdf.lib.php';
837 $upload_dir = $conf->expedition->dir_output.
"/sending/";
838 $upload_dir .=
'/'.dol_sanitizeFileName(
$object->ref).
'/';
840 $langs->loadLangs(array(
"main",
"companies"));
846 $filename =
"signatures/" . $date .
"_signature.png";
847 if (!is_dir($upload_dir .
"signatures/")) {
848 if (!
dol_mkdir($upload_dir .
"signatures/")) {
849 $response =
"Error mkdir. Failed to create dir " . $upload_dir .
"signatures/";
855 $return = file_put_contents($upload_dir . $filename, $data);
856 if ($return ===
false) {
858 $response =
'Error file_put_content: failed to create signature file.';
865 $last_main_doc_file =
$object->last_main_doc;
867 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
870 $defaulttemplate =
'';
871 $object->generateDocument($defaulttemplate, $langs);
873 $last_main_doc_file =
$object->last_main_doc;
874 $directdownloadlink =
$object->getLastMainDocLink(
'expedition');
876 if (preg_match(
'/\.pdf/i', $last_main_doc_file)) {
877 $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME);
879 $newpdffilename = $upload_dir . $ref_pdf .
"_signed-" . $date .
".pdf";
880 $sourcefile = $upload_dir . $ref_pdf .
".pdf";
883 $parameters = array(
'sourcefile' => $sourcefile,
'newpdffilename' => $newpdffilename);
884 $reshook = $hookmanager->executeHooks(
'AddSignature', $parameters,
$object, $action);
889 if (empty($reshook)) {
892 if (class_exists(
'TCPDF')) {
893 $pdf->setPrintHeader(
false);
894 $pdf->setPrintFooter(
false);
899 $pdf->SetCompression(
false);
903 $pagecount = $pdf->setSourceFile($sourcefile);
906 $param[
'online_sign_name'] = $online_sign_name;
907 $param[
'pathtoimage'] = $upload_dir . $filename;
910 for ($i = 1; $i < ($pagecount + 1); $i++) {
912 $tppl = $pdf->importPage($i);
913 $s = $pdf->getTemplatesize($tppl);
914 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
915 $pdf->useTemplate($tppl);
921 $param[
'xforimgstart'] = 111;
922 $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 60);
923 $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
928 dol_syslog(
"Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR);
929 $response = $e->getMessage();
938 $param[
'xforimgstart'] = 111;
939 $param[
'yforimgstart'] = (empty($s[
'h']) ? 250 : $s[
'h'] - 60);
940 $param[
'wforimg'] = $s[
'w'] - ($param[
'xforimgstart'] + 16);
946 $pdf->Output($newpdffilename,
"F");
949 $object->indexFile($newpdffilename, 1);
953 $response =
"success";
955 } elseif (preg_match(
'/\.odt/i', $last_main_doc_file)) {
963 $user =
new User($db);
964 $object->setSignedStatus($user, Expedition::$SIGNED_STATUSES[
'STATUS_SIGNED_RECEIVER_ONLINE'], 0,
'SHIPPING_MODIFY');
968 $response =
'error signature_not_found';
973 http_response_code(501);
991 $xforimgstart = $params[
'xforimgstart'];
992 $yforimgstart = $params[
'yforimgstart'];
993 $wforimg = $params[
'wforimg'];
995 $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4);
996 $pdf->SetFont($default_font,
'', $default_font_size - 1);
997 $pdf->SetTextColor(80, 80, 80);
998 $pdf->MultiCell($wforimg, 4, $langs->transnoentities(
"Signature") .
': ' .
dol_print_date(
dol_now(),
"day",
false, $langs,
true).
' - '.$params[
'online_sign_name'], 0,
'L');
1002 $pdf->Image($params[
'pathtoimage'], $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4));
if(! $sortfield) if(! $sortorder) $object
Class to manage bank accounts description of third parties.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
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_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.
pdfExtractMetadata($file, $field='Keywords')
Function to extract metadata from a PDF file by doing a binary parsing of the PDF file.
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,...