dolibarr 25.0.0-alpha
newonlinesign.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2023 anthony Berton <anthony.berton@bb2a.fr>
6 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
8 * Copyright (C) 2026 Lenin Rivas <lenin.rivas777@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
33if (!defined('NOLOGIN')) {
34 define("NOLOGIN", 1); // This means this output page does not require to be logged.
35}
36if (!defined('NOCSRFCHECK')) {
37 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
38}
39if (!defined('NOIPCHECK')) {
40 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
41}
42if (!defined('NOBROWSERNOTIF')) {
43 define('NOBROWSERNOTIF', '1');
44}
45
46// For MultiCompany module.
47// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
48// Because 2 entities can have the same ref.
49$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
50if (is_numeric($entity)) {
51 define("DOLENTITY", $entity);
52}
53
54// Load Dolibarr environment
55require '../../main.inc.php';
66require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
67require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
68require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
69require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
70require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
71require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
72
73// Load translation files
74$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "members", "stripe", "propal", "commercial"));
75
76// Security check
77// No check on module enabled. Done later according to $validpaymentmethod
78
79// Get parameters
80$action = GETPOST('action', 'aZ09');
81$cancel = GETPOST('cancel', 'alpha');
82$confirm = GETPOST('confirm', 'alpha');
83
84
85$refusepropal = GETPOST('refusepropal', 'alpha');
86$message = GETPOST('message', 'aZ09');
87
88// Input are:
89// type ('invoice','order','contractline'),
90// id (object id),
91// amount (required if id is empty),
92// tag (a free text, required if type is empty)
93// currency (iso code)
94
95$suffix = GETPOST("suffix", 'aZ09');
96$source = (string) GETPOST("source", 'alpha');
97$ref = $REF = GETPOST("ref", 'alpha');
98$urlok = '';
99$urlko = '';
100
101if ($source == '') {
102 $source = 'proposal';
103}
104if (!empty($refusepropal)) {
105 $action = "refusepropal";
106}
107
108// Define $urlwithroot
109//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
110//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
111$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
112
113
114// Complete urls for post treatment
115$SECUREKEY = GETPOST("securekey"); // Secure key
116
117if (!empty($source)) {
118 $urlok .= 'source='.urlencode($source).'&';
119 $urlko .= 'source='.urlencode($source).'&';
120}
121if (!empty($REF)) {
122 $urlok .= 'ref='.urlencode($REF).'&';
123 $urlko .= 'ref='.urlencode($REF).'&';
124}
125if (!empty($SECUREKEY)) {
126 $urlok .= 'securekey='.urlencode($SECUREKEY).'&';
127 $urlko .= 'securekey='.urlencode($SECUREKEY).'&';
128}
129if (!empty($entity)) {
130 $urlok .= 'entity='.urlencode((string) ($entity)).'&';
131 $urlko .= 'entity='.urlencode((string) ($entity)).'&';
132}
133$urlok = preg_replace('/&$/', '', $urlok); // Remove last &
134$urlko = preg_replace('/&$/', '', $urlko); // Remove last &
135
136$creditor = $mysoc->name;
137
138$type = $source;
139if (!$action) {
140 if ($source && !$ref) {
141 $langs->load('errors');
142 httponly_accessforbidden($langs->trans('ErrorBadParameters')." - ref missing", 400, 1);
143 }
144}
145
146global $dolibarr_main_instance_unique_id;
147$defaultsalt = substr(dol_hash('dolibarr'.$dolibarr_main_instance_unique_id, 'sha256'), 0, 32); // Fallback if no specific salt was set
148
149// Check securitykey
150$securekeyseed = '';
151if ($source == 'proposal') {
152 $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
153} elseif ($source == 'contract') {
154 $securekeyseed = getDolGlobalString('CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
155} elseif ($source == 'fichinter') {
156 $securekeyseed = getDolGlobalString('FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
157} elseif ($source == 'societe_rib') {
158 $securekeyseed = getDolGlobalString('SOCIETE_RIB_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
159} elseif ($source == 'order') {
160 $securekeyseed = getDolGlobalString('ORDER_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
161} else {
162 $securekeyseed = getDolGlobalString(dol_strtoupper((string) $source).'_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
163}
164if (!dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? $entity : ''), $SECUREKEY, 'hash')) {
165 httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403, 1);
166}
167
168if ($source == 'proposal') {
169 require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
170 $object = new Propal($db);
171 $result = $object->fetch(0, $ref, '', $entity);
172} elseif ($source == 'contract') {
173 require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
174 $object = new Contrat($db);
175 $result = $object->fetch(0, $ref);
176} elseif ($source == 'fichinter') {
177 require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
178 $object = new Fichinter($db);
179 $result = $object->fetch(0, $ref);
180} elseif ($source == 'societe_rib') {
181 require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
182 $object = new CompanyBankAccount($db);
183 $result = $object->fetch(0, $ref);
184} elseif ($source == 'order') {
185 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
186 $object = new Commande($db);
187 $result = $object->fetch(0, $ref);
188} elseif ($source == 'expedition') {
189 require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
190 $object = new Expedition($db);
191 $result = $object->fetch(0, $ref);
192} else {
193 $langs->load('errors');
194 httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source. Value not supported.", 400, 1);
195}
196
197// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
198$hookmanager->initHooks(array('onlinesign'));
199
200$error = 0;
201
202
203/*
204 * Actions
205 */
206
207if ($action == 'confirm_refusepropal' && $confirm == 'yes') { // Test on permission not required here. Public form. Security checked on the securekey and on mitigation
208 $db->begin();
209
210 $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
211 $sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$db->escape((string) $object->note_private)."', date_signature = '".$db->idate(dol_now())."'";
212 $sql .= " WHERE rowid = ".((int) $object->id);
213
214 dol_syslog(__FILE__, LOG_DEBUG);
215 $resql = $db->query($sql);
216 if (!$resql) {
217 $error++;
218 }
219
220 if (!$error) {
221 $db->commit();
222
223 $message = 'refused';
224 setEventMessages("PropalRefused", null, 'warnings');
225 $object->context = array('closedfromonlinesignature' => 'closedfromonlinesignature');
226 $result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user);
227 if ($result < 0) {
228 $error++;
229 }
230 } else {
231 $db->rollback();
232 }
233
234 $object->fetch(0, $ref);
235}
236
237// $action == "dosign" is handled later...
238
239
240/*
241 * View
242 */
243
244$form = new Form($db);
245
246$head = '';
247if (getDolGlobalString('MAIN_SIGN_CSS_URL')) {
248 $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_SIGN_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
249}
250
251$conf->dol_hide_topmenu = 1;
252$conf->dol_hide_leftmenu = 1;
253
254$title = $langs->trans("OnlineSignature");
255
256$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
257llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1);
258
259htmlPrintOnlineHeader($mysoc, $langs, 1, '', 'ONLINE_SIGN_IMAGE_PUBLIC_INTERFACE', 'ONLINE_SIGN_LOGO_'.$suffix, 'ONLINE_SIGN_LOGO');
260
261if ($action == 'refusepropal') {
262 print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.$entity : ''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
263}
264
265// Check link validity for param 'source' to avoid use of the examples as value
266if (/* $source !== '' :never empty && */ in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'proposal_ref', ''))) {
267 $langs->load("errors");
268 dol_print_error_email('BADREFINONLINESIGNFORM', $langs->trans("ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
269 // End of page
270 llxFooter();
271 $db->close();
272 exit;
273}
274
275print '<span id="dolpaymentspan"></span>'."\n";
276print '<div class="center">'."\n";
277print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
278print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
279print '<input type="hidden" name="action" value="dosign">'."\n";
280print '<input type="hidden" name="tag" value="'.GETPOST("tag", 'alpha').'">'."\n";
281print '<input type="hidden" name="suffix" value="'.GETPOST("suffix", 'alpha').'">'."\n";
282print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
283print '<input type="hidden" name="entity" value="'.$entity.'" />';
284print '<input type="hidden" name="page_y" value="" />';
285print '<input type="hidden" name="source" value="'.$source.'" />';
286print '<input type="hidden" name="ref" value="'.$ref.'" />';
287print "\n";
288print '<!-- Form to sign -->'."\n";
289
290if ($source == 'proposal' && getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN')) {
291 print '<div class="backimagepublicproposalsign">';
292 print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN').'">';
293 print '</div>';
294}
295
296print '<table id="dolpublictable" summary="Payment form" class="center">'."\n";
297
298// Output introduction text
299$text = '';
300if (getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT')) {
301 $reg = array();
302 if (preg_match('/^\‍((.*)\‍)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
303 $text .= $langs->trans($reg[1])."<br>\n";
304 } else {
305 $text .= getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT') . "<br>\n";
306 }
307 $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
308}
309if (empty($text)) {
310 if ($source == 'proposal') {
311 $text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePageProposal", $mysoc->name).'</strong></td></tr>'."\n";
312 $text .= '<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFromProposal", $creditor).'<br><br></td></tr>'."\n";
313 } elseif ($source == 'contract') {
314 $text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePageContract", $mysoc->name).'</strong></td></tr>'."\n";
315 $text .= '<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFromContract", $creditor).'<br><br></td></tr>'."\n";
316 } elseif ($source == 'fichinter') {
317 $text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePageFichinter", $mysoc->name).'</strong></td></tr>'."\n";
318 $text .= '<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFromFichinter", $creditor).'<br><br></td></tr>'."\n";
319 } elseif ($source == 'expedition') {
320 $text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePageExpedition", $mysoc->name).'</strong></td></tr>'."\n";
321 $text .= '<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFromExpedition", $creditor).'<br><br></td></tr>'."\n";
322 } else {
323 $text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnOnlineSignaturePage".dol_ucfirst($source), $mysoc->name).'</strong></td></tr>'."\n";
324 $text .= '<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans("ThisScreenAllowsYouToSignDocFrom".dol_ucfirst($source), $creditor).'<br><br></td></tr>'."\n";
325 }
326}
327print $text;
328
329// Output payment summary form
330print '<tr><td align="center">';
331print '<table with="100%" id="tablepublicpayment">';
332if ($source == 'proposal') {
333 print '<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignProposal").'<br><br></td></tr>'."\n";
334} elseif ($source == 'contract') {
335 print '<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignContract").'<br><br></td></tr>'."\n";
336} elseif ($source == 'fichinter') {
337 print '<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignFichinter").'<br><br></td></tr>'."\n";
338} elseif ($source == 'expedition') {
339 print '<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSignExpedition").'<br><br></td></tr>'."\n";
340} else {
341 print '<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans("ThisIsInformationOnDocumentToSign".dol_ucfirst($source)).'<br><br></td></tr>'."\n";
342}
343$found = false;
344$error = 0;
345
346// Signature on commercial proposal
347if ($source == 'proposal') {
348 $found = true;
349 $langs->load("proposal");
350
351 $result = $object->fetch_thirdparty($object->socid);
352
353 // Creditor
354 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Creditor");
355 print '</td><td class="CTableRow2">';
356 print img_picto('', 'company', 'class="pictofixedwidth"');
357 print '<b>'.$creditor.'</b>';
358 print '<input type="hidden" name="creditor" value="'.$creditor.'">';
359 print '</td></tr>'."\n";
360
361 // Debitor
362 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
363 print '</td><td class="CTableRow2">';
364 print img_picto('', 'company', 'class="pictofixedwidth"');
365 print '<b>'.$object->thirdparty->name.'</b>';
366 print '</td></tr>'."\n";
367
368 // Amount
369
370 $amount = '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
371 $amount .= '</td><td class="CTableRow2">';
372 $amount .= '<b>'.price($object->total_ttc, 0, $langs, 1, -1, -1, getDolCurrency()).'</b>';
373 if ($object->multicurrency_code != getDolCurrency()) {
374 $amount .= ' ('.price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code).')';
375 }
376 $amount .= '</td></tr>'."\n";
377
378 // Call Hook amountPropalSign
379 $parameters = array('source' => $source);
380 $reshook = $hookmanager->executeHooks('amountPropalSign', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
381 if (empty($reshook)) {
382 $amount .= $hookmanager->resPrint;
383 } elseif ($reshook > 0) {
384 $amount = $hookmanager->resPrint;
385 }
386
387 print $amount;
388
389 // Object
390 $text = '<b>'.$langs->trans("SignatureProposalRef", $object->ref).'</b>';
391 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
392 print '</td><td class="CTableRow2">'.$text;
393
394 $last_main_doc_file = $object->last_main_doc;
395
396 if ($object->status == $object::STATUS_VALIDATED) {
397 $object->last_main_doc = preg_replace('/_signed-(\d+)/', '', $object->last_main_doc); // We want to be sure to not work on the signed version
398
399 if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
400 // It seems document has never been generated, or was generated and then deleted.
401 // So we try to regenerate it with its default template.
402 $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
403 $object->generateDocument($defaulttemplate, $langs);
404 }
405
406 $directdownloadlink = $object->getLastMainDocLink('proposal');
407 if ($directdownloadlink) {
408 print '<br><a href="'.$directdownloadlink.'">';
409 print img_mime($object->last_main_doc, '');
410 print $langs->trans("DownloadDocument").'</a>';
411 }
412 } else {
413 if ($object->status == $object::STATUS_NOTSIGNED) {
414 $directdownloadlink = $object->getLastMainDocLink('proposal');
415 if ($directdownloadlink) {
416 print '<br><a href="'.$directdownloadlink.'">';
417 print img_mime($last_main_doc_file, '');
418 print $langs->trans("DownloadDocument").'</a>';
419 }
420 } elseif ($object->status == $object::STATUS_SIGNED || $object->status == $object::STATUS_BILLED) {
421 if (preg_match('/_signed-(\d+)/', $last_main_doc_file)) { // If the last main doc has been signed
422 $last_main_doc_file_not_signed = preg_replace('/_signed-(\d+)/', '', $last_main_doc_file);
423
424 $datefilesigned = dol_filemtime($last_main_doc_file);
425 $datefilenotsigned = dol_filemtime($last_main_doc_file_not_signed);
426
427 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) { // If file signed is more recent
428 $directdownloadlink = $object->getLastMainDocLink('proposal');
429 if ($directdownloadlink) {
430 print '<br><a href="'.$directdownloadlink.'">';
431 print img_mime($object->last_main_doc, '');
432 print $langs->trans("DownloadDocument").'</a>';
433 }
434 }
435 }
436 }
437 }
438
439 print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
440 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
441 print '</td></tr>'."\n";
442} elseif ($source == 'order') {
443 $found = true;
444 $langs->load("orders");
445
446 $result = $object->fetch_thirdparty($object->socid);
447
448 // Creditor
449 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Creditor");
450 print '</td><td class="CTableRow2">';
451 print img_picto('', 'company', 'class="pictofixedwidth"');
452 print '<b>'.$creditor.'</b>';
453 print '<input type="hidden" name="creditor" value="'.$creditor.'">';
454 print '</td></tr>'."\n";
455
456 // Debitor
457 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
458 print '</td><td class="CTableRow2">';
459 print img_picto('', 'company', 'class="pictofixedwidth"');
460 print '<b>'.$object->thirdparty->name.'</b>';
461 print '</td></tr>'."\n";
462
463 // Amount
464 $amount = '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
465 $amount .= '</td><td class="CTableRow2">';
466 $amount .= '<b>'.price($object->total_ttc, 0, $langs, 1, -1, -1, getDolCurrency()).'</b>';
467 if ($object->multicurrency_code != getDolCurrency()) {
468 $amount .= ' ('.price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code).')';
469 }
470 $amount .= '</td></tr>'."\n";
471
472 print $amount;
473
474 // Object
475 $text = '<b>'.$langs->trans("SignatureOrderRef", $object->ref).'</b>';
476 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
477 print '</td><td class="CTableRow2">'.$text;
478
479 $last_main_doc_file = $object->last_main_doc;
480
481 if ($object->status == $object::STATUS_VALIDATED) {
482 $object->last_main_doc = preg_replace('/_signed-(\d+)/', '', $object->last_main_doc); // We want to be sure to not work on the signed version
483
484 if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
485 // It seems document has never been generated, or was generated and then deleted.
486 // So we try to regenerate it with its default template.
487 $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
488 $object->generateDocument($defaulttemplate, $langs);
489 }
490
491 $directdownloadlink = $object->getLastMainDocLink('order');
492 if ($directdownloadlink) {
493 print '<br><a href="'.$directdownloadlink.'">';
494 print img_mime($object->last_main_doc, '');
495 print $langs->trans("DownloadDocument").'</a>';
496 }
497 } else {
498 if ($object->status == $object::STATUS_DRAFT) {
499 $directdownloadlink = $object->getLastMainDocLink('order');
500 if ($directdownloadlink) {
501 print '<br><a href="'.$directdownloadlink.'">';
502 print img_mime($last_main_doc_file, '');
503 print $langs->trans("DownloadDocument").'</a>';
504 }
505 } else {
506 if (preg_match('/_signed-(\d+)/', $last_main_doc_file)) { // If the last main doc has been signed
507 $last_main_doc_file_not_signed = preg_replace('/_signed-(\d+)/', '', $last_main_doc_file);
508
509 $datefilesigned = dol_filemtime($last_main_doc_file);
510 $datefilenotsigned = dol_filemtime($last_main_doc_file_not_signed);
511
512 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) { // If file signed is more recent
513 $directdownloadlink = $object->getLastMainDocLink('order');
514 if ($directdownloadlink) {
515 print '<br><a href="'.$directdownloadlink.'">';
516 print img_mime($object->last_main_doc, '');
517 print $langs->trans("DownloadDocument").'</a>';
518 }
519 }
520 }
521 }
522 }
523
524 print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
525 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
526 print '</td></tr>'."\n";
527} elseif ($source == 'contract') { // Signature on contract
528 $found = true;
529 $langs->load("contract");
530
531 $result = $object->fetch_thirdparty($object->socid);
532
533 // Proposer
534 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer");
535 print '</td><td class="CTableRow2">';
536 print img_picto('', 'company', 'class="pictofixedwidth"');
537 print '<b>'.$creditor.'</b>';
538 print '<input type="hidden" name="creditor" value="'.$creditor.'">';
539 print '</td></tr>'."\n";
540
541 // Target
542 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
543 print '</td><td class="CTableRow2">';
544 print img_picto('', 'company', 'class="pictofixedwidth"');
545 print '<b>'.$object->thirdparty->name.'</b>';
546 print '</td></tr>'."\n";
547
548 // Object
549 $text = '<b>'.$langs->trans("SignatureContractRef", $object->ref).'</b>';
550 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
551 print '</td><td class="CTableRow2">'.$text;
552
553 $last_main_doc_file = $object->last_main_doc;
554
555 if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
556 // It seems document has never been generated, or was generated and then deleted.
557 // So we try to regenerate it with its default template.
558 $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
559 $object->generateDocument($defaulttemplate, $langs);
560 }
561
562 $directdownloadlink = $object->getLastMainDocLink('contract');
563 if ($directdownloadlink) {
564 print '<br><a href="'.$directdownloadlink.'">';
565 print img_mime($object->last_main_doc, '');
566 if ($message == "signed") {
567 print $langs->trans("DownloadSignedDocument").'</a>';
568 } else {
569 print $langs->trans("DownloadDocument").'</a>';
570 }
571 }
572
573
574 print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
575 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
576 print '</td></tr>'."\n";
577} elseif ($source == 'fichinter') {
578 // Signature on fichinter
579 $found = true;
580 $langs->load("interventions");
581
582 $result = $object->fetch_thirdparty($object->socid);
583
584 // Proposer
585 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer");
586 print '</td><td class="CTableRow2">';
587 print img_picto('', 'company', 'class="pictofixedwidth"');
588 print '<b>'.$creditor.'</b>';
589 print '<input type="hidden" name="creditor" value="'.$creditor.'">';
590 print '</td></tr>'."\n";
591
592 // Target
593 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
594 print '</td><td class="CTableRow2">';
595 print img_picto('', 'company', 'class="pictofixedwidth"');
596 print '<b>'.$object->thirdparty->name.'</b>';
597 print '</td></tr>'."\n";
598
599 // Object
600 $text = '<b>'.$langs->trans("SignatureFichinterRef", $object->ref).'</b>';
601 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
602 print '</td><td class="CTableRow2">'.$text;
603
604 $last_main_doc_file = $object->last_main_doc;
605
606 if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
607 // It seems document has never been generated, or was generated and then deleted.
608 // So we try to regenerate it with its default template.
609 $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
610 $object->generateDocument($defaulttemplate, $langs);
611 }
612
613 $directdownloadlink = $object->getLastMainDocLink('fichinter');
614 if ($directdownloadlink) {
615 print '<br><a href="'.$directdownloadlink.'">';
616 print img_mime($object->last_main_doc, '');
617 if ($message == "signed") {
618 print $langs->trans("DownloadSignedDocument").'</a>';
619 } else {
620 print $langs->trans("DownloadDocument").'</a>';
621 }
622 }
623 print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
624 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
625 print '</td></tr>'."\n";
626} elseif ($source == 'societe_rib') {
627 $found = true;
628 $langs->loadLangs(array("companies", "commercial", "withdrawals"));
629
630 $result = $object->fetch_thirdparty();
631
632 // Proposer
633 print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("CreditorName");
634 print '</td><td class="CTableRow2">';
635 print img_picto('', 'company', 'class="pictofixedwidth"');
636 print '<b>' . $creditor . '</b>';
637 print '<input type="hidden" name="creditor" value="' . $creditor . '">';
638 print '</td></tr>' . "\n";
639
640 // Target
641 print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("ThirdParty");
642 print '</td><td class="CTableRow2">';
643 print img_picto('', 'company', 'class="pictofixedwidth"');
644 print '<b>' . $object->thirdparty->name . '</b>';
645 print '</td></tr>' . "\n";
646
647 // Object
648 $text = '<b>' . $langs->trans("Signature" . dol_ucfirst($source) . "Ref", $object->ref) . '</b>';
649 print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Designation");
650 print '</td><td class="CTableRow2">' . $text;
651
652 $last_main_doc_file = $object->last_main_doc;
653 $diroutput = $conf->societe->multidir_output[$object->thirdparty->entity].'/'
654 .dol_sanitizeFileName((string) $object->thirdparty->id).'/';
655 if ((empty($last_main_doc_file) ||
656 !dol_is_file($diroutput
657 .$langs->transnoentitiesnoconv("SepaMandateShort").' '.$object->id."-".dol_sanitizeFileName($object->rum).".pdf"))
658 && $message != "signed") {
659 // It seems document has never been generated, or was generated and then deleted.
660 // So we try to regenerate it with its default template.
661 //$defaulttemplate = 'sepamandate';
662 $defaulttemplate = getDolGlobalString("BANKADDON_PDF");
663
664 $object->setDocModel($user, $defaulttemplate);
665 $moreparams = array(
666 'use_companybankid' => $object->id,
667 'force_dir_output' => $diroutput
668 );
669 $result = $object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
670 $object->last_main_doc = $object->thirdparty->last_main_doc;
671 }
672 $directdownloadlink = $object->getLastMainDocLink('company');
673 if ($directdownloadlink) {
674 print '<br><a href="'.$directdownloadlink.'">';
675 print img_mime($object->last_main_doc, '');
676 if ($message == "signed") {
677 print $langs->trans("DownloadSignedDocument").'</a>';
678 } else {
679 print $langs->trans("DownloadDocument").'</a>';
680 }
681 }
682} elseif ($source == 'expedition') {
683 // Signature on expedition
684 $found = true;
685 $langs->load("interventions");
686
687 $result = $object->fetch_thirdparty($object->socid);
688
689 // Proposer
690 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer");
691 print '</td><td class="CTableRow2">';
692 print img_picto('', 'company', 'class="pictofixedwidth"');
693 print '<b>'.$creditor.'</b>';
694 print '<input type="hidden" name="creditor" value="'.$creditor.'">';
695 print '</td></tr>'."\n";
696
697 // Target
698 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
699 print '</td><td class="CTableRow2">';
700 print img_picto('', 'company', 'class="pictofixedwidth"');
701 print '<b>'.$object->thirdparty->name.'</b>';
702 print '</td></tr>'."\n";
703
704 // Object
705 $text = '<b>'.$langs->trans("SignatureFichinterRef", $object->ref).'</b>';
706 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
707 print '</td><td class="CTableRow2">'.$text;
708
709 $last_main_doc_file = $object->last_main_doc;
710 if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
711 // It seems document has never been generated, or was generated and then deleted.
712 // So we try to regenerate it with its default template.
713 $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
714 $object->generateDocument($defaulttemplate, $langs);
715 }
716 $directdownloadlink = $object->getLastMainDocLink('', 0, 0);
717 if ($directdownloadlink) {
718 print '<br><a href="'.$directdownloadlink.'">';
719 print img_mime($object->last_main_doc, '');
720 if ($message == "signed") {
721 print $langs->trans("DownloadSignedDocument").'</a>';
722 } else {
723 print $langs->trans("DownloadDocument").'</a>';
724 }
725 }
726 print '<input type="hidden" name="source" value="'.GETPOST("source", 'alpha').'">';
727 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
728 print '</td></tr>'."\n";
729} else {
730 $found = true;
731 $langs->load('companies');
732
733 if (!empty($object->socid) || !empty($object->fk_soc)) {
734 $result = $object->fetch_thirdparty();
735 }
736
737 // Proposer
738 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer");
739 print '</td><td class="CTableRow2">';
740 print img_picto('', 'company', 'class="pictofixedwidth"');
741 print '<b>'.$creditor.'</b>';
742 print '<input type="hidden" name="creditor" value="'.$creditor.'">';
743 print '</td></tr>'."\n";
744
745 // Target
746 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
747 print '</td><td class="CTableRow2">';
748 print img_picto('', 'company', 'class="pictofixedwidth"');
749 print '<b>'.$object->thirdparty->name.'</b>';
750 print '</td></tr>'."\n";
751
752 // Object
753 $text = '<b>'.$langs->trans("Signature".dol_ucfirst($source)."Ref", $object->ref).'</b>';
754 print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
755 print '</td><td class="CTableRow2">'.$text;
756
757 $last_main_doc_file = $object->last_main_doc;
758
759 if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
760 // It seems document has never been generated, or was generated and then deleted.
761 // So we try to regenerate it with its default template.
762 $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
763 $object->generateDocument($defaulttemplate, $langs);
764 }
765
766 $directdownloadlink = $object->getLastMainDocLink($source);
767 if ($directdownloadlink) {
768 print '<br><a href="'.$directdownloadlink.'">';
769 print img_mime($object->last_main_doc, '');
770 if ($message == "signed") {
771 print $langs->trans("DownloadSignedDocument").'</a>';
772 } else {
773 print $langs->trans("DownloadDocument").'</a>';
774 }
775 }
776}
777
778// Call Hook addFormSign
779$parameters = array('source' => $source);
780$reshook = $hookmanager->executeHooks('addFormSign', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
781
782if (!$found) {
783 $langs->load('errors');
784 print '<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($langs->transnoentitiesnoconv("ErrorBadParameters")).'</div></td></tr>'."\n";
785}
786
787print '</table>'."\n";
788print "\n";
789
790if ($action != 'dosign') {
791 if ($found && !$error) {
792 // We are in a management option and no error
793 } else {
794 dol_print_error_email('ERRORNEWONLINESIGN');
795 }
796} else {
797 // Print
798}
799
800print '</td></tr>'."\n";
801print '<tr><td class="center">';
802
803
804if ($action == "dosign" && empty($cancel)) {
805 // Show the field to sign
806 print '<div class="tablepublicpayment">';
807 print '<input type="text" class="paddingleftonly marginleftonly paddingright marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans("Lastname").'" spellcheck="false" autofocus>';
808 print '<div id="signature" style="border:solid;"></div>';
809 print '</div>';
810 print '<input type="button" class="small noborderall cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans("ClearSignature").'">';
811
812 // Do not use class="reposition" here: It breaks the submit and there is a message on top to say it's ok, so going back top is better.
813 print '<div>';
814 print '<input type="button" class="button butActionSign marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans("Sign").'">';
815 print '<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans("Cancel").'">';
816 print '</div>';
817
818 // Define $urlwithroot
819 $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
820 $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
821 //$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
822 // TODO Replace DOL_URL_ROOT with $urlwithroot ?
823
824 // Add js code managed into the div #signature
825 $urltogo = $_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&source='.urlencode($source).'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.(int) $entity : '');
826 print '<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.'/public/includes/jquery/plugins/jSignature/jSignature.js"></script>
827 <script type="text/javascript">
828 $(document).ready(function() {
829 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty($conf->dol_optimize_smallscreen) ? '' : 'width: 280, ').'height: 180});
830
831 $("#signature").on("change",function(){
832 $("#clearsignature").css("display","");
833 $("#signbutton").attr("disabled",false);
834 if(!$._data($("#signbutton")[0], "events")){
835 $("#signbutton").on("click",function(){
836 console.log("We click on button sign");
837 document.body.style.cursor = \'wait\';
838 var signature = $("#signature").jSignature("getData", "image");
839 var name = document.getElementById("name").value;
840 $.ajax({
841 type: "POST",
842 url: \''.DOL_URL_ROOT.'/core/ajax/onlineSign.php\',
843 dataType: "text",
844 data: {
845 "action" : \'importSignature\',
846 "token" : \''.newToken().'\',
847 "signaturebase64" : signature,
848 "onlinesignname" : name,
849 "ref" : \''.dol_escape_js($REF).'\',
850 "securekey" : \''.dol_escape_js($SECUREKEY).'\',
851 "mode" : \''.dol_escape_js($source).'\',
852 "entity" : \''.dol_escape_js((string) $entity).'\',
853 },
854 success: function(response) {
855 if (response.trim() === "success") {
856 console.log("Success on saving signature");
857 window.location.replace(\''.dol_escape_js($urltogo).'\');
858 } else {
859 document.body.style.cursor = \'auto\';
860 console.error(response);
861 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
862 }
863 },
864 error: function(response) {
865 document.body.style.cursor = \'auto\';
866 console.error(response);
867 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
868 }
869 });
870 });
871 }
872 });
873
874 $("#clearsignature").on("click",function(){
875 $("#signature").jSignature("clear");
876 $("#signbutton").attr("disabled",true);
877 // document.getElementById("onlinesignname").value = "";
878 });
879
880 $("#signbutton").attr("disabled",true);
881 });
882 </script>';
883} else {
884 if ($source == 'proposal') {
885 if ($object->status == $object::STATUS_SIGNED) {
886 print '<br>';
887 if ($message == 'signed') {
888 print img_picto('', 'check', '', 0, 0, 0, '', 'size2x').'<br>';
889 print '<span class="ok">'.$langs->trans("PropalSigned").'</span>';
890 } else {
891 print img_picto('', 'check', '', 0, 0, 0, '', 'size2x').'<br>';
892 print '<span class="ok">'.$langs->trans("PropalAlreadySigned").'</span>';
893 }
894 } elseif ($object->status == $object::STATUS_NOTSIGNED) {
895 print '<br>';
896 if ($message == 'refused') {
897 print img_picto('', 'cross', '', 0, 0, 0, '', 'size2x').'<br>';
898 print '<span class="ok">'.$langs->trans("PropalRefused").'</span>';
899 } else {
900 print img_picto('', 'cross', '', 0, 0, 0, '', 'size2x').'<br>';
901 print '<span class="warning">'.$langs->trans("PropalAlreadyRefused").'</span>';
902 }
903 } else {
904 print '<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignPropal").'">';
905 print '<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("RefusePropal").'">';
906 }
907 } elseif ($source == 'contract') {
908 if ($message == 'signed') {
909 print '<span class="ok">'.$langs->trans("ContractSigned").'</span>';
910 } else {
911 print '<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignContract").'">';
912 }
913 } elseif ($source == 'fichinter') {
914 if ($message == 'signed') {
915 print '<span class="ok">'.$langs->trans("FichinterSigned").'</span>';
916 } else {
917 print '<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignFichinter").'">';
918 }
919 } elseif ($source == 'expedition') {
920 if ($message == 'signed' || $object->signed_status == Expedition::$SIGNED_STATUSES['STATUS_SIGNED_SENDER']) {
921 print '<span class="ok">'.$langs->trans("ExpeditionSigned").'</span>';
922 } else {
923 print '<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignExpedition").'">';
924 }
925 } else {
926 if ($message == 'signed') {
927 print '<span class="ok">'.$langs->trans(dol_ucfirst($source)."Signed").'</span>';
928 } else {
929 print '<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("Sign".dol_ucfirst($source)).'">';
930 }
931 }
932}
933print '</td></tr>'."\n";
934print '</table>'."\n";
935
936print '</form>'."\n";
937print '</div>'."\n";
938print '<br>';
939
940
942
943llxFooter('', 'public');
944
945$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
$object ref
Definition info.php:90
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage customers orders.
Class to manage bank accounts description of third parties.
Class to manage generation of HTML components Only common components must be here.
Class to manage proposals.
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML public pages.
global $mysoc
dol_filemtime($pathoffile)
Return time of a file.
dol_is_file($pathoffile)
Return if path is a file.
dol_now($mode='gmt')
Return date for now.
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.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_strtoupper($string, $encoding="UTF-8")
Convert a string to upper.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
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.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:183
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:165
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...