31if (!defined(
'NOLOGIN')) {
34if (!defined(
'NOCSRFCHECK')) {
35 define(
"NOCSRFCHECK", 1);
37if (!defined(
'NOIPCHECK')) {
38 define(
'NOIPCHECK',
'1');
40if (!defined(
'NOBROWSERNOTIF')) {
41 define(
'NOBROWSERNOTIF',
'1');
47$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
48if (is_numeric($entity)) {
49 define(
"DOLENTITY", $entity);
53require
'../../main.inc.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
62$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"errors",
"members",
"paybox",
"stripe",
"propal",
"commercial"));
68$action =
GETPOST(
'action',
'aZ09');
69$cancel =
GETPOST(
'cancel',
'alpha');
70$confirm =
GETPOST(
'confirm',
'alpha');
73$refusepropal =
GETPOST(
'refusepropal',
'alpha');
74$message =
GETPOST(
'message',
'aZ09');
83$suffix =
GETPOST(
"suffix",
'aZ09');
84$source =
GETPOST(
"source",
'alpha');
85$ref = $REF =
GETPOST(
"ref",
'alpha');
93if (!empty($refusepropal)) {
94 $action =
"refusepropal";
100$urlwithroot = DOL_MAIN_URL_ROOT;
104$SECUREKEY =
GETPOST(
"securekey");
106if (!empty($source)) {
107 $urlok .=
'source='.urlencode($source).
'&';
108 $urlko .=
'source='.urlencode($source).
'&';
111 $urlok .=
'ref='.urlencode($REF).
'&';
112 $urlko .=
'ref='.urlencode($REF).
'&';
114if (!empty($SECUREKEY)) {
115 $urlok .=
'securekey='.urlencode($SECUREKEY).
'&';
116 $urlko .=
'securekey='.urlencode($SECUREKEY).
'&';
118if (!empty($entity)) {
119 $urlok .=
'entity='.urlencode((
string) ($entity)).
'&';
120 $urlko .=
'entity='.urlencode((
string) ($entity)).
'&';
122$urlok = preg_replace(
'/&$/',
'', $urlok);
123$urlko = preg_replace(
'/&$/',
'', $urlko);
125$creditor = $mysoc->name;
129 if ($source && !$ref) {
136if ($source ==
'proposal') {
138} elseif ($source ==
'contract') {
140} elseif ($source ==
'fichinter') {
142} elseif ($source ==
'societe_rib') {
145if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'0')) {
149if ($source ==
'proposal') {
150 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
152 $result =
$object->fetch(0, $ref,
'', $entity);
153} elseif ($source ==
'contract') {
154 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
156 $result =
$object->fetch(0, $ref);
157} elseif ($source ==
'fichinter') {
158 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
160 $result =
$object->fetch(0, $ref);
161} elseif ($source ==
'societe_rib') {
162 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
164 $result =
$object->fetch(0, $ref);
165} elseif ($source ==
'expedition') {
166 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
168 $result =
$object->fetch(0, $ref);
170 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
174$hookmanager->initHooks(array(
'onlinesign'));
183if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
186 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
187 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".$db->escape(
$object->note_private).
"', date_signature='".$db->idate(
dol_now()).
"'";
188 $sql .=
" WHERE rowid = ".((int)
$object->id);
191 $resql = $db->query($sql);
199 $message =
'refused';
201 if (method_exists(
$object,
'call_trigger')) {
203 $user =
new User($db);
204 $user->fetch(
$object->user_validation_id);
205 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
206 $result =
$object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
225$form =
new Form($db);
228 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
231$conf->dol_hide_topmenu = 1;
232$conf->dol_hide_leftmenu = 1;
234$replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
235llxHeader($head, $langs->trans(
"OnlineSignature"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
237if ($action ==
'refusepropal') {
238 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);
242if (!empty($source) && in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
243 $langs->load(
"errors");
244 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
251print
'<span id="dolpaymentspan"></span>'.
"\n";
252print
'<div class="center">'.
"\n";
253print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
254print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
255print
'<input type="hidden" name="action" value="dosign">'.
"\n";
256print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
257print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
258print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
259print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
260print
'<input type="hidden" name="page_y" value="" />';
261print
'<input type="hidden" name="source" value="'.$source.
'" />';
262print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
264print
'<!-- Form to sign -->'.
"\n";
266print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
270$logosmall = $mysoc->logo_small;
272$paramlogo =
'ONLINE_SIGN_LOGO_'.$suffix;
273if (!empty($conf->global->$paramlogo)) {
282if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
283 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
284 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
285} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
286 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
287 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
291 print
'<div class="backgreypublicpayment">';
292 print
'<div class="logopublicpayment">';
293 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
297 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>';
302 print
'<div class="backimagepublicproposalsign">';
303 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
311 if (preg_match(
'/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
312 $text .= $langs->trans($reg[1]).
"<br>\n";
316 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
319 if ($source ==
'proposal') {
320 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageProposal", $mysoc->name).
'</strong></td></tr>'.
"\n";
321 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromProposal", $creditor).
'<br><br></td></tr>'.
"\n";
322 } elseif ($source ==
'contract') {
323 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageContract", $mysoc->name).
'</strong></td></tr>'.
"\n";
324 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromContract", $creditor).
'<br><br></td></tr>'.
"\n";
325 } elseif ($source ==
'fichinter') {
326 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageFichinter", $mysoc->name).
'</strong></td></tr>'.
"\n";
327 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
328 } elseif ($source ==
'expedition') {
329 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageExpedition", $mysoc->name).
'</strong></td></tr>'.
"\n";
330 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromExpedition", $creditor).
'<br><br></td></tr>'.
"\n";
332 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source), $mysoc->name).
'</strong></td></tr>'.
"\n";
333 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
339print
'<tr><td align="center">';
340print
'<table with="100%" id="tablepublicpayment">';
341if ($source ==
'proposal') {
342 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
' :</td></tr>'.
"\n";
343} elseif ($source ==
'contract') {
344 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
' :</td></tr>'.
"\n";
345} elseif ($source ==
'fichinter') {
346 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
' :</td></tr>'.
"\n";
347} elseif ($source ==
'expedition') {
348 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignExpedition").
' :</td></tr>'.
"\n";
350 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
' :</td></tr>'.
"\n";
356if ($source ==
'proposal') {
358 $langs->load(
"proposal");
363 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
364 print
'</td><td class="CTableRow2">';
365 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
366 print
'<b>'.$creditor.
'</b>';
367 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
368 print
'</td></tr>'.
"\n";
371 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
372 print
'</td><td class="CTableRow2">';
373 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
374 print
'<b>'.$object->thirdparty->name.
'</b>';
375 print
'</td></tr>'.
"\n";
379 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
380 $amount .=
'</td><td class="CTableRow2">';
381 $amount .=
'<b>'.price(
$object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).
'</b>';
382 if (
$object->multicurrency_code != $conf->currency) {
383 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
385 $amount .=
'</td></tr>'.
"\n";
388 $parameters = array(
'source' => $source);
389 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters,
$object, $action);
390 if (empty($reshook)) {
391 $amount .= $hookmanager->resPrint;
392 } elseif ($reshook > 0) {
393 $amount = $hookmanager->resPrint;
399 $text =
'<b>'.$langs->trans(
"SignatureProposalRef",
$object->ref).
'</b>';
400 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
401 print
'</td><td class="CTableRow2">'.$text;
403 $last_main_doc_file =
$object->last_main_doc;
405 if (
$object->status == $object::STATUS_VALIDATED) {
406 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
409 $defaulttemplate =
'';
410 $object->generateDocument($defaulttemplate, $langs);
413 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
414 if ($directdownloadlink) {
415 print
'<br><a href="'.$directdownloadlink.
'">';
417 print $langs->trans(
"DownloadDocument").
'</a>';
420 if (
$object->status == $object::STATUS_NOTSIGNED) {
421 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
422 if ($directdownloadlink) {
423 print
'<br><a href="'.$directdownloadlink.
'">';
424 print
img_mime($last_main_doc_file,
'');
425 print $langs->trans(
"DownloadDocument").
'</a>';
427 } elseif (
$object->status == $object::STATUS_SIGNED ||
$object->status == $object::STATUS_BILLED) {
428 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
429 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
432 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
434 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
435 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
436 if ($directdownloadlink) {
437 print
'<br><a href="'.$directdownloadlink.
'">';
439 print $langs->trans(
"DownloadDocument").
'</a>';
446 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
447 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
448 print
'</td></tr>'.
"\n";
449} elseif ($source ==
'contract') {
451 $langs->load(
"contract");
456 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
457 print
'</td><td class="CTableRow2">';
458 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
459 print
'<b>'.$creditor.
'</b>';
460 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
461 print
'</td></tr>'.
"\n";
464 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
465 print
'</td><td class="CTableRow2">';
466 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
467 print
'<b>'.$object->thirdparty->name.
'</b>';
468 print
'</td></tr>'.
"\n";
471 $text =
'<b>'.$langs->trans(
"SignatureContractRef",
$object->ref).
'</b>';
472 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
473 print
'</td><td class="CTableRow2">'.$text;
475 $last_main_doc_file =
$object->last_main_doc;
477 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
480 $defaulttemplate =
'';
481 $object->generateDocument($defaulttemplate, $langs);
484 $directdownloadlink =
$object->getLastMainDocLink(
'contract');
485 if ($directdownloadlink) {
486 print
'<br><a href="'.$directdownloadlink.
'">';
488 if ($message ==
"signed") {
489 print $langs->trans(
"DownloadSignedDocument").
'</a>';
491 print $langs->trans(
"DownloadDocument").
'</a>';
496 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
497 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
498 print
'</td></tr>'.
"\n";
499} elseif ($source ==
'fichinter') {
502 $langs->load(
"fichinter");
507 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
508 print
'</td><td class="CTableRow2">';
509 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
510 print
'<b>'.$creditor.
'</b>';
511 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
512 print
'</td></tr>'.
"\n";
515 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
516 print
'</td><td class="CTableRow2">';
517 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
518 print
'<b>'.$object->thirdparty->name.
'</b>';
519 print
'</td></tr>'.
"\n";
522 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
523 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
524 print
'</td><td class="CTableRow2">'.$text;
526 $last_main_doc_file =
$object->last_main_doc;
528 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
531 $defaulttemplate =
'';
532 $object->generateDocument($defaulttemplate, $langs);
535 $directdownloadlink =
$object->getLastMainDocLink(
'fichinter');
536 if ($directdownloadlink) {
537 print
'<br><a href="'.$directdownloadlink.
'">';
539 if ($message ==
"signed") {
540 print $langs->trans(
"DownloadSignedDocument").
'</a>';
542 print $langs->trans(
"DownloadDocument").
'</a>';
545 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
546 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
547 print
'</td></tr>'.
"\n";
548} elseif ($source ==
'societe_rib') {
550 $langs->loadLangs(array(
"companies",
"commercial",
"withdrawals"));
552 $result =
$object->fetch_thirdparty();
555 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Proposer");
556 print
'</td><td class="CTableRow2">';
557 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
558 print
'<b>' . $creditor .
'</b>';
559 print
'<input type="hidden" name="creditor" value="' . $creditor .
'">';
560 print
'</td></tr>' .
"\n";
563 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"ThirdParty");
564 print
'</td><td class="CTableRow2">';
565 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
566 print
'<b>' .
$object->thirdparty->name .
'</b>';
567 print
'</td></tr>' .
"\n";
570 $text =
'<b>' . $langs->trans(
"Signature" .
dol_ucfirst($source) .
"Ref",
$object->ref) .
'</b>';
571 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Designation");
572 print
'</td><td class="CTableRow2">' . $text;
574 $last_main_doc_file =
$object->last_main_doc;
575 $diroutput = $conf->societe->multidir_output[
$object->thirdparty->entity].
'/'
576 .dol_sanitizeFileName(
$object->thirdparty->id).
'/';
577 if ((empty($last_main_doc_file) ||
580 && $message !=
"signed") {
586 $object->setDocModel($user, $defaulttemplate);
588 'use_companybankid' =>
$object->id,
589 'force_dir_output' => $diroutput
591 $result =
$object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
594 $directdownloadlink =
$object->getLastMainDocLink(
'company');
595 if ($directdownloadlink) {
596 print
'<br><a href="'.$directdownloadlink.
'">';
598 if ($message ==
"signed") {
599 print $langs->trans(
"DownloadSignedDocument").
'</a>';
601 print $langs->trans(
"DownloadDocument").
'</a>';
604} elseif ($source ==
'expedition') {
607 $langs->load(
"fichinter");
612 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
613 print
'</td><td class="CTableRow2">';
614 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
615 print
'<b>'.$creditor.
'</b>';
616 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
617 print
'</td></tr>'.
"\n";
620 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
621 print
'</td><td class="CTableRow2">';
622 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
623 print
'<b>'.$object->thirdparty->name.
'</b>';
624 print
'</td></tr>'.
"\n";
627 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
628 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
629 print
'</td><td class="CTableRow2">'.$text;
631 $last_main_doc_file =
$object->last_main_doc;
632 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
635 $defaulttemplate =
'';
636 $object->generateDocument($defaulttemplate, $langs);
638 $directdownloadlink =
$object->getLastMainDocLink(
'', 0, 0);
639 if ($directdownloadlink) {
640 print
'<br><a href="'.$directdownloadlink.
'">';
642 if ($message ==
"signed") {
643 print $langs->trans(
"DownloadSignedDocument").
'</a>';
645 print $langs->trans(
"DownloadDocument").
'</a>';
648 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
649 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
650 print
'</td></tr>'.
"\n";
653 $langs->load(
'companies');
656 $result =
$object->fetch_thirdparty();
660 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
661 print
'</td><td class="CTableRow2">';
662 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
663 print
'<b>'.$creditor.
'</b>';
664 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
665 print
'</td></tr>'.
"\n";
668 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
669 print
'</td><td class="CTableRow2">';
670 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
671 print
'<b>'.$object->thirdparty->name.
'</b>';
672 print
'</td></tr>'.
"\n";
675 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref",
$object->ref).
'</b>';
676 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
677 print
'</td><td class="CTableRow2">'.$text;
679 $last_main_doc_file =
$object->last_main_doc;
681 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
684 $defaulttemplate =
'';
685 $object->generateDocument($defaulttemplate, $langs);
688 $directdownloadlink =
$object->getLastMainDocLink($source);
689 if ($directdownloadlink) {
690 print
'<br><a href="'.$directdownloadlink.
'">';
692 if ($message ==
"signed") {
693 print $langs->trans(
"DownloadSignedDocument").
'</a>';
695 print $langs->trans(
"DownloadDocument").
'</a>';
701$parameters = array(
'source' => $source);
702$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters,
$object, $action);
704if (!$found && !$mesg) {
705 $mesg = $langs->transnoentitiesnoconv(
"ErrorBadParameters");
709 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).
'</div></td></tr>'.
"\n";
712print
'</table>'.
"\n";
715if ($action !=
'dosign') {
716 if ($found && !$error) {
725print
'</td></tr>'.
"\n";
726print
'<tr><td class="center">';
729if ($action ==
"dosign" && empty($cancel)) {
731 print
'<div class="tablepublicpayment">';
732 print
'<input type="text" class="paddingleftonly marginleftonly paddingrightonly marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans(
"Lastname").
'" autofocus>';
733 print
'<div id="signature" style="border:solid;"></div>';
735 print
'<input type="button" class="small noborderbottom cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
739 print
'<input type="button" class="button marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
740 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
744 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jSignature/jSignature.js"></script>
745 <script type="text/javascript">
746 $(document).ready(function() {
747 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty($conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
749 $("#signature").on("change",function(){
750 $("#clearsignature").css("display","");
751 $("#signbutton").attr("disabled",false);
752 if(!$._data($("#signbutton")[0], "events")){
753 $("#signbutton").on("click",function(){
754 console.log("We click on button sign");
755 document.body.style.cursor = \'wait\';
756 /* $("#signbutton").val(\''.
dol_escape_js($langs->transnoentities(
'PleaseBePatient')).
'\'); */
757 var signature = $(
"#signature").jSignature(
"getData",
"image");
758 var
name = document.getElementById(
"name").value;
761 url:
"'.DOL_URL_ROOT.'/core/ajax/onlineSign.php",
764 "action" :
"importSignature",
765 "token" : \
''.newToken().
'\',
766 "signaturebase64" : signature,
767 "onlinesignname" :
name,
773 success: function(response) {
774 if (response.trim() === "success") {
775 console.log("Success on saving signature");
776 window.location.replace("'.$_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.(int) $entity :
'').
'");
778 document.body.style.cursor = \'auto\';
779 console.error(response);
780 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
783 error: function(response) {
784 document.body.style.cursor = \'auto\';
785 console.error(response);
786 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
793 $("#clearsignature").on("click",function(){
794 $("#signature").jSignature("clear");
795 $("#signbutton").attr("disabled",true);
796 // document.getElementById("onlinesignname").value = "";
799 $("#signbutton").attr("disabled",true);
803 if ($source ==
'proposal') {
804 if (
$object->status == $object::STATUS_SIGNED) {
806 if ($message ==
'signed') {
807 print
img_picto(
'',
'check',
'',
false, 0, 0,
'',
'size2x').
'<br>';
808 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
810 print
img_picto(
'',
'check',
'',
false, 0, 0,
'',
'size2x').
'<br>';
811 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
813 } elseif (
$object->status == $object::STATUS_NOTSIGNED) {
815 if ($message ==
'refused') {
816 print
img_picto(
'',
'cross',
'',
false, 0, 0,
'',
'size2x').
'<br>';
817 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
819 print
img_picto(
'',
'cross',
'',
false, 0, 0,
'',
'size2x').
'<br>';
820 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
823 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
824 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
826 } elseif ($source ==
'contract') {
827 if ($message ==
'signed') {
828 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
830 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
832 } elseif ($source ==
'fichinter') {
833 if ($message ==
'signed') {
834 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
836 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
838 } elseif ($source ==
'expedition') {
840 print
'<span class="ok">'.$langs->trans(
"ExpeditionSigned").
'</span>';
842 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignExpedition").
'">';
845 if ($message ==
'signed') {
846 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
848 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
852print
'</td></tr>'.
"\n";
853print
'</table>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 shipments.
const STATUS_SIGNED
Signed status.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_now($mode='auto')
Return date for now.
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.
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.
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,...