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';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
59require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
74$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"errors",
"members",
"paybox",
"stripe",
"propal",
"commercial"));
80$action =
GETPOST(
'action',
'aZ09');
81$cancel =
GETPOST(
'cancel',
'alpha');
82$confirm =
GETPOST(
'confirm',
'alpha');
85$refusepropal =
GETPOST(
'refusepropal',
'alpha');
86$message =
GETPOST(
'message',
'aZ09');
95$suffix =
GETPOST(
"suffix",
'aZ09');
96$source = (string)
GETPOST(
"source",
'alpha');
97$ref = $REF =
GETPOST(
"ref",
'alpha');
103 $source =
'proposal';
105if (!empty($refusepropal)) {
106 $action =
"refusepropal";
112$urlwithroot = DOL_MAIN_URL_ROOT;
116$SECUREKEY =
GETPOST(
"securekey");
118if (!empty($source)) {
119 $urlok .=
'source='.urlencode($source).
'&';
120 $urlko .=
'source='.urlencode($source).
'&';
123 $urlok .=
'ref='.urlencode($REF).
'&';
124 $urlko .=
'ref='.urlencode($REF).
'&';
126if (!empty($SECUREKEY)) {
127 $urlok .=
'securekey='.urlencode($SECUREKEY).
'&';
128 $urlko .=
'securekey='.urlencode($SECUREKEY).
'&';
130if (!empty($entity)) {
131 $urlok .=
'entity='.urlencode((
string) ($entity)).
'&';
132 $urlko .=
'entity='.urlencode((
string) ($entity)).
'&';
134$urlok = preg_replace(
'/&$/',
'', $urlok);
135$urlko = preg_replace(
'/&$/',
'', $urlko);
141 if ($source && !$ref) {
148if ($source ==
'proposal') {
150} elseif ($source ==
'contract') {
152} elseif ($source ==
'fichinter') {
154} elseif ($source ==
'societe_rib') {
157if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'0')) {
161if ($source ==
'proposal') {
162 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
164 $result =
$object->fetch(0, $ref,
'', $entity);
165} elseif ($source ==
'contract') {
166 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
168 $result =
$object->fetch(0, $ref);
169} elseif ($source ==
'fichinter') {
170 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
172 $result =
$object->fetch(0, $ref);
173} elseif ($source ==
'societe_rib') {
174 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
176 $result =
$object->fetch(0, $ref);
177} elseif ($source ==
'expedition') {
178 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
180 $result =
$object->fetch(0, $ref);
182 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
186$hookmanager->initHooks(array(
'onlinesign'));
195if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
198 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
199 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".$db->escape(
$object->note_private).
"', date_signature = '".$db->idate(
dol_now()).
"'";
200 $sql .=
" WHERE rowid = ".((int)
$object->id);
203 $resql = $db->query($sql);
211 $message =
'refused';
213 if (method_exists(
$object,
'call_trigger')) {
215 $user =
new User($db);
216 $user->fetch(
$object->user_validation_id);
217 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
218 $result =
$object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
237$form =
new Form($db);
241 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
244$conf->dol_hide_topmenu = 1;
245$conf->dol_hide_leftmenu = 1;
247$title = $langs->trans(
"OnlineSignature");
249$replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
250llxHeader($head, $title,
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
252htmlPrintOnlineHeader(
$mysoc, $langs, 1,
'',
'ONLINE_SIGN_IMAGE_PUBLIC_INTERFACE',
'ONLINE_SIGN_LOGO_'.$suffix,
'ONLINE_SIGN_LOGO');
254if ($action ==
'refusepropal') {
255 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);
259if ( in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
260 $langs->load(
"errors");
261 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
268print
'<span id="dolpaymentspan"></span>'.
"\n";
269print
'<div class="center">'.
"\n";
270print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
271print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
272print
'<input type="hidden" name="action" value="dosign">'.
"\n";
273print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
274print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
275print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
276print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
277print
'<input type="hidden" name="page_y" value="" />';
278print
'<input type="hidden" name="source" value="'.$source.
'" />';
279print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
281print
'<!-- Form to sign -->'.
"\n";
284 print
'<div class="backimagepublicproposalsign">';
285 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
289print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
295 if (preg_match(
'/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
296 $text .= $langs->trans($reg[1]).
"<br>\n";
300 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
303 if ($source ==
'proposal') {
304 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageProposal",
$mysoc->name).
'</strong></td></tr>'.
"\n";
305 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromProposal", $creditor).
'<br><br></td></tr>'.
"\n";
306 } elseif ($source ==
'contract') {
307 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageContract",
$mysoc->name).
'</strong></td></tr>'.
"\n";
308 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromContract", $creditor).
'<br><br></td></tr>'.
"\n";
309 } elseif ($source ==
'fichinter') {
310 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageFichinter",
$mysoc->name).
'</strong></td></tr>'.
"\n";
311 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
312 } elseif ($source ==
'expedition') {
313 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageExpedition",
$mysoc->name).
'</strong></td></tr>'.
"\n";
314 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromExpedition", $creditor).
'<br><br></td></tr>'.
"\n";
316 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source),
$mysoc->name).
'</strong></td></tr>'.
"\n";
317 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
323print
'<tr><td align="center">';
324print
'<table with="100%" id="tablepublicpayment">';
325if ($source ==
'proposal') {
326 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
' :</td></tr>'.
"\n";
327} elseif ($source ==
'contract') {
328 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
' :</td></tr>'.
"\n";
329} elseif ($source ==
'fichinter') {
330 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
' :</td></tr>'.
"\n";
331} elseif ($source ==
'expedition') {
332 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignExpedition").
' :</td></tr>'.
"\n";
334 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
' :</td></tr>'.
"\n";
340if ($source ==
'proposal') {
342 $langs->load(
"proposal");
347 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
348 print
'</td><td class="CTableRow2">';
349 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
350 print
'<b>'.$creditor.
'</b>';
351 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
352 print
'</td></tr>'.
"\n";
355 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
356 print
'</td><td class="CTableRow2">';
357 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
358 print
'<b>'.$object->thirdparty->name.
'</b>';
359 print
'</td></tr>'.
"\n";
363 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
364 $amount .=
'</td><td class="CTableRow2">';
367 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
369 $amount .=
'</td></tr>'.
"\n";
372 $parameters = array(
'source' => $source);
373 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters,
$object, $action);
374 if (empty($reshook)) {
375 $amount .= $hookmanager->resPrint;
376 } elseif ($reshook > 0) {
377 $amount = $hookmanager->resPrint;
383 $text =
'<b>'.$langs->trans(
"SignatureProposalRef",
$object->ref).
'</b>';
384 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
385 print
'</td><td class="CTableRow2">'.$text;
387 $last_main_doc_file =
$object->last_main_doc;
389 if (
$object->status == $object::STATUS_VALIDATED) {
390 $object->last_main_doc = preg_replace(
'/_signed-(\d+)/',
'',
$object->last_main_doc);
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.
'">';
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.
'">';
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");
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.
'">';
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(
"interventions");
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.
'">';
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(
"CreditorName");
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((
string)
$object->thirdparty->id).
'/';
563 if ((empty($last_main_doc_file) ||
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);
580 $directdownloadlink =
$object->getLastMainDocLink(
'company');
581 if ($directdownloadlink) {
582 print
'<br><a href="'.$directdownloadlink.
'">';
584 if ($message ==
"signed") {
585 print $langs->trans(
"DownloadSignedDocument").
'</a>';
587 print $langs->trans(
"DownloadDocument").
'</a>';
590} elseif ($source ==
'expedition') {
593 $langs->load(
"interventions");
598 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
599 print
'</td><td class="CTableRow2">';
600 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
601 print
'<b>'.$creditor.
'</b>';
602 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
603 print
'</td></tr>'.
"\n";
606 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
607 print
'</td><td class="CTableRow2">';
608 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
609 print
'<b>'.$object->thirdparty->name.
'</b>';
610 print
'</td></tr>'.
"\n";
613 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
614 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
615 print
'</td><td class="CTableRow2">'.$text;
617 $last_main_doc_file =
$object->last_main_doc;
618 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
621 $defaulttemplate =
'';
622 $object->generateDocument($defaulttemplate, $langs);
624 $directdownloadlink =
$object->getLastMainDocLink(
'', 0, 0);
625 if ($directdownloadlink) {
626 print
'<br><a href="'.$directdownloadlink.
'">';
628 if ($message ==
"signed") {
629 print $langs->trans(
"DownloadSignedDocument").
'</a>';
631 print $langs->trans(
"DownloadDocument").
'</a>';
634 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
635 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
636 print
'</td></tr>'.
"\n";
639 $langs->load(
'companies');
642 $result =
$object->fetch_thirdparty();
646 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
647 print
'</td><td class="CTableRow2">';
648 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
649 print
'<b>'.$creditor.
'</b>';
650 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
651 print
'</td></tr>'.
"\n";
654 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
655 print
'</td><td class="CTableRow2">';
656 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
657 print
'<b>'.$object->thirdparty->name.
'</b>';
658 print
'</td></tr>'.
"\n";
661 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref",
$object->ref).
'</b>';
662 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
663 print
'</td><td class="CTableRow2">'.$text;
665 $last_main_doc_file =
$object->last_main_doc;
667 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
670 $defaulttemplate =
'';
671 $object->generateDocument($defaulttemplate, $langs);
674 $directdownloadlink =
$object->getLastMainDocLink($source);
675 if ($directdownloadlink) {
676 print
'<br><a href="'.$directdownloadlink.
'">';
678 if ($message ==
"signed") {
679 print $langs->trans(
"DownloadSignedDocument").
'</a>';
681 print $langs->trans(
"DownloadDocument").
'</a>';
687$parameters = array(
'source' => $source);
688$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters,
$object, $action);
690if (!$found && !$mesg) {
691 $mesg = $langs->transnoentitiesnoconv(
"ErrorBadParameters");
695 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).
'</div></td></tr>'.
"\n";
698print
'</table>'.
"\n";
701if ($action !=
'dosign') {
702 if ($found && !$error) {
711print
'</td></tr>'.
"\n";
712print
'<tr><td class="center">';
715if ($action ==
"dosign" && empty($cancel)) {
717 print
'<div class="tablepublicpayment">';
718 print
'<input type="text" class="paddingleftonly marginleftonly paddingrightonly marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans(
"Lastname").
'" autofocus>';
719 print
'<div id="signature" style="border:solid;"></div>';
721 print
'<input type="button" class="small noborderbottom cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
725 print
'<input type="button" class="button marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
726 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
731 $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT;
736 $urltogo = $_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.(int) $entity :
'');
737 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jSignature/jSignature.js"></script>
738 <script type="text/javascript">
739 $(document).ready(function() {
740 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty($conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
742 $("#signature").on("change",function(){
743 $("#clearsignature").css("display","");
744 $("#signbutton").attr("disabled",false);
745 if(!$._data($("#signbutton")[0], "events")){
746 $("#signbutton").on("click",function(){
747 console.log("We click on button sign");
748 document.body.style.cursor = \'wait\';
749 var signature = $("#signature").jSignature("getData", "image");
750 var name = document.getElementById("name").value;
753 url: \''.DOL_URL_ROOT.
'/core/ajax/onlineSign.php\',
756 "action" : \'importSignature\',
758 "signaturebase64" : signature,
759 "onlinesignname" :
name,
760 "ref" : \
''.dol_escape_js($REF).
'\',
761 "securekey" : \
''.dol_escape_js($SECUREKEY).
'\',
762 "mode" : \
''.dol_escape_js($source).
'\',
763 "entity" : \
''.dol_escape_js((
string) $entity).
'\',
765 success:
function(response) {
766 if (response.trim() ===
"success") {
767 console.log(
"Success on saving signature");
770 document.body.style.cursor = \
'auto\';
771 console.error(response);
772 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
775 error: function(response) {
776 document.body.style.cursor = \'auto\';
777 console.error(response);
778 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
785 $("#clearsignature").on("click",function(){
786 $("#signature").jSignature("clear");
787 $("#signbutton").attr("disabled",true);
788 // document.getElementById("onlinesignname").value = "";
791 $("#signbutton").attr("disabled",true);
795 if ($source ==
'proposal') {
796 if (
$object->status == $object::STATUS_SIGNED) {
798 if ($message ==
'signed') {
799 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
800 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
802 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
803 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
805 } elseif (
$object->status == $object::STATUS_NOTSIGNED) {
807 if ($message ==
'refused') {
808 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
809 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
811 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
812 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
815 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
816 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
818 } elseif ($source ==
'contract') {
819 if ($message ==
'signed') {
820 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
822 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
824 } elseif ($source ==
'fichinter') {
825 if ($message ==
'signed') {
826 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
828 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
830 } elseif ($source ==
'expedition') {
831 if ($message ==
'signed' ||
$object->signed_status == Expedition::$SIGNED_STATUSES[
'STATUS_SIGNED_SENDER']) {
832 print
'<span class="ok">'.$langs->trans(
"ExpeditionSigned").
'</span>';
834 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignExpedition").
'">';
837 if ($message ==
'signed') {
838 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
840 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
844print
'</td></tr>'.
"\n";
845print
'</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.
Class to manage Dolibarr users.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
$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_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...