28if (!defined(
'NOLOGIN')) {
31if (!defined(
'NOCSRFCHECK')) {
32 define(
"NOCSRFCHECK", 1);
34if (!defined(
'NOIPCHECK')) {
35 define(
'NOIPCHECK',
'1');
37if (!defined(
'NOBROWSERNOTIF')) {
38 define(
'NOBROWSERNOTIF',
'1');
44$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
45if (is_numeric($entity)) {
46 define(
"DOLENTITY", $entity);
50require
'../../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
58$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"errors",
"members",
"paybox",
"propal",
"commercial"));
64$action =
GETPOST(
'action',
'aZ09');
65$cancel =
GETPOST(
'cancel',
'alpha');
66$confirm =
GETPOST(
'confirm',
'alpha');
69$refusepropal =
GETPOST(
'refusepropal',
'alpha');
70$message =
GETPOST(
'message',
'aZ09');
79$suffix =
GETPOST(
"suffix",
'aZ09');
80$source =
GETPOST(
"source",
'alpha');
81$ref = $REF =
GETPOST(
"ref",
'alpha');
89if (!empty($refusepropal)) {
90 $action =
"refusepropal";
96$urlwithroot = DOL_MAIN_URL_ROOT;
100$SECUREKEY =
GETPOST(
"securekey");
102if (!empty($source)) {
103 $urlok .=
'source='.urlencode($source).
'&';
104 $urlko .=
'source='.urlencode($source).
'&';
107 $urlok .=
'ref='.urlencode($REF).
'&';
108 $urlko .=
'ref='.urlencode($REF).
'&';
110if (!empty($SECUREKEY)) {
111 $urlok .=
'securekey='.urlencode($SECUREKEY).
'&';
112 $urlko .=
'securekey='.urlencode($SECUREKEY).
'&';
114if (!empty($entity)) {
115 $urlok .=
'entity='.urlencode($entity).
'&';
116 $urlko .=
'entity='.urlencode($entity).
'&';
118$urlok = preg_replace(
'/&$/',
'', $urlok);
119$urlko = preg_replace(
'/&$/',
'', $urlko);
121$creditor = $mysoc->name;
126 if ($source && !$ref) {
133if ($source ==
'proposal') {
135} elseif ($source ==
'contract') {
137} elseif ($source ==
'fichinter') {
139} elseif ($source ==
'societe_rib') {
142if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'0')) {
146if ($source ==
'proposal') {
147 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
148 $object =
new Propal($db);
149 $result= $object->fetch(0, $ref,
'', $entity);
150} elseif ($source ==
'contract') {
151 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
153 $result= $object->fetch(0, $ref);
154} elseif ($source ==
'fichinter') {
155 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
157 $result= $object->fetch(0, $ref);
158} elseif ($source ==
'societe_rib') {
159 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
161 $result= $object->fetch($ref);
163 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
167$hookmanager->initHooks(array(
'onlinesign'));
176if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
179 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
180 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".$db->escape($object->note_private).
"', date_signature='".$db->idate(
dol_now()).
"'";
181 $sql .=
" WHERE rowid = ".((int) $object->id);
184 $resql = $db->query($sql);
192 $message =
'refused';
194 if (method_exists($object,
'call_trigger')) {
196 $user =
new User($db);
197 $user->fetch($object->user_validation_id);
198 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
199 $result = $object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
208 $object->fetch(0, $ref);
216$form =
new Form($db);
219 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
222$conf->dol_hide_topmenu = 1;
223$conf->dol_hide_leftmenu = 1;
225$replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
226llxHeader($head, $langs->trans(
"OnlineSignature"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
228if ($action ==
'refusepropal') {
229 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);
233if (!empty($source) && in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
234 $langs->load(
"errors");
235 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
242print
'<span id="dolpaymentspan"></span>'.
"\n";
243print
'<div class="center">'.
"\n";
244print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
245print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
246print
'<input type="hidden" name="action" value="dosign">'.
"\n";
247print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
248print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
249print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
250print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
251print
'<input type="hidden" name="page_y" value="" />';
252print
'<input type="hidden" name="source" value="'.$source.
'" />';
253print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
255print
'<!-- Form to sign -->'.
"\n";
257print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
261$logosmall = $mysoc->logo_small;
263$paramlogo =
'ONLINE_SIGN_LOGO_'.$suffix;
264if (!empty($conf->global->$paramlogo)) {
265 $logosmall = $conf->global->$paramlogo;
267 $logosmall = $conf->global->ONLINE_SIGN_LOGO;
273if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
274 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
275 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
276} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
277 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
278 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
282 print
'<div class="backgreypublicpayment">';
283 print
'<div class="logopublicpayment">';
284 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
288 print
'<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans(
"PoweredBy").
'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" width="80px"></a></div>';
293 print
'<div class="backimagepublicproposalsign">';
294 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
302 if (preg_match(
'/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
303 $text .= $langs->trans($reg[1]).
"<br>\n";
307 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
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 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 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 opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
320 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source), $mysoc->name).
'</strong></td></tr>'.
"\n";
321 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
327print
'<tr><td align="center">';
328print
'<table with="100%" id="tablepublicpayment">';
329if ($source ==
'proposal') {
330 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
' :</td></tr>'.
"\n";
331} elseif ($source ==
'contract') {
332 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
' :</td></tr>'.
"\n";
333} elseif ($source ==
'fichinter') {
334 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
' :</td></tr>'.
"\n";
336 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
' :</td></tr>'.
"\n";
342if ($source ==
'proposal') {
344 $langs->load(
"proposal");
346 $result = $object->fetch_thirdparty($object->socid);
349 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
350 print
'</td><td class="CTableRow2">';
351 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
352 print
'<b>'.$creditor.
'</b>';
353 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
354 print
'</td></tr>'.
"\n";
357 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
358 print
'</td><td class="CTableRow2">';
359 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
360 print
'<b>'.$object->thirdparty->name.
'</b>';
361 print
'</td></tr>'.
"\n";
365 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
366 $amount .=
'</td><td class="CTableRow2">';
367 $amount .=
'<b>'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).
'</b>';
368 if ($object->multicurrency_code != $conf->currency) {
369 $amount .=
' ('.price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code).
')';
371 $amount .=
'</td></tr>'.
"\n";
374 $parameters = array(
'source' => $source);
375 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters, $object, $action);
376 if (empty($reshook)) {
377 $amount .= $hookmanager->resPrint;
378 } elseif ($reshook > 0) {
379 $amount = $hookmanager->resPrint;
385 $text =
'<b>'.$langs->trans(
"SignatureProposalRef", $object->ref).
'</b>';
386 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
387 print
'</td><td class="CTableRow2">'.$text;
389 $last_main_doc_file = $object->last_main_doc;
391 if ($object->status == $object::STATUS_VALIDATED) {
392 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.$object->last_main_doc)) {
395 $defaulttemplate =
'';
396 $object->generateDocument($defaulttemplate, $langs);
399 $directdownloadlink = $object->getLastMainDocLink(
'proposal');
400 if ($directdownloadlink) {
401 print
'<br><a href="'.$directdownloadlink.
'">';
402 print
img_mime($object->last_main_doc,
'');
403 print $langs->trans(
"DownloadDocument").
'</a>';
406 if ($object->status == $object::STATUS_NOTSIGNED) {
407 $directdownloadlink = $object->getLastMainDocLink(
'proposal');
408 if ($directdownloadlink) {
409 print
'<br><a href="'.$directdownloadlink.
'">';
410 print
img_mime($last_main_doc_file,
'');
411 print $langs->trans(
"DownloadDocument").
'</a>';
413 } elseif ($object->status == $object::STATUS_SIGNED || $object->status == $object::STATUS_BILLED) {
414 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
415 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
418 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
420 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
421 $directdownloadlink = $object->getLastMainDocLink(
'proposal');
422 if ($directdownloadlink) {
423 print
'<br><a href="'.$directdownloadlink.
'">';
424 print
img_mime($object->last_main_doc,
'');
425 print $langs->trans(
"DownloadDocument").
'</a>';
432 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
433 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
434 print
'</td></tr>'.
"\n";
435} elseif ($source ==
'contract') {
437 $langs->load(
"contract");
439 $result = $object->fetch_thirdparty($object->socid);
442 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
443 print
'</td><td class="CTableRow2">';
444 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
445 print
'<b>'.$creditor.
'</b>';
446 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
447 print
'</td></tr>'.
"\n";
450 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
451 print
'</td><td class="CTableRow2">';
452 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
453 print
'<b>'.$object->thirdparty->name.
'</b>';
454 print
'</td></tr>'.
"\n";
457 $text =
'<b>'.$langs->trans(
"SignatureContractRef", $object->ref).
'</b>';
458 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
459 print
'</td><td class="CTableRow2">'.$text;
461 $last_main_doc_file = $object->last_main_doc;
463 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.$object->last_main_doc)) {
466 $defaulttemplate =
'';
467 $object->generateDocument($defaulttemplate, $langs);
470 $directdownloadlink = $object->getLastMainDocLink(
'contract');
471 if ($directdownloadlink) {
472 print
'<br><a href="'.$directdownloadlink.
'">';
473 print
img_mime($object->last_main_doc,
'');
474 if ($message ==
"signed") {
475 print $langs->trans(
"DownloadSignedDocument").
'</a>';
477 print $langs->trans(
"DownloadDocument").
'</a>';
482 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
483 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
484 print
'</td></tr>'.
"\n";
485} elseif ($source ==
'fichinter') {
488 $langs->load(
"fichinter");
490 $result = $object->fetch_thirdparty($object->socid);
493 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
494 print
'</td><td class="CTableRow2">';
495 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
496 print
'<b>'.$creditor.
'</b>';
497 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
498 print
'</td></tr>'.
"\n";
501 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
502 print
'</td><td class="CTableRow2">';
503 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
504 print
'<b>'.$object->thirdparty->name.
'</b>';
505 print
'</td></tr>'.
"\n";
508 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef", $object->ref).
'</b>';
509 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
510 print
'</td><td class="CTableRow2">'.$text;
512 $last_main_doc_file = $object->last_main_doc;
514 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.$object->last_main_doc)) {
517 $defaulttemplate =
'';
518 $object->generateDocument($defaulttemplate, $langs);
521 $directdownloadlink = $object->getLastMainDocLink(
'fichinter');
522 if ($directdownloadlink) {
523 print
'<br><a href="'.$directdownloadlink.
'">';
524 print
img_mime($object->last_main_doc,
'');
525 if ($message ==
"signed") {
526 print $langs->trans(
"DownloadSignedDocument").
'</a>';
528 print $langs->trans(
"DownloadDocument").
'</a>';
531 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
532 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
533 print
'</td></tr>'.
"\n";
534} elseif ($source ==
'societe_rib') {
536 $langs->loadLangs(array(
"companies",
"commercial",
"withdrawals"));
538 $result = $object->fetch_thirdparty();
541 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Proposer");
542 print
'</td><td class="CTableRow2">';
543 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
544 print
'<b>' . $creditor .
'</b>';
545 print
'<input type="hidden" name="creditor" value="' . $creditor .
'">';
546 print
'</td></tr>' .
"\n";
549 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"ThirdParty");
550 print
'</td><td class="CTableRow2">';
551 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
552 print
'<b>' . $object->thirdparty->name .
'</b>';
553 print
'</td></tr>' .
"\n";
556 $text =
'<b>' . $langs->trans(
"Signature" .
dol_ucfirst($source) .
"Ref", $object->ref) .
'</b>';
557 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Designation");
558 print
'</td><td class="CTableRow2">' . $text;
560 $last_main_doc_file = $object->last_main_doc;
561 $diroutput = $conf->societe->multidir_output[$object->thirdparty->entity].
'/'
562 .dol_sanitizeFileName($object->thirdparty->id).
'/';
563 if ((empty($last_main_doc_file) ||
565 .$langs->transnoentitiesnoconv(
"SepaMandateShort").
' '.$object->id.
"-".
dol_sanitizeFileName($object->rum).
".pdf"))
566 && $message !=
"signed") {
572 $object->setDocModel($user, $defaulttemplate);
574 'use_companybankid'=>$object->id,
575 'force_dir_output'=>$diroutput
577 $result = $object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
578 $object->last_main_doc=$object->thirdparty->last_main_doc;
580 $directdownloadlink = $object->getLastMainDocLink(
'company');
581 if ($directdownloadlink) {
582 print
'<br><a href="'.$directdownloadlink.
'">';
583 print
img_mime($object->last_main_doc,
'');
584 if ($message ==
"signed") {
585 print $langs->trans(
"DownloadSignedDocument").
'</a>';
587 print $langs->trans(
"DownloadDocument").
'</a>';
592 $langs->load(
'companies');
594 if (!empty($object->socid) || !empty($object->fk_soc)) {
595 $result = $object->fetch_thirdparty();
599 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
600 print
'</td><td class="CTableRow2">';
601 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
602 print
'<b>'.$creditor.
'</b>';
603 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
604 print
'</td></tr>'.
"\n";
607 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
608 print
'</td><td class="CTableRow2">';
609 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
610 print
'<b>'.$object->thirdparty->name.
'</b>';
611 print
'</td></tr>'.
"\n";
614 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref", $object->ref).
'</b>';
615 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
616 print
'</td><td class="CTableRow2">'.$text;
618 $last_main_doc_file = $object->last_main_doc;
620 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.$object->last_main_doc)) {
623 $defaulttemplate =
'';
624 $object->generateDocument($defaulttemplate, $langs);
627 $directdownloadlink = $object->getLastMainDocLink($source);
628 if ($directdownloadlink) {
629 print
'<br><a href="'.$directdownloadlink.
'">';
630 print
img_mime($object->last_main_doc,
'');
631 if ($message ==
"signed") {
632 print $langs->trans(
"DownloadSignedDocument").
'</a>';
634 print $langs->trans(
"DownloadDocument").
'</a>';
640$parameters = array(
'source' => $source);
641$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters, $object, $action);
643if (!$found && !$mesg) {
644 $mesg = $langs->transnoentitiesnoconv(
"ErrorBadParameters");
648 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).
'</div></td></tr>'.
"\n";
651print
'</table>'.
"\n";
654if ($action !=
'dosign') {
655 if ($found && !$error) {
664print
'</td></tr>'.
"\n";
665print
'<tr><td class="center">';
668if ($action ==
"dosign" && empty($cancel)) {
669 print
'<div class="tablepublicpayment">';
670 print
'<input type="text" class="paddingleftonly marginleftonly paddingrightonly marginrightonly marginbottomonly" id="name" placeholder="'.$langs->trans(
"Lastname").
'" autofocus>';
671 print
'<div id="signature" style="border:solid;"></div>';
673 print
'<input type="button" class="small noborderbottom cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
677 print
'<input type="button" class="button marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
678 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
682 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jSignature/jSignature.js"></script>
683 <script type="text/javascript">
684 $(document).ready(function() {
685 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty($conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
687 $("#signature").on("change",function(){
688 $("#clearsignature").css("display","");
689 $("#signbutton").attr("disabled",false);
690 if(!$._data($("#signbutton")[0], "events")){
691 $("#signbutton").on("click",function(){
692 console.log("We click on button sign");
693 document.body.style.cursor = \'wait\';
694 /* $("#signbutton").val(\''.
dol_escape_js($langs->transnoentities(
'PleaseBePatient')).
'\'); */
695 var signature = $(
"#signature").jSignature(
"getData",
"image");
696 var
name = document.getElementById(
"name").value;
699 url:
"'.DOL_URL_ROOT.'/core/ajax/onlineSign.php",
702 "action" :
"importSignature",
703 "token" : \
''.newToken().
'\',
704 "signaturebase64" : signature,
705 "onlinesignname" :
name,
711 success: function(response) {
712 if(response == "success"){
713 console.log("Success on saving signature");
714 window.location.replace("'.$_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.$entity :
'').
'");
716 console.error(response);
724 $("#clearsignature").on("click",function(){
725 $("#signature").jSignature("clear");
726 $("#signbutton").attr("disabled",true);
727 // document.getElementById("onlinesignname").value = "";
730 $("#signbutton").attr("disabled",true);
734 if ($source ==
'proposal') {
735 if ($object->status == $object::STATUS_SIGNED) {
737 if ($message ==
'signed') {
738 print
img_picto(
'',
'check',
'',
false, 0, 0,
'',
'size2x').
'<br>';
739 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
741 print
img_picto(
'',
'check',
'',
false, 0, 0,
'',
'size2x').
'<br>';
742 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
744 } elseif ($object->status == $object::STATUS_NOTSIGNED) {
746 if ($message ==
'refused') {
747 print
img_picto(
'',
'cross',
'',
false, 0, 0,
'',
'size2x').
'<br>';
748 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
750 print
img_picto(
'',
'cross',
'',
false, 0, 0,
'',
'size2x').
'<br>';
751 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
754 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
755 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
757 } elseif ($source ==
'contract') {
758 if ($message ==
'signed') {
759 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
761 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
763 } elseif ($source ==
'fichinter') {
764 if ($message ==
'signed') {
765 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
767 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
770 if ($message ==
'signed') {
771 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
773 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
777print
'</td></tr>'.
"\n";
778print
'</table>'.
"\n";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts description of third parties.
Class to manage contracts.
Class to manage interventions.
Class to manage proposals.
Class to manage Dolibarr users.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
dol_filemtime($pathoffile)
Return time of a file.
dol_is_file($pathoffile)
Return if path is a file.
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.
dol_now($mode='auto')
Return date for now.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.