29if (!defined(
'NOLOGIN')) {
32if (!defined(
'NOCSRFCHECK')) {
33 define(
"NOCSRFCHECK", 1);
35if (!defined(
'NOIPCHECK')) {
36 define(
'NOIPCHECK',
'1');
38if (!defined(
'NOBROWSERNOTIF')) {
39 define(
'NOBROWSERNOTIF',
'1');
45$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
46if (is_numeric($entity)) {
47 define(
"DOLENTITY", $entity);
51require
'../../main.inc.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
60$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"errors",
"members",
"paybox",
"stripe",
"propal",
"commercial"));
66$action =
GETPOST(
'action',
'aZ09');
67$cancel =
GETPOST(
'cancel',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
71$refusepropal =
GETPOST(
'refusepropal',
'alpha');
72$message =
GETPOST(
'message',
'aZ09');
81$suffix =
GETPOST(
"suffix",
'aZ09');
82$source =
GETPOST(
"source",
'alpha');
83$ref = $REF =
GETPOST(
"ref",
'alpha');
91if (!empty($refusepropal)) {
92 $action =
"refusepropal";
98$urlwithroot = DOL_MAIN_URL_ROOT;
102$SECUREKEY =
GETPOST(
"securekey");
104if (!empty($source)) {
105 $urlok .=
'source='.urlencode($source).
'&';
106 $urlko .=
'source='.urlencode($source).
'&';
109 $urlok .=
'ref='.urlencode($REF).
'&';
110 $urlko .=
'ref='.urlencode($REF).
'&';
112if (!empty($SECUREKEY)) {
113 $urlok .=
'securekey='.urlencode($SECUREKEY).
'&';
114 $urlko .=
'securekey='.urlencode($SECUREKEY).
'&';
116if (!empty($entity)) {
117 $urlok .=
'entity='.urlencode((
string) ($entity)).
'&';
118 $urlko .=
'entity='.urlencode((
string) ($entity)).
'&';
120$urlok = preg_replace(
'/&$/',
'', $urlok);
121$urlko = preg_replace(
'/&$/',
'', $urlko);
123$creditor = $mysoc->name;
127 if ($source && !$ref) {
134if ($source ==
'proposal') {
136} elseif ($source ==
'contract') {
138} elseif ($source ==
'fichinter') {
140} elseif ($source ==
'societe_rib') {
143if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'0')) {
147if ($source ==
'proposal') {
148 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
150 $result =
$object->fetch(0, $ref,
'', $entity);
151} elseif ($source ==
'contract') {
152 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
154 $result =
$object->fetch(0, $ref);
155} elseif ($source ==
'fichinter') {
156 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
158 $result =
$object->fetch(0, $ref);
159} elseif ($source ==
'societe_rib') {
160 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
162 $result =
$object->fetch(0, $ref);
163} elseif ($source ==
'expedition') {
164 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
166 $result =
$object->fetch(0, $ref);
168 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
172$hookmanager->initHooks(array(
'onlinesign'));
181if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
184 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
185 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".$db->escape(
$object->note_private).
"', date_signature='".$db->idate(
dol_now()).
"'";
186 $sql .=
" WHERE rowid = ".((int)
$object->id);
189 $resql = $db->query($sql);
197 $message =
'refused';
199 if (method_exists(
$object,
'call_trigger')) {
201 $user =
new User($db);
202 $user->fetch(
$object->user_validation_id);
203 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
204 $result =
$object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
223$form =
new Form($db);
226 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
229$conf->dol_hide_topmenu = 1;
230$conf->dol_hide_leftmenu = 1;
232$replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
233llxHeader($head, $langs->trans(
"OnlineSignature"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
235if ($action ==
'refusepropal') {
236 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);
240if (!empty($source) && in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
241 $langs->load(
"errors");
242 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
249print
'<span id="dolpaymentspan"></span>'.
"\n";
250print
'<div class="center">'.
"\n";
251print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
252print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
253print
'<input type="hidden" name="action" value="dosign">'.
"\n";
254print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
255print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
256print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
257print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
258print
'<input type="hidden" name="page_y" value="" />';
259print
'<input type="hidden" name="source" value="'.$source.
'" />';
260print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
262print
'<!-- Form to sign -->'.
"\n";
264print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
268$logosmall = $mysoc->logo_small;
270$paramlogo =
'ONLINE_SIGN_LOGO_'.$suffix;
280if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
281 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
282 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
283} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
284 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
285 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
289 print
'<div class="backgreypublicpayment">';
290 print
'<div class="logopublicpayment">';
291 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
295 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>';
300 print
'<div class="backimagepublicproposalsign">';
301 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
309 if (preg_match(
'/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
310 $text .= $langs->trans($reg[1]).
"<br>\n";
314 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
317 if ($source ==
'proposal') {
318 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageProposal", $mysoc->name).
'</strong></td></tr>'.
"\n";
319 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromProposal", $creditor).
'<br><br></td></tr>'.
"\n";
320 } elseif ($source ==
'contract') {
321 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageContract", $mysoc->name).
'</strong></td></tr>'.
"\n";
322 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromContract", $creditor).
'<br><br></td></tr>'.
"\n";
323 } elseif ($source ==
'fichinter') {
324 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageFichinter", $mysoc->name).
'</strong></td></tr>'.
"\n";
325 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
326 } elseif ($source ==
'expedition') {
327 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageExpedition", $mysoc->name).
'</strong></td></tr>'.
"\n";
328 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromExpedition", $creditor).
'<br><br></td></tr>'.
"\n";
330 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source), $mysoc->name).
'</strong></td></tr>'.
"\n";
331 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
337print
'<tr><td align="center">';
338print
'<table with="100%" id="tablepublicpayment">';
339if ($source ==
'proposal') {
340 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
' :</td></tr>'.
"\n";
341} elseif ($source ==
'contract') {
342 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
' :</td></tr>'.
"\n";
343} elseif ($source ==
'fichinter') {
344 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
' :</td></tr>'.
"\n";
345} elseif ($source ==
'expedition') {
346 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignExpedition").
' :</td></tr>'.
"\n";
348 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
' :</td></tr>'.
"\n";
354if ($source ==
'proposal') {
356 $langs->load(
"proposal");
361 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
362 print
'</td><td class="CTableRow2">';
363 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
364 print
'<b>'.$creditor.
'</b>';
365 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
366 print
'</td></tr>'.
"\n";
369 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
370 print
'</td><td class="CTableRow2">';
371 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
372 print
'<b>'.$object->thirdparty->name.
'</b>';
373 print
'</td></tr>'.
"\n";
377 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
378 $amount .=
'</td><td class="CTableRow2">';
379 $amount .=
'<b>'.price(
$object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).
'</b>';
380 if (
$object->multicurrency_code != $conf->currency) {
381 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
383 $amount .=
'</td></tr>'.
"\n";
386 $parameters = array(
'source' => $source);
387 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters,
$object, $action);
388 if (empty($reshook)) {
389 $amount .= $hookmanager->resPrint;
390 } elseif ($reshook > 0) {
391 $amount = $hookmanager->resPrint;
397 $text =
'<b>'.$langs->trans(
"SignatureProposalRef",
$object->ref).
'</b>';
398 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
399 print
'</td><td class="CTableRow2">'.$text;
401 $last_main_doc_file =
$object->last_main_doc;
403 if (
$object->status == $object::STATUS_VALIDATED) {
404 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
407 $defaulttemplate =
'';
408 $object->generateDocument($defaulttemplate, $langs);
411 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
412 if ($directdownloadlink) {
413 print
'<br><a href="'.$directdownloadlink.
'">';
415 print $langs->trans(
"DownloadDocument").
'</a>';
418 if (
$object->status == $object::STATUS_NOTSIGNED) {
419 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
420 if ($directdownloadlink) {
421 print
'<br><a href="'.$directdownloadlink.
'">';
422 print
img_mime($last_main_doc_file,
'');
423 print $langs->trans(
"DownloadDocument").
'</a>';
425 } elseif (
$object->status == $object::STATUS_SIGNED ||
$object->status == $object::STATUS_BILLED) {
426 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
427 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
430 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
432 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
433 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
434 if ($directdownloadlink) {
435 print
'<br><a href="'.$directdownloadlink.
'">';
437 print $langs->trans(
"DownloadDocument").
'</a>';
444 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
445 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
446 print
'</td></tr>'.
"\n";
447} elseif ($source ==
'contract') {
449 $langs->load(
"contract");
454 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
455 print
'</td><td class="CTableRow2">';
456 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
457 print
'<b>'.$creditor.
'</b>';
458 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
459 print
'</td></tr>'.
"\n";
462 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
463 print
'</td><td class="CTableRow2">';
464 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
465 print
'<b>'.$object->thirdparty->name.
'</b>';
466 print
'</td></tr>'.
"\n";
469 $text =
'<b>'.$langs->trans(
"SignatureContractRef",
$object->ref).
'</b>';
470 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
471 print
'</td><td class="CTableRow2">'.$text;
473 $last_main_doc_file =
$object->last_main_doc;
475 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
478 $defaulttemplate =
'';
479 $object->generateDocument($defaulttemplate, $langs);
482 $directdownloadlink =
$object->getLastMainDocLink(
'contract');
483 if ($directdownloadlink) {
484 print
'<br><a href="'.$directdownloadlink.
'">';
486 if ($message ==
"signed") {
487 print $langs->trans(
"DownloadSignedDocument").
'</a>';
489 print $langs->trans(
"DownloadDocument").
'</a>';
494 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
495 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
496 print
'</td></tr>'.
"\n";
497} elseif ($source ==
'fichinter') {
500 $langs->load(
"interventions");
505 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
506 print
'</td><td class="CTableRow2">';
507 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
508 print
'<b>'.$creditor.
'</b>';
509 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
510 print
'</td></tr>'.
"\n";
513 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
514 print
'</td><td class="CTableRow2">';
515 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
516 print
'<b>'.$object->thirdparty->name.
'</b>';
517 print
'</td></tr>'.
"\n";
520 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
521 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
522 print
'</td><td class="CTableRow2">'.$text;
524 $last_main_doc_file =
$object->last_main_doc;
526 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
529 $defaulttemplate =
'';
530 $object->generateDocument($defaulttemplate, $langs);
533 $directdownloadlink =
$object->getLastMainDocLink(
'fichinter');
534 if ($directdownloadlink) {
535 print
'<br><a href="'.$directdownloadlink.
'">';
537 if ($message ==
"signed") {
538 print $langs->trans(
"DownloadSignedDocument").
'</a>';
540 print $langs->trans(
"DownloadDocument").
'</a>';
543 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
544 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
545 print
'</td></tr>'.
"\n";
546} elseif ($source ==
'societe_rib') {
548 $langs->loadLangs(array(
"companies",
"commercial",
"withdrawals"));
550 $result =
$object->fetch_thirdparty();
553 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Proposer");
554 print
'</td><td class="CTableRow2">';
555 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
556 print
'<b>' . $creditor .
'</b>';
557 print
'<input type="hidden" name="creditor" value="' . $creditor .
'">';
558 print
'</td></tr>' .
"\n";
561 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"ThirdParty");
562 print
'</td><td class="CTableRow2">';
563 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
564 print
'<b>' .
$object->thirdparty->name .
'</b>';
565 print
'</td></tr>' .
"\n";
568 $text =
'<b>' . $langs->trans(
"Signature" .
dol_ucfirst($source) .
"Ref",
$object->ref) .
'</b>';
569 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Designation");
570 print
'</td><td class="CTableRow2">' . $text;
572 $last_main_doc_file =
$object->last_main_doc;
573 $diroutput = $conf->societe->multidir_output[
$object->thirdparty->entity].
'/'
574 .dol_sanitizeFileName(
$object->thirdparty->id).
'/';
575 if ((empty($last_main_doc_file) ||
578 && $message !=
"signed") {
584 $object->setDocModel($user, $defaulttemplate);
586 'use_companybankid' =>
$object->id,
587 'force_dir_output' => $diroutput
589 $result =
$object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
592 $directdownloadlink =
$object->getLastMainDocLink(
'company');
593 if ($directdownloadlink) {
594 print
'<br><a href="'.$directdownloadlink.
'">';
596 if ($message ==
"signed") {
597 print $langs->trans(
"DownloadSignedDocument").
'</a>';
599 print $langs->trans(
"DownloadDocument").
'</a>';
602} elseif ($source ==
'expedition') {
605 $langs->load(
"interventions");
610 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
611 print
'</td><td class="CTableRow2">';
612 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
613 print
'<b>'.$creditor.
'</b>';
614 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
615 print
'</td></tr>'.
"\n";
618 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
619 print
'</td><td class="CTableRow2">';
620 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
621 print
'<b>'.$object->thirdparty->name.
'</b>';
622 print
'</td></tr>'.
"\n";
625 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
626 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
627 print
'</td><td class="CTableRow2">'.$text;
629 $last_main_doc_file =
$object->last_main_doc;
630 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
633 $defaulttemplate =
'';
634 $object->generateDocument($defaulttemplate, $langs);
636 $directdownloadlink =
$object->getLastMainDocLink(
'', 0, 0);
637 if ($directdownloadlink) {
638 print
'<br><a href="'.$directdownloadlink.
'">';
640 if ($message ==
"signed") {
641 print $langs->trans(
"DownloadSignedDocument").
'</a>';
643 print $langs->trans(
"DownloadDocument").
'</a>';
646 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
647 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
648 print
'</td></tr>'.
"\n";
651 $langs->load(
'companies');
654 $result =
$object->fetch_thirdparty();
658 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
659 print
'</td><td class="CTableRow2">';
660 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
661 print
'<b>'.$creditor.
'</b>';
662 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
663 print
'</td></tr>'.
"\n";
666 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
667 print
'</td><td class="CTableRow2">';
668 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
669 print
'<b>'.$object->thirdparty->name.
'</b>';
670 print
'</td></tr>'.
"\n";
673 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref",
$object->ref).
'</b>';
674 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
675 print
'</td><td class="CTableRow2">'.$text;
677 $last_main_doc_file =
$object->last_main_doc;
679 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
682 $defaulttemplate =
'';
683 $object->generateDocument($defaulttemplate, $langs);
686 $directdownloadlink =
$object->getLastMainDocLink($source);
687 if ($directdownloadlink) {
688 print
'<br><a href="'.$directdownloadlink.
'">';
690 if ($message ==
"signed") {
691 print $langs->trans(
"DownloadSignedDocument").
'</a>';
693 print $langs->trans(
"DownloadDocument").
'</a>';
699$parameters = array(
'source' => $source);
700$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters,
$object, $action);
702if (!$found && !$mesg) {
703 $mesg = $langs->transnoentitiesnoconv(
"ErrorBadParameters");
707 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).
'</div></td></tr>'.
"\n";
710print
'</table>'.
"\n";
713if ($action !=
'dosign') {
714 if ($found && !$error) {
723print
'</td></tr>'.
"\n";
724print
'<tr><td class="center">';
727if ($action ==
"dosign" && empty($cancel)) {
729 print
'<div class="tablepublicpayment">';
730 print
'<input type="text" class="paddingleftonly marginleftonly paddingrightonly marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans(
"Lastname").
'" autofocus>';
731 print
'<div id="signature" style="border:solid;"></div>';
733 print
'<input type="button" class="small noborderbottom cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
737 print
'<input type="button" class="button marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
738 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
742 $urltogo = $_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.(int) $entity :
'');
743 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jSignature/jSignature.js"></script>
744 <script type="text/javascript">
745 $(document).ready(function() {
746 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty($conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
748 $("#signature").on("change",function(){
749 $("#clearsignature").css("display","");
750 $("#signbutton").attr("disabled",false);
751 if(!$._data($("#signbutton")[0], "events")){
752 $("#signbutton").on("click",function(){
753 console.log("We click on button sign");
754 document.body.style.cursor = \'wait\';
755 /* $("#signbutton").val(\''.
dol_escape_js($langs->transnoentities(
'PleaseBePatient')).
'\'); */
756 var signature = $(
"#signature").jSignature(
"getData",
"image");
757 var
name = document.getElementById(
"name").value;
760 url: \
''.DOL_URL_ROOT.
'/core/ajax/onlineSign.php\',
763 "action" : \'importSignature\',
765 "signaturebase64" : signature,
766 "onlinesignname" :
name,
767 "ref" : \
''.dol_escape_js($REF).
'\',
768 "securekey" : \
''.dol_escape_js($SECUREKEY).
'\',
769 "mode" : \
''.dol_escape_js($source).
'\',
770 "entity" : \
''.dol_escape_js((
string) $entity).
'\',
772 success:
function(response) {
773 if (response.trim() ===
"success") {
774 console.log(
"Success on saving signature");
777 document.body.style.cursor = \
'auto\';
778 console.error(response);
779 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
782 error: function(response) {
783 document.body.style.cursor = \'auto\';
784 console.error(response);
785 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
792 $("#clearsignature").on("click",function(){
793 $("#signature").jSignature("clear");
794 $("#signbutton").attr("disabled",true);
795 // document.getElementById("onlinesignname").value = "";
798 $("#signbutton").attr("disabled",true);
802 if ($source ==
'proposal') {
803 if (
$object->status == $object::STATUS_SIGNED) {
805 if ($message ==
'signed') {
806 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
807 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
809 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
810 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
812 } elseif (
$object->status == $object::STATUS_NOTSIGNED) {
814 if ($message ==
'refused') {
815 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
816 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
818 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
819 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
822 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
823 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
825 } elseif ($source ==
'contract') {
826 if ($message ==
'signed') {
827 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
829 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
831 } elseif ($source ==
'fichinter') {
832 if ($message ==
'signed') {
833 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
835 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
837 } elseif ($source ==
'expedition') {
838 if ($message ==
'signed' ||
$object->signed_status == Expedition::$SIGNED_STATUSES[
'STATUS_SIGNED_SENDER']) {
839 print
'<span class="ok">'.$langs->trans(
"ExpeditionSigned").
'</span>';
841 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignExpedition").
'">';
844 if ($message ==
'signed') {
845 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
847 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
851print
'</td></tr>'.
"\n";
852print
'</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($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.
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.
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)
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a 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,...