33if (!defined(
'NOLOGIN')) {
36if (!defined(
'NOCSRFCHECK')) {
37 define(
"NOCSRFCHECK", 1);
39if (!defined(
'NOIPCHECK')) {
40 define(
'NOIPCHECK',
'1');
42if (!defined(
'NOBROWSERNOTIF')) {
43 define(
'NOBROWSERNOTIF',
'1');
49$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
50if (is_numeric($entity)) {
51 define(
"DOLENTITY", $entity);
55require
'../../main.inc.php';
66require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
67require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
68require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
69require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
70require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
71require_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');
102 $source =
'proposal';
104if (!empty($refusepropal)) {
105 $action =
"refusepropal";
111$urlwithroot = DOL_MAIN_URL_ROOT;
115$SECUREKEY =
GETPOST(
"securekey");
117if (!empty($source)) {
118 $urlok .=
'source='.urlencode($source).
'&';
119 $urlko .=
'source='.urlencode($source).
'&';
122 $urlok .=
'ref='.urlencode($REF).
'&';
123 $urlko .=
'ref='.urlencode($REF).
'&';
125if (!empty($SECUREKEY)) {
126 $urlok .=
'securekey='.urlencode($SECUREKEY).
'&';
127 $urlko .=
'securekey='.urlencode($SECUREKEY).
'&';
129if (!empty($entity)) {
130 $urlok .=
'entity='.urlencode((
string) ($entity)).
'&';
131 $urlko .=
'entity='.urlencode((
string) ($entity)).
'&';
133$urlok = preg_replace(
'/&$/',
'', $urlok);
134$urlko = preg_replace(
'/&$/',
'', $urlko);
140 if ($source && !$ref) {
145global $dolibarr_main_instance_unique_id;
146$defaultsalt = substr(
dol_hash(
'dolibarr'.$dolibarr_main_instance_unique_id,
'sha256'), 0, 32);
150if ($source ==
'proposal') {
151 $securekeyseed =
getDolGlobalString(
'PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
152} elseif ($source ==
'contract') {
153 $securekeyseed =
getDolGlobalString(
'CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
154} elseif ($source ==
'fichinter') {
155 $securekeyseed =
getDolGlobalString(
'FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
156} elseif ($source ==
'societe_rib') {
157 $securekeyseed =
getDolGlobalString(
'SOCIETE_RIB_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
158} elseif ($source ==
'order') {
163if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'hash')) {
167if ($source ==
'proposal') {
168 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
170 $result =
$object->fetch(0, $ref,
'', $entity);
171} elseif ($source ==
'contract') {
172 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
174 $result =
$object->fetch(0, $ref);
175} elseif ($source ==
'fichinter') {
176 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
178 $result =
$object->fetch(0, $ref);
179} elseif ($source ==
'societe_rib') {
180 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
182 $result =
$object->fetch(0, $ref);
183} elseif ($source ==
'order') {
184 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
186 $result =
$object->fetch(0, $ref);
187} elseif ($source ==
'expedition') {
188 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
190 $result =
$object->fetch(0, $ref);
192 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
196$hookmanager->initHooks(array(
'onlinesign'));
205if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
208 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
209 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".$db->escape(
$object->note_private).
"', date_signature = '".$db->idate(
dol_now()).
"'";
210 $sql .=
" WHERE rowid = ".((int)
$object->id);
213 $resql = $db->query($sql);
221 $message =
'refused';
222 setEventMessages(
"PropalRefused",
null,
'warnings');
223 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
224 $result =
$object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
242$form =
new Form($db);
246 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
249$conf->dol_hide_topmenu = 1;
250$conf->dol_hide_leftmenu = 1;
252$title = $langs->trans(
"OnlineSignature");
254$replacemainarea = (empty(
$conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
255llxHeader($head, $title,
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
257htmlPrintOnlineHeader(
$mysoc, $langs, 1,
'',
'ONLINE_SIGN_IMAGE_PUBLIC_INTERFACE',
'ONLINE_SIGN_LOGO_'.$suffix,
'ONLINE_SIGN_LOGO');
259if ($action ==
'refusepropal') {
260 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);
264if ( in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
265 $langs->load(
"errors");
266 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
273print
'<span id="dolpaymentspan"></span>'.
"\n";
274print
'<div class="center">'.
"\n";
275print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
276print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
277print
'<input type="hidden" name="action" value="dosign">'.
"\n";
278print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
279print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
280print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
281print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
282print
'<input type="hidden" name="page_y" value="" />';
283print
'<input type="hidden" name="source" value="'.$source.
'" />';
284print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
286print
'<!-- Form to sign -->'.
"\n";
289 print
'<div class="backimagepublicproposalsign">';
290 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
294print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
300 if (preg_match(
'/^\((.*)\)$/',
$conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
301 $text .= $langs->trans($reg[1]).
"<br>\n";
305 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
308 if ($source ==
'proposal') {
309 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageProposal",
$mysoc->name).
'</strong></td></tr>'.
"\n";
310 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromProposal", $creditor).
'<br><br></td></tr>'.
"\n";
311 } elseif ($source ==
'contract') {
312 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageContract",
$mysoc->name).
'</strong></td></tr>'.
"\n";
313 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromContract", $creditor).
'<br><br></td></tr>'.
"\n";
314 } elseif ($source ==
'fichinter') {
315 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageFichinter",
$mysoc->name).
'</strong></td></tr>'.
"\n";
316 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
317 } elseif ($source ==
'expedition') {
318 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageExpedition",
$mysoc->name).
'</strong></td></tr>'.
"\n";
319 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromExpedition", $creditor).
'<br><br></td></tr>'.
"\n";
321 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source),
$mysoc->name).
'</strong></td></tr>'.
"\n";
322 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
328print
'<tr><td align="center">';
329print
'<table with="100%" id="tablepublicpayment">';
330if ($source ==
'proposal') {
331 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
'<br><br></td></tr>'.
"\n";
332} elseif ($source ==
'contract') {
333 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
'<br><br></td></tr>'.
"\n";
334} elseif ($source ==
'fichinter') {
335 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
'<br><br></td></tr>'.
"\n";
336} elseif ($source ==
'expedition') {
337 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignExpedition").
'<br><br></td></tr>'.
"\n";
339 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
'<br><br></td></tr>'.
"\n";
345if ($source ==
'proposal') {
347 $langs->load(
"proposal");
352 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
353 print
'</td><td class="CTableRow2">';
354 print img_picto(
'',
'company',
'class="pictofixedwidth"');
355 print
'<b>'.$creditor.
'</b>';
356 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
357 print
'</td></tr>'.
"\n";
360 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
361 print
'</td><td class="CTableRow2">';
362 print img_picto(
'',
'company',
'class="pictofixedwidth"');
363 print
'<b>'.$object->thirdparty->name.
'</b>';
364 print
'</td></tr>'.
"\n";
368 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
369 $amount .=
'</td><td class="CTableRow2">';
372 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
374 $amount .=
'</td></tr>'.
"\n";
377 $parameters = array(
'source' => $source);
378 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters,
$object, $action);
379 if (empty($reshook)) {
380 $amount .= $hookmanager->resPrint;
381 } elseif ($reshook > 0) {
382 $amount = $hookmanager->resPrint;
388 $text =
'<b>'.$langs->trans(
"SignatureProposalRef",
$object->ref).
'</b>';
389 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
390 print
'</td><td class="CTableRow2">'.$text;
392 $last_main_doc_file =
$object->last_main_doc;
394 if (
$object->status == $object::STATUS_VALIDATED) {
395 $object->last_main_doc = preg_replace(
'/_signed-(\d+)/',
'',
$object->last_main_doc);
397 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
400 $defaulttemplate =
'';
401 $object->generateDocument($defaulttemplate, $langs);
404 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
405 if ($directdownloadlink) {
406 print
'<br><a href="'.$directdownloadlink.
'">';
408 print $langs->trans(
"DownloadDocument").
'</a>';
411 if (
$object->status == $object::STATUS_NOTSIGNED) {
412 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
413 if ($directdownloadlink) {
414 print
'<br><a href="'.$directdownloadlink.
'">';
415 print
img_mime($last_main_doc_file,
'');
416 print $langs->trans(
"DownloadDocument").
'</a>';
418 } elseif (
$object->status == $object::STATUS_SIGNED ||
$object->status == $object::STATUS_BILLED) {
419 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
420 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
423 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
425 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
426 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
427 if ($directdownloadlink) {
428 print
'<br><a href="'.$directdownloadlink.
'">';
430 print $langs->trans(
"DownloadDocument").
'</a>';
437 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
438 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
439 print
'</td></tr>'.
"\n";
440} elseif ($source ==
'order') {
442 $langs->load(
"orders");
447 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
448 print
'</td><td class="CTableRow2">';
449 print img_picto(
'',
'company',
'class="pictofixedwidth"');
450 print
'<b>'.$creditor.
'</b>';
451 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
452 print
'</td></tr>'.
"\n";
455 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
456 print
'</td><td class="CTableRow2">';
457 print img_picto(
'',
'company',
'class="pictofixedwidth"');
458 print
'<b>'.$object->thirdparty->name.
'</b>';
459 print
'</td></tr>'.
"\n";
462 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
463 $amount .=
'</td><td class="CTableRow2">';
466 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
468 $amount .=
'</td></tr>'.
"\n";
473 $text =
'<b>'.$langs->trans(
"SignatureOrderRef",
$object->ref).
'</b>';
474 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
475 print
'</td><td class="CTableRow2">'.$text;
477 $last_main_doc_file =
$object->last_main_doc;
479 if (
$object->status == $object::STATUS_VALIDATED) {
480 $object->last_main_doc = preg_replace(
'/_signed-(\d+)/',
'',
$object->last_main_doc);
482 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
485 $defaulttemplate =
'';
486 $object->generateDocument($defaulttemplate, $langs);
489 $directdownloadlink =
$object->getLastMainDocLink(
'order');
490 if ($directdownloadlink) {
491 print
'<br><a href="'.$directdownloadlink.
'">';
493 print $langs->trans(
"DownloadDocument").
'</a>';
496 if (
$object->status == $object::STATUS_DRAFT) {
497 $directdownloadlink =
$object->getLastMainDocLink(
'order');
498 if ($directdownloadlink) {
499 print
'<br><a href="'.$directdownloadlink.
'">';
500 print
img_mime($last_main_doc_file,
'');
501 print $langs->trans(
"DownloadDocument").
'</a>';
504 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
505 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
508 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
510 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
511 $directdownloadlink =
$object->getLastMainDocLink(
'order');
512 if ($directdownloadlink) {
513 print
'<br><a href="'.$directdownloadlink.
'">';
515 print $langs->trans(
"DownloadDocument").
'</a>';
522 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
523 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
524 print
'</td></tr>'.
"\n";
525} elseif ($source ==
'contract') {
527 $langs->load(
"contract");
532 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
533 print
'</td><td class="CTableRow2">';
534 print img_picto(
'',
'company',
'class="pictofixedwidth"');
535 print
'<b>'.$creditor.
'</b>';
536 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
537 print
'</td></tr>'.
"\n";
540 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
541 print
'</td><td class="CTableRow2">';
542 print img_picto(
'',
'company',
'class="pictofixedwidth"');
543 print
'<b>'.$object->thirdparty->name.
'</b>';
544 print
'</td></tr>'.
"\n";
547 $text =
'<b>'.$langs->trans(
"SignatureContractRef",
$object->ref).
'</b>';
548 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
549 print
'</td><td class="CTableRow2">'.$text;
551 $last_main_doc_file =
$object->last_main_doc;
553 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
556 $defaulttemplate =
'';
557 $object->generateDocument($defaulttemplate, $langs);
560 $directdownloadlink =
$object->getLastMainDocLink(
'contract');
561 if ($directdownloadlink) {
562 print
'<br><a href="'.$directdownloadlink.
'">';
564 if ($message ==
"signed") {
565 print $langs->trans(
"DownloadSignedDocument").
'</a>';
567 print $langs->trans(
"DownloadDocument").
'</a>';
572 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
573 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
574 print
'</td></tr>'.
"\n";
575} elseif ($source ==
'fichinter') {
578 $langs->load(
"interventions");
583 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
584 print
'</td><td class="CTableRow2">';
585 print img_picto(
'',
'company',
'class="pictofixedwidth"');
586 print
'<b>'.$creditor.
'</b>';
587 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
588 print
'</td></tr>'.
"\n";
591 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
592 print
'</td><td class="CTableRow2">';
593 print img_picto(
'',
'company',
'class="pictofixedwidth"');
594 print
'<b>'.$object->thirdparty->name.
'</b>';
595 print
'</td></tr>'.
"\n";
598 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
599 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
600 print
'</td><td class="CTableRow2">'.$text;
602 $last_main_doc_file =
$object->last_main_doc;
604 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
607 $defaulttemplate =
'';
608 $object->generateDocument($defaulttemplate, $langs);
611 $directdownloadlink =
$object->getLastMainDocLink(
'fichinter');
612 if ($directdownloadlink) {
613 print
'<br><a href="'.$directdownloadlink.
'">';
615 if ($message ==
"signed") {
616 print $langs->trans(
"DownloadSignedDocument").
'</a>';
618 print $langs->trans(
"DownloadDocument").
'</a>';
621 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
622 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
623 print
'</td></tr>'.
"\n";
624} elseif ($source ==
'societe_rib') {
626 $langs->loadLangs(array(
"companies",
"commercial",
"withdrawals"));
628 $result =
$object->fetch_thirdparty();
631 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"CreditorName");
632 print
'</td><td class="CTableRow2">';
633 print img_picto(
'',
'company',
'class="pictofixedwidth"');
634 print
'<b>' . $creditor .
'</b>';
635 print
'<input type="hidden" name="creditor" value="' . $creditor .
'">';
636 print
'</td></tr>' .
"\n";
639 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"ThirdParty");
640 print
'</td><td class="CTableRow2">';
641 print img_picto(
'',
'company',
'class="pictofixedwidth"');
642 print
'<b>' .
$object->thirdparty->name .
'</b>';
643 print
'</td></tr>' .
"\n";
646 $text =
'<b>' . $langs->trans(
"Signature" .
dol_ucfirst($source) .
"Ref",
$object->ref) .
'</b>';
647 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Designation");
648 print
'</td><td class="CTableRow2">' . $text;
650 $last_main_doc_file =
$object->last_main_doc;
651 $diroutput =
$conf->societe->multidir_output[
$object->thirdparty->entity].
'/'
652 .dol_sanitizeFileName((
string)
$object->thirdparty->id).
'/';
653 if ((empty($last_main_doc_file) ||
656 && $message !=
"signed") {
662 $object->setDocModel($user, $defaulttemplate);
664 'use_companybankid' =>
$object->id,
665 'force_dir_output' => $diroutput
667 $result =
$object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
670 $directdownloadlink =
$object->getLastMainDocLink(
'company');
671 if ($directdownloadlink) {
672 print
'<br><a href="'.$directdownloadlink.
'">';
674 if ($message ==
"signed") {
675 print $langs->trans(
"DownloadSignedDocument").
'</a>';
677 print $langs->trans(
"DownloadDocument").
'</a>';
680} elseif ($source ==
'expedition') {
683 $langs->load(
"interventions");
688 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
689 print
'</td><td class="CTableRow2">';
690 print img_picto(
'',
'company',
'class="pictofixedwidth"');
691 print
'<b>'.$creditor.
'</b>';
692 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
693 print
'</td></tr>'.
"\n";
696 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
697 print
'</td><td class="CTableRow2">';
698 print img_picto(
'',
'company',
'class="pictofixedwidth"');
699 print
'<b>'.$object->thirdparty->name.
'</b>';
700 print
'</td></tr>'.
"\n";
703 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
704 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
705 print
'</td><td class="CTableRow2">'.$text;
707 $last_main_doc_file =
$object->last_main_doc;
708 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
711 $defaulttemplate =
'';
712 $object->generateDocument($defaulttemplate, $langs);
714 $directdownloadlink =
$object->getLastMainDocLink(
'', 0, 0);
715 if ($directdownloadlink) {
716 print
'<br><a href="'.$directdownloadlink.
'">';
718 if ($message ==
"signed") {
719 print $langs->trans(
"DownloadSignedDocument").
'</a>';
721 print $langs->trans(
"DownloadDocument").
'</a>';
724 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
725 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
726 print
'</td></tr>'.
"\n";
729 $langs->load(
'companies');
732 $result =
$object->fetch_thirdparty();
736 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
737 print
'</td><td class="CTableRow2">';
738 print img_picto(
'',
'company',
'class="pictofixedwidth"');
739 print
'<b>'.$creditor.
'</b>';
740 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
741 print
'</td></tr>'.
"\n";
744 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
745 print
'</td><td class="CTableRow2">';
746 print img_picto(
'',
'company',
'class="pictofixedwidth"');
747 print
'<b>'.$object->thirdparty->name.
'</b>';
748 print
'</td></tr>'.
"\n";
751 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref",
$object->ref).
'</b>';
752 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
753 print
'</td><td class="CTableRow2">'.$text;
755 $last_main_doc_file =
$object->last_main_doc;
757 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
760 $defaulttemplate =
'';
761 $object->generateDocument($defaulttemplate, $langs);
764 $directdownloadlink =
$object->getLastMainDocLink($source);
765 if ($directdownloadlink) {
766 print
'<br><a href="'.$directdownloadlink.
'">';
768 if ($message ==
"signed") {
769 print $langs->trans(
"DownloadSignedDocument").
'</a>';
771 print $langs->trans(
"DownloadDocument").
'</a>';
777$parameters = array(
'source' => $source);
778$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters,
$object, $action);
781 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($langs->transnoentitiesnoconv(
"ErrorBadParameters")).
'</div></td></tr>'.
"\n";
784print
'</table>'.
"\n";
787if ($action !=
'dosign') {
788 if ($found && !$error) {
797print
'</td></tr>'.
"\n";
798print
'<tr><td class="center">';
801if ($action ==
"dosign" && empty($cancel)) {
803 print
'<div class="tablepublicpayment">';
804 print
'<input type="text" class="paddingleftonly marginleftonly paddingright marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans(
"Lastname").
'" spellcheck="false" autofocus>';
805 print
'<div id="signature" style="border:solid;"></div>';
807 print
'<input type="button" class="small noborderall cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
811 print
'<input type="button" class="button butActionSign marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
812 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
817 $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT;
822 $urltogo = $_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.(int) $entity :
'');
823 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/public/includes/jquery/plugins/jSignature/jSignature.js"></script>
824 <script type="text/javascript">
825 $(document).ready(function() {
826 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty(
$conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
828 $("#signature").on("change",function(){
829 $("#clearsignature").css("display","");
830 $("#signbutton").attr("disabled",false);
831 if(!$._data($("#signbutton")[0], "events")){
832 $("#signbutton").on("click",function(){
833 console.log("We click on button sign");
834 document.body.style.cursor = \'wait\';
835 var signature = $("#signature").jSignature("getData", "image");
836 var name = document.getElementById("name").value;
839 url: \''.DOL_URL_ROOT.
'/core/ajax/onlineSign.php\',
842 "action" : \'importSignature\',
844 "signaturebase64" : signature,
845 "onlinesignname" :
name,
846 "ref" : \
''.dol_escape_js($REF).
'\',
847 "securekey" : \
''.dol_escape_js($SECUREKEY).
'\',
848 "mode" : \
''.dol_escape_js($source).
'\',
849 "entity" : \
''.dol_escape_js((
string) $entity).
'\',
851 success:
function(response) {
852 if (response.trim() ===
"success") {
853 console.log(
"Success on saving signature");
856 document.body.style.cursor = \
'auto\';
857 console.error(response);
858 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
861 error: function(response) {
862 document.body.style.cursor = \'auto\';
863 console.error(response);
864 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
871 $("#clearsignature").on("click",function(){
872 $("#signature").jSignature("clear");
873 $("#signbutton").attr("disabled",true);
874 // document.getElementById("onlinesignname").value = "";
877 $("#signbutton").attr("disabled",true);
881 if ($source ==
'proposal') {
882 if (
$object->status == $object::STATUS_SIGNED) {
884 if ($message ==
'signed') {
885 print img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
886 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
888 print img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
889 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
891 } elseif (
$object->status == $object::STATUS_NOTSIGNED) {
893 if ($message ==
'refused') {
894 print img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
895 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
897 print img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
898 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
901 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
902 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
904 } elseif ($source ==
'contract') {
905 if ($message ==
'signed') {
906 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
908 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
910 } elseif ($source ==
'fichinter') {
911 if ($message ==
'signed') {
912 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
914 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
916 } elseif ($source ==
'expedition') {
917 if ($message ==
'signed' ||
$object->signed_status == Expedition::$SIGNED_STATUSES[
'STATUS_SIGNED_SENDER']) {
918 print
'<span class="ok">'.$langs->trans(
"ExpeditionSigned").
'</span>';
920 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignExpedition").
'">';
923 if ($message ==
'signed') {
924 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
926 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
930print
'</td></tr>'.
"\n";
931print
'</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 customers orders.
Class to manage bank accounts description of third parties.
Class to manage proposals.
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML public pages.
dol_filemtime($pathoffile)
Return time of a file.
dol_is_file($pathoffile)
Return if path is a file.
dol_now($mode='gmt')
Return date for now.
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_strtoupper($string, $encoding="UTF-8")
Convert a string to upper.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
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.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
$conf db name
Only used if Module[ID]Name translation string is not found.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...