32if (!defined(
'NOLOGIN')) {
35if (!defined(
'NOCSRFCHECK')) {
36 define(
"NOCSRFCHECK", 1);
38if (!defined(
'NOIPCHECK')) {
39 define(
'NOIPCHECK',
'1');
41if (!defined(
'NOBROWSERNOTIF')) {
42 define(
'NOBROWSERNOTIF',
'1');
48$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
49if (is_numeric($entity)) {
50 define(
"DOLENTITY", $entity);
54require
'../../main.inc.php';
65require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
66require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
67require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
68require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
69require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
70require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
73$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"errors",
"members",
"paybox",
"stripe",
"propal",
"commercial"));
79$action =
GETPOST(
'action',
'aZ09');
80$cancel =
GETPOST(
'cancel',
'alpha');
81$confirm =
GETPOST(
'confirm',
'alpha');
84$refusepropal =
GETPOST(
'refusepropal',
'alpha');
85$message =
GETPOST(
'message',
'aZ09');
94$suffix =
GETPOST(
"suffix",
'aZ09');
96$ref = $REF =
GETPOST(
"ref",
'alpha');
102 $source =
'proposal';
104if (!empty($refusepropal)) {
105 $action =
"refusepropal";
111$urlwithroot = DOL_MAIN_URL_ROOT;
115$SECUREKEY =
GETPOST(
"securekey");
117if (!empty($source)) {
118 $urlok .=
'source='.urlencode($source).
'&';
119 $urlko .=
'source='.urlencode($source).
'&';
122 $urlok .=
'ref='.urlencode($REF).
'&';
123 $urlko .=
'ref='.urlencode($REF).
'&';
125if (!empty($SECUREKEY)) {
126 $urlok .=
'securekey='.urlencode($SECUREKEY).
'&';
127 $urlko .=
'securekey='.urlencode($SECUREKEY).
'&';
129if (!empty($entity)) {
130 $urlok .=
'entity='.urlencode((
string) ($entity)).
'&';
131 $urlko .=
'entity='.urlencode((
string) ($entity)).
'&';
133$urlok = preg_replace(
'/&$/',
'', $urlok);
134$urlko = preg_replace(
'/&$/',
'', $urlko);
140 if ($source && !$ref) {
145global $dolibarr_main_instance_unique_id;
146$defaultsalt = substr(
dol_hash(
'dolibarr'.$dolibarr_main_instance_unique_id,
'sha256'), 0, 32);
150if ($source ==
'proposal') {
151 $securekeyseed =
getDolGlobalString(
'PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
152} elseif ($source ==
'contract') {
153 $securekeyseed =
getDolGlobalString(
'CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
154} elseif ($source ==
'fichinter') {
155 $securekeyseed =
getDolGlobalString(
'FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
156} elseif ($source ==
'societe_rib') {
157 $securekeyseed =
getDolGlobalString(
'SOCIETE_RIB_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
159if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'hash')) {
163if ($source ==
'proposal') {
164 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
166 $result =
$object->fetch(0, $ref,
'', $entity);
167} elseif ($source ==
'contract') {
168 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
170 $result =
$object->fetch(0, $ref);
171} elseif ($source ==
'fichinter') {
172 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
174 $result =
$object->fetch(0, $ref);
175} elseif ($source ==
'societe_rib') {
176 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
178 $result =
$object->fetch(0, $ref);
179} elseif ($source ==
'expedition') {
180 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
182 $result =
$object->fetch(0, $ref);
184 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
188$hookmanager->initHooks(array(
'onlinesign'));
197if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
200 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
201 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".
$db->escape(
$object->note_private).
"', date_signature = '".
$db->idate(
dol_now()).
"'";
202 $sql .=
" WHERE rowid = ".((int)
$object->id);
205 $resql =
$db->query($sql);
213 $message =
'refused';
215 if (method_exists(
$object,
'call_trigger')) {
216 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
217 $result =
$object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
240 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
243$conf->dol_hide_topmenu = 1;
244$conf->dol_hide_leftmenu = 1;
246$title = $langs->trans(
"OnlineSignature");
248$replacemainarea = (empty(
$conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
249llxHeader($head, $title,
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
251htmlPrintOnlineHeader(
$mysoc, $langs, 1,
'',
'ONLINE_SIGN_IMAGE_PUBLIC_INTERFACE',
'ONLINE_SIGN_LOGO_'.$suffix,
'ONLINE_SIGN_LOGO');
253if ($action ==
'refusepropal') {
254 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);
258if ( in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
259 $langs->load(
"errors");
260 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
267print
'<span id="dolpaymentspan"></span>'.
"\n";
268print
'<div class="center">'.
"\n";
269print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
270print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
271print
'<input type="hidden" name="action" value="dosign">'.
"\n";
272print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
273print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
274print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
275print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
276print
'<input type="hidden" name="page_y" value="" />';
277print
'<input type="hidden" name="source" value="'.$source.
'" />';
278print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
280print
'<!-- Form to sign -->'.
"\n";
283 print
'<div class="backimagepublicproposalsign">';
284 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
288print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
294 if (preg_match(
'/^\((.*)\)$/',
$conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
295 $text .= $langs->trans($reg[1]).
"<br>\n";
299 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
302 if ($source ==
'proposal') {
303 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageProposal",
$mysoc->name).
'</strong></td></tr>'.
"\n";
304 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromProposal", $creditor).
'<br><br></td></tr>'.
"\n";
305 } elseif ($source ==
'contract') {
306 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageContract",
$mysoc->name).
'</strong></td></tr>'.
"\n";
307 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromContract", $creditor).
'<br><br></td></tr>'.
"\n";
308 } elseif ($source ==
'fichinter') {
309 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageFichinter",
$mysoc->name).
'</strong></td></tr>'.
"\n";
310 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
311 } elseif ($source ==
'expedition') {
312 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageExpedition",
$mysoc->name).
'</strong></td></tr>'.
"\n";
313 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromExpedition", $creditor).
'<br><br></td></tr>'.
"\n";
315 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source),
$mysoc->name).
'</strong></td></tr>'.
"\n";
316 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
322print
'<tr><td align="center">';
323print
'<table with="100%" id="tablepublicpayment">';
324if ($source ==
'proposal') {
325 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
'<br><br></td></tr>'.
"\n";
326} elseif ($source ==
'contract') {
327 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
'<br><br></td></tr>'.
"\n";
328} elseif ($source ==
'fichinter') {
329 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
'<br><br></td></tr>'.
"\n";
330} elseif ($source ==
'expedition') {
331 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignExpedition").
'<br><br></td></tr>'.
"\n";
333 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
'<br><br></td></tr>'.
"\n";
339if ($source ==
'proposal') {
341 $langs->load(
"proposal");
346 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
347 print
'</td><td class="CTableRow2">';
348 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
349 print
'<b>'.$creditor.
'</b>';
350 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
351 print
'</td></tr>'.
"\n";
354 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
355 print
'</td><td class="CTableRow2">';
356 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
357 print
'<b>'.$object->thirdparty->name.
'</b>';
358 print
'</td></tr>'.
"\n";
362 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
363 $amount .=
'</td><td class="CTableRow2">';
366 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
368 $amount .=
'</td></tr>'.
"\n";
371 $parameters = array(
'source' => $source);
372 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters,
$object, $action);
373 if (empty($reshook)) {
374 $amount .= $hookmanager->resPrint;
375 } elseif ($reshook > 0) {
376 $amount = $hookmanager->resPrint;
382 $text =
'<b>'.$langs->trans(
"SignatureProposalRef",
$object->ref).
'</b>';
383 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
384 print
'</td><td class="CTableRow2">'.$text;
386 $last_main_doc_file =
$object->last_main_doc;
388 if (
$object->status == $object::STATUS_VALIDATED) {
389 $object->last_main_doc = preg_replace(
'/_signed-(\d+)/',
'',
$object->last_main_doc);
391 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
394 $defaulttemplate =
'';
395 $object->generateDocument($defaulttemplate, $langs);
398 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
399 if ($directdownloadlink) {
400 print
'<br><a href="'.$directdownloadlink.
'">';
402 print $langs->trans(
"DownloadDocument").
'</a>';
405 if (
$object->status == $object::STATUS_NOTSIGNED) {
406 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
407 if ($directdownloadlink) {
408 print
'<br><a href="'.$directdownloadlink.
'">';
409 print
img_mime($last_main_doc_file,
'');
410 print $langs->trans(
"DownloadDocument").
'</a>';
412 } elseif (
$object->status == $object::STATUS_SIGNED ||
$object->status == $object::STATUS_BILLED) {
413 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
414 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
417 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
419 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
420 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
421 if ($directdownloadlink) {
422 print
'<br><a href="'.$directdownloadlink.
'">';
424 print $langs->trans(
"DownloadDocument").
'</a>';
431 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
432 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
433 print
'</td></tr>'.
"\n";
434} elseif ($source ==
'contract') {
436 $langs->load(
"contract");
441 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
442 print
'</td><td class="CTableRow2">';
443 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
444 print
'<b>'.$creditor.
'</b>';
445 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
446 print
'</td></tr>'.
"\n";
449 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
450 print
'</td><td class="CTableRow2">';
451 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
452 print
'<b>'.$object->thirdparty->name.
'</b>';
453 print
'</td></tr>'.
"\n";
456 $text =
'<b>'.$langs->trans(
"SignatureContractRef",
$object->ref).
'</b>';
457 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
458 print
'</td><td class="CTableRow2">'.$text;
460 $last_main_doc_file =
$object->last_main_doc;
462 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
465 $defaulttemplate =
'';
466 $object->generateDocument($defaulttemplate, $langs);
469 $directdownloadlink =
$object->getLastMainDocLink(
'contract');
470 if ($directdownloadlink) {
471 print
'<br><a href="'.$directdownloadlink.
'">';
473 if ($message ==
"signed") {
474 print $langs->trans(
"DownloadSignedDocument").
'</a>';
476 print $langs->trans(
"DownloadDocument").
'</a>';
481 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
482 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
483 print
'</td></tr>'.
"\n";
484} elseif ($source ==
'fichinter') {
487 $langs->load(
"interventions");
492 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
493 print
'</td><td class="CTableRow2">';
494 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
495 print
'<b>'.$creditor.
'</b>';
496 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
497 print
'</td></tr>'.
"\n";
500 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
501 print
'</td><td class="CTableRow2">';
502 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
503 print
'<b>'.$object->thirdparty->name.
'</b>';
504 print
'</td></tr>'.
"\n";
507 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
508 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
509 print
'</td><td class="CTableRow2">'.$text;
511 $last_main_doc_file =
$object->last_main_doc;
513 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
516 $defaulttemplate =
'';
517 $object->generateDocument($defaulttemplate, $langs);
520 $directdownloadlink =
$object->getLastMainDocLink(
'fichinter');
521 if ($directdownloadlink) {
522 print
'<br><a href="'.$directdownloadlink.
'">';
524 if ($message ==
"signed") {
525 print $langs->trans(
"DownloadSignedDocument").
'</a>';
527 print $langs->trans(
"DownloadDocument").
'</a>';
530 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
531 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
532 print
'</td></tr>'.
"\n";
533} elseif ($source ==
'societe_rib') {
535 $langs->loadLangs(array(
"companies",
"commercial",
"withdrawals"));
537 $result =
$object->fetch_thirdparty();
540 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"CreditorName");
541 print
'</td><td class="CTableRow2">';
542 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
543 print
'<b>' . $creditor .
'</b>';
544 print
'<input type="hidden" name="creditor" value="' . $creditor .
'">';
545 print
'</td></tr>' .
"\n";
548 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"ThirdParty");
549 print
'</td><td class="CTableRow2">';
550 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
551 print
'<b>' .
$object->thirdparty->name .
'</b>';
552 print
'</td></tr>' .
"\n";
555 $text =
'<b>' . $langs->trans(
"Signature" .
dol_ucfirst($source) .
"Ref",
$object->ref) .
'</b>';
556 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Designation");
557 print
'</td><td class="CTableRow2">' . $text;
559 $last_main_doc_file =
$object->last_main_doc;
560 $diroutput =
$conf->societe->multidir_output[
$object->thirdparty->entity].
'/'
561 .dol_sanitizeFileName((
string)
$object->thirdparty->id).
'/';
562 if ((empty($last_main_doc_file) ||
565 && $message !=
"signed") {
571 $object->setDocModel($user, $defaulttemplate);
573 'use_companybankid' =>
$object->id,
574 'force_dir_output' => $diroutput
576 $result =
$object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
579 $directdownloadlink =
$object->getLastMainDocLink(
'company');
580 if ($directdownloadlink) {
581 print
'<br><a href="'.$directdownloadlink.
'">';
583 if ($message ==
"signed") {
584 print $langs->trans(
"DownloadSignedDocument").
'</a>';
586 print $langs->trans(
"DownloadDocument").
'</a>';
589} elseif ($source ==
'expedition') {
592 $langs->load(
"interventions");
597 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
598 print
'</td><td class="CTableRow2">';
599 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
600 print
'<b>'.$creditor.
'</b>';
601 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
602 print
'</td></tr>'.
"\n";
605 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
606 print
'</td><td class="CTableRow2">';
607 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
608 print
'<b>'.$object->thirdparty->name.
'</b>';
609 print
'</td></tr>'.
"\n";
612 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
613 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
614 print
'</td><td class="CTableRow2">'.$text;
616 $last_main_doc_file =
$object->last_main_doc;
617 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
620 $defaulttemplate =
'';
621 $object->generateDocument($defaulttemplate, $langs);
623 $directdownloadlink =
$object->getLastMainDocLink(
'', 0, 0);
624 if ($directdownloadlink) {
625 print
'<br><a href="'.$directdownloadlink.
'">';
627 if ($message ==
"signed") {
628 print $langs->trans(
"DownloadSignedDocument").
'</a>';
630 print $langs->trans(
"DownloadDocument").
'</a>';
633 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
634 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
635 print
'</td></tr>'.
"\n";
638 $langs->load(
'companies');
641 $result =
$object->fetch_thirdparty();
645 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
646 print
'</td><td class="CTableRow2">';
647 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
648 print
'<b>'.$creditor.
'</b>';
649 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
650 print
'</td></tr>'.
"\n";
653 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
654 print
'</td><td class="CTableRow2">';
655 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
656 print
'<b>'.$object->thirdparty->name.
'</b>';
657 print
'</td></tr>'.
"\n";
660 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref",
$object->ref).
'</b>';
661 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
662 print
'</td><td class="CTableRow2">'.$text;
664 $last_main_doc_file =
$object->last_main_doc;
666 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
669 $defaulttemplate =
'';
670 $object->generateDocument($defaulttemplate, $langs);
673 $directdownloadlink =
$object->getLastMainDocLink($source);
674 if ($directdownloadlink) {
675 print
'<br><a href="'.$directdownloadlink.
'">';
677 if ($message ==
"signed") {
678 print $langs->trans(
"DownloadSignedDocument").
'</a>';
680 print $langs->trans(
"DownloadDocument").
'</a>';
686$parameters = array(
'source' => $source);
687$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters,
$object, $action);
689if (!$found && !$mesg) {
690 $mesg = $langs->transnoentitiesnoconv(
"ErrorBadParameters");
694 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).
'</div></td></tr>'.
"\n";
697print
'</table>'.
"\n";
700if ($action !=
'dosign') {
701 if ($found && !$error) {
710print
'</td></tr>'.
"\n";
711print
'<tr><td class="center">';
714if ($action ==
"dosign" && empty($cancel)) {
716 print
'<div class="tablepublicpayment">';
717 print
'<input type="text" class="paddingleftonly marginleftonly paddingright marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans(
"Lastname").
'" spellcheck="false" autofocus>';
718 print
'<div id="signature" style="border:solid;"></div>';
720 print
'<input type="button" class="small noborderall cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
724 print
'<input type="button" class="button butActionSign marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
725 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
730 $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT;
735 $urltogo = $_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.(int) $entity :
'');
736 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/public/includes/jquery/plugins/jSignature/jSignature.js"></script>
737 <script type="text/javascript">
738 $(document).ready(function() {
739 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty(
$conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
741 $("#signature").on("change",function(){
742 $("#clearsignature").css("display","");
743 $("#signbutton").attr("disabled",false);
744 if(!$._data($("#signbutton")[0], "events")){
745 $("#signbutton").on("click",function(){
746 console.log("We click on button sign");
747 document.body.style.cursor = \'wait\';
748 var signature = $("#signature").jSignature("getData", "image");
749 var name = document.getElementById("name").value;
752 url: \''.DOL_URL_ROOT.
'/core/ajax/onlineSign.php\',
755 "action" : \'importSignature\',
756 "token" : \''.newToken().
'\',
757 "signaturebase64" : signature,
758 "onlinesignname" :
name,
759 "ref" : \
''.dol_escape_js($REF).
'\',
760 "securekey" : \
''.dol_escape_js($SECUREKEY).
'\',
761 "mode" : \
''.dol_escape_js($source).
'\',
762 "entity" : \
''.dol_escape_js((
string) $entity).
'\',
764 success:
function(response) {
765 if (response.trim() ===
"success") {
766 console.log(
"Success on saving signature");
769 document.body.style.cursor = \
'auto\';
770 console.error(response);
771 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
774 error: function(response) {
775 document.body.style.cursor = \'auto\';
776 console.error(response);
777 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
784 $("#clearsignature").on("click",function(){
785 $("#signature").jSignature("clear");
786 $("#signbutton").attr("disabled",true);
787 // document.getElementById("onlinesignname").value = "";
790 $("#signbutton").attr("disabled",true);
794 if ($source ==
'proposal') {
795 if (
$object->status == $object::STATUS_SIGNED) {
797 if ($message ==
'signed') {
798 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
799 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
801 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
802 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
804 } elseif (
$object->status == $object::STATUS_NOTSIGNED) {
806 if ($message ==
'refused') {
807 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
808 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
810 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
811 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
814 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
815 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
817 } elseif ($source ==
'contract') {
818 if ($message ==
'signed') {
819 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
821 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
823 } elseif ($source ==
'fichinter') {
824 if ($message ==
'signed') {
825 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
827 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
829 } elseif ($source ==
'expedition') {
830 if ($message ==
'signed' ||
$object->signed_status == Expedition::$SIGNED_STATUSES[
'STATUS_SIGNED_SENDER']) {
831 print
'<span class="ok">'.$langs->trans(
"ExpeditionSigned").
'</span>';
833 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignExpedition").
'">';
836 if ($message ==
'signed') {
837 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
839 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
843print
'</td></tr>'.
"\n";
844print
'</table>'.
"\n";
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage bank accounts description of third parties.
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.
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.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
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_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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
$conf db name
Only used if Module[ID]Name translation string is not found.
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,...