32if (!defined(
'NOLOGIN')) {
35if (!defined(
'NOCSRFCHECK')) {
36 define(
"NOCSRFCHECK", 1);
38if (!defined(
'NOIPCHECK')) {
39 define(
'NOIPCHECK',
'1');
41if (!defined(
'NOBROWSERNOTIF')) {
42 define(
'NOBROWSERNOTIF',
'1');
48$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
49if (is_numeric($entity)) {
50 define(
"DOLENTITY", $entity);
54require
'../../main.inc.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
59require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
72$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"errors",
"members",
"paybox",
"stripe",
"propal",
"commercial"));
78$action =
GETPOST(
'action',
'aZ09');
79$cancel =
GETPOST(
'cancel',
'alpha');
80$confirm =
GETPOST(
'confirm',
'alpha');
83$refusepropal =
GETPOST(
'refusepropal',
'alpha');
84$message =
GETPOST(
'message',
'aZ09');
93$suffix =
GETPOST(
"suffix",
'aZ09');
94$source =
GETPOST(
"source",
'alpha');
95$ref = $REF =
GETPOST(
"ref",
'alpha');
101 $source =
'proposal';
103if (!empty($refusepropal)) {
104 $action =
"refusepropal";
110$urlwithroot = DOL_MAIN_URL_ROOT;
114$SECUREKEY =
GETPOST(
"securekey");
116if (!empty($source)) {
117 $urlok .=
'source='.urlencode($source).
'&';
118 $urlko .=
'source='.urlencode($source).
'&';
121 $urlok .=
'ref='.urlencode($REF).
'&';
122 $urlko .=
'ref='.urlencode($REF).
'&';
124if (!empty($SECUREKEY)) {
125 $urlok .=
'securekey='.urlencode($SECUREKEY).
'&';
126 $urlko .=
'securekey='.urlencode($SECUREKEY).
'&';
128if (!empty($entity)) {
129 $urlok .=
'entity='.urlencode((
string) ($entity)).
'&';
130 $urlko .=
'entity='.urlencode((
string) ($entity)).
'&';
132$urlok = preg_replace(
'/&$/',
'', $urlok);
133$urlko = preg_replace(
'/&$/',
'', $urlko);
135$creditor = $mysoc->name;
139 if ($source && !$ref) {
146if ($source ==
'proposal') {
148} elseif ($source ==
'contract') {
150} elseif ($source ==
'fichinter') {
152} elseif ($source ==
'societe_rib') {
155if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'0')) {
159if ($source ==
'proposal') {
160 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
162 $result =
$object->fetch(0, $ref,
'', $entity);
163} elseif ($source ==
'contract') {
164 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
166 $result =
$object->fetch(0, $ref);
167} elseif ($source ==
'fichinter') {
168 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
170 $result =
$object->fetch(0, $ref);
171} elseif ($source ==
'societe_rib') {
172 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
174 $result =
$object->fetch(0, $ref);
175} elseif ($source ==
'expedition') {
176 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
178 $result =
$object->fetch(0, $ref);
180 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
184$hookmanager->initHooks(array(
'onlinesign'));
193if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
196 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
197 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".$db->escape(
$object->note_private).
"', date_signature = '".$db->idate(
dol_now()).
"'";
198 $sql .=
" WHERE rowid = ".((int)
$object->id);
201 $resql = $db->query($sql);
209 $message =
'refused';
211 if (method_exists(
$object,
'call_trigger')) {
213 $user =
new User($db);
214 $user->fetch(
$object->user_validation_id);
215 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
216 $result =
$object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
235$form =
new Form($db);
239 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
242$conf->dol_hide_topmenu = 1;
243$conf->dol_hide_leftmenu = 1;
245$title = $langs->trans(
"OnlineSignature");
247$replacemainarea = (empty(
$conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
248llxHeader($head, $title,
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
252if ($action ==
'refusepropal') {
253 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);
257if (!empty($source) && in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
258 $langs->load(
"errors");
259 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
266print
'<span id="dolpaymentspan"></span>'.
"\n";
267print
'<div class="center">'.
"\n";
268print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
269print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
270print
'<input type="hidden" name="action" value="dosign">'.
"\n";
271print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
272print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
273print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
274print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
275print
'<input type="hidden" name="page_y" value="" />';
276print
'<input type="hidden" name="source" value="'.$source.
'" />';
277print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
279print
'<!-- Form to sign -->'.
"\n";
281print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
284 print
'<div class="backimagepublicproposalsign">';
285 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
293 if (preg_match(
'/^\((.*)\)$/',
$conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
294 $text .= $langs->trans($reg[1]).
"<br>\n";
298 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
301 if ($source ==
'proposal') {
302 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageProposal", $mysoc->name).
'</strong></td></tr>'.
"\n";
303 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromProposal", $creditor).
'<br><br></td></tr>'.
"\n";
304 } elseif ($source ==
'contract') {
305 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageContract", $mysoc->name).
'</strong></td></tr>'.
"\n";
306 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromContract", $creditor).
'<br><br></td></tr>'.
"\n";
307 } elseif ($source ==
'fichinter') {
308 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageFichinter", $mysoc->name).
'</strong></td></tr>'.
"\n";
309 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
310 } elseif ($source ==
'expedition') {
311 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageExpedition", $mysoc->name).
'</strong></td></tr>'.
"\n";
312 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromExpedition", $creditor).
'<br><br></td></tr>'.
"\n";
314 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source), $mysoc->name).
'</strong></td></tr>'.
"\n";
315 $text .=
'<tr><td class="textpublicpayment opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
321print
'<tr><td align="center">';
322print
'<table with="100%" id="tablepublicpayment">';
323if ($source ==
'proposal') {
324 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
' :</td></tr>'.
"\n";
325} elseif ($source ==
'contract') {
326 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
' :</td></tr>'.
"\n";
327} elseif ($source ==
'fichinter') {
328 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
' :</td></tr>'.
"\n";
329} elseif ($source ==
'expedition') {
330 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignExpedition").
' :</td></tr>'.
"\n";
332 print
'<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
' :</td></tr>'.
"\n";
338if ($source ==
'proposal') {
340 $langs->load(
"proposal");
345 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
346 print
'</td><td class="CTableRow2">';
347 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
348 print
'<b>'.$creditor.
'</b>';
349 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
350 print
'</td></tr>'.
"\n";
353 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
354 print
'</td><td class="CTableRow2">';
355 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
356 print
'<b>'.$object->thirdparty->name.
'</b>';
357 print
'</td></tr>'.
"\n";
361 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
362 $amount .=
'</td><td class="CTableRow2">';
363 $amount .=
'<b>'.price(
$object->total_ttc, 0, $langs, 1, -1, -1,
$conf->currency).
'</b>';
365 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
367 $amount .=
'</td></tr>'.
"\n";
370 $parameters = array(
'source' => $source);
371 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters,
$object, $action);
372 if (empty($reshook)) {
373 $amount .= $hookmanager->resPrint;
374 } elseif ($reshook > 0) {
375 $amount = $hookmanager->resPrint;
381 $text =
'<b>'.$langs->trans(
"SignatureProposalRef",
$object->ref).
'</b>';
382 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
383 print
'</td><td class="CTableRow2">'.$text;
385 $last_main_doc_file =
$object->last_main_doc;
387 if (
$object->status == $object::STATUS_VALIDATED) {
388 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
391 $defaulttemplate =
'';
392 $object->generateDocument($defaulttemplate, $langs);
395 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
396 if ($directdownloadlink) {
397 print
'<br><a href="'.$directdownloadlink.
'">';
399 print $langs->trans(
"DownloadDocument").
'</a>';
402 if (
$object->status == $object::STATUS_NOTSIGNED) {
403 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
404 if ($directdownloadlink) {
405 print
'<br><a href="'.$directdownloadlink.
'">';
406 print
img_mime($last_main_doc_file,
'');
407 print $langs->trans(
"DownloadDocument").
'</a>';
409 } elseif (
$object->status == $object::STATUS_SIGNED ||
$object->status == $object::STATUS_BILLED) {
410 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
411 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
414 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
416 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
417 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
418 if ($directdownloadlink) {
419 print
'<br><a href="'.$directdownloadlink.
'">';
421 print $langs->trans(
"DownloadDocument").
'</a>';
428 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
429 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
430 print
'</td></tr>'.
"\n";
431} elseif ($source ==
'contract') {
433 $langs->load(
"contract");
438 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
439 print
'</td><td class="CTableRow2">';
440 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
441 print
'<b>'.$creditor.
'</b>';
442 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
443 print
'</td></tr>'.
"\n";
446 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
447 print
'</td><td class="CTableRow2">';
448 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
449 print
'<b>'.$object->thirdparty->name.
'</b>';
450 print
'</td></tr>'.
"\n";
453 $text =
'<b>'.$langs->trans(
"SignatureContractRef",
$object->ref).
'</b>';
454 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
455 print
'</td><td class="CTableRow2">'.$text;
457 $last_main_doc_file =
$object->last_main_doc;
459 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
462 $defaulttemplate =
'';
463 $object->generateDocument($defaulttemplate, $langs);
466 $directdownloadlink =
$object->getLastMainDocLink(
'contract');
467 if ($directdownloadlink) {
468 print
'<br><a href="'.$directdownloadlink.
'">';
470 if ($message ==
"signed") {
471 print $langs->trans(
"DownloadSignedDocument").
'</a>';
473 print $langs->trans(
"DownloadDocument").
'</a>';
478 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
479 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
480 print
'</td></tr>'.
"\n";
481} elseif ($source ==
'fichinter') {
484 $langs->load(
"interventions");
489 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
490 print
'</td><td class="CTableRow2">';
491 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
492 print
'<b>'.$creditor.
'</b>';
493 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
494 print
'</td></tr>'.
"\n";
497 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
498 print
'</td><td class="CTableRow2">';
499 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
500 print
'<b>'.$object->thirdparty->name.
'</b>';
501 print
'</td></tr>'.
"\n";
504 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
505 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
506 print
'</td><td class="CTableRow2">'.$text;
508 $last_main_doc_file =
$object->last_main_doc;
510 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
513 $defaulttemplate =
'';
514 $object->generateDocument($defaulttemplate, $langs);
517 $directdownloadlink =
$object->getLastMainDocLink(
'fichinter');
518 if ($directdownloadlink) {
519 print
'<br><a href="'.$directdownloadlink.
'">';
521 if ($message ==
"signed") {
522 print $langs->trans(
"DownloadSignedDocument").
'</a>';
524 print $langs->trans(
"DownloadDocument").
'</a>';
527 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
528 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
529 print
'</td></tr>'.
"\n";
530} elseif ($source ==
'societe_rib') {
532 $langs->loadLangs(array(
"companies",
"commercial",
"withdrawals"));
534 $result =
$object->fetch_thirdparty();
537 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Proposer");
538 print
'</td><td class="CTableRow2">';
539 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
540 print
'<b>' . $creditor .
'</b>';
541 print
'<input type="hidden" name="creditor" value="' . $creditor .
'">';
542 print
'</td></tr>' .
"\n";
545 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"ThirdParty");
546 print
'</td><td class="CTableRow2">';
547 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
548 print
'<b>' .
$object->thirdparty->name .
'</b>';
549 print
'</td></tr>' .
"\n";
552 $text =
'<b>' . $langs->trans(
"Signature" .
dol_ucfirst($source) .
"Ref",
$object->ref) .
'</b>';
553 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Designation");
554 print
'</td><td class="CTableRow2">' . $text;
556 $last_main_doc_file =
$object->last_main_doc;
557 $diroutput =
$conf->societe->multidir_output[
$object->thirdparty->entity].
'/'
558 .dol_sanitizeFileName((
string)
$object->thirdparty->id).
'/';
559 if ((empty($last_main_doc_file) ||
562 && $message !=
"signed") {
568 $object->setDocModel($user, $defaulttemplate);
570 'use_companybankid' =>
$object->id,
571 'force_dir_output' => $diroutput
573 $result =
$object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
576 $directdownloadlink =
$object->getLastMainDocLink(
'company');
577 if ($directdownloadlink) {
578 print
'<br><a href="'.$directdownloadlink.
'">';
580 if ($message ==
"signed") {
581 print $langs->trans(
"DownloadSignedDocument").
'</a>';
583 print $langs->trans(
"DownloadDocument").
'</a>';
586} elseif ($source ==
'expedition') {
589 $langs->load(
"interventions");
594 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
595 print
'</td><td class="CTableRow2">';
596 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
597 print
'<b>'.$creditor.
'</b>';
598 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
599 print
'</td></tr>'.
"\n";
602 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
603 print
'</td><td class="CTableRow2">';
604 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
605 print
'<b>'.$object->thirdparty->name.
'</b>';
606 print
'</td></tr>'.
"\n";
609 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
610 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
611 print
'</td><td class="CTableRow2">'.$text;
613 $last_main_doc_file =
$object->last_main_doc;
614 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
617 $defaulttemplate =
'';
618 $object->generateDocument($defaulttemplate, $langs);
620 $directdownloadlink =
$object->getLastMainDocLink(
'', 0, 0);
621 if ($directdownloadlink) {
622 print
'<br><a href="'.$directdownloadlink.
'">';
624 if ($message ==
"signed") {
625 print $langs->trans(
"DownloadSignedDocument").
'</a>';
627 print $langs->trans(
"DownloadDocument").
'</a>';
630 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
631 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
632 print
'</td></tr>'.
"\n";
635 $langs->load(
'companies');
638 $result =
$object->fetch_thirdparty();
642 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
643 print
'</td><td class="CTableRow2">';
644 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
645 print
'<b>'.$creditor.
'</b>';
646 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
647 print
'</td></tr>'.
"\n";
650 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
651 print
'</td><td class="CTableRow2">';
652 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
653 print
'<b>'.$object->thirdparty->name.
'</b>';
654 print
'</td></tr>'.
"\n";
657 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref",
$object->ref).
'</b>';
658 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
659 print
'</td><td class="CTableRow2">'.$text;
661 $last_main_doc_file =
$object->last_main_doc;
663 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
666 $defaulttemplate =
'';
667 $object->generateDocument($defaulttemplate, $langs);
670 $directdownloadlink =
$object->getLastMainDocLink($source);
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>';
683$parameters = array(
'source' => $source);
684$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters,
$object, $action);
686if (!$found && !$mesg) {
687 $mesg = $langs->transnoentitiesnoconv(
"ErrorBadParameters");
691 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($mesg).
'</div></td></tr>'.
"\n";
694print
'</table>'.
"\n";
697if ($action !=
'dosign') {
698 if ($found && !$error) {
707print
'</td></tr>'.
"\n";
708print
'<tr><td class="center">';
711if ($action ==
"dosign" && empty($cancel)) {
713 print
'<div class="tablepublicpayment">';
714 print
'<input type="text" class="paddingleftonly marginleftonly paddingrightonly marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans(
"Lastname").
'" autofocus>';
715 print
'<div id="signature" style="border:solid;"></div>';
717 print
'<input type="button" class="small noborderbottom cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
721 print
'<input type="button" class="button marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
722 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
726 $urltogo = $_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.(int) $entity :
'');
727 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/includes/jquery/plugins/jSignature/jSignature.js"></script>
728 <script type="text/javascript">
729 $(document).ready(function() {
730 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty(
$conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
732 $("#signature").on("change",function(){
733 $("#clearsignature").css("display","");
734 $("#signbutton").attr("disabled",false);
735 if(!$._data($("#signbutton")[0], "events")){
736 $("#signbutton").on("click",function(){
737 console.log("We click on button sign");
738 document.body.style.cursor = \'wait\';
739 /* $("#signbutton").val(\''.
dol_escape_js($langs->transnoentities(
'PleaseBePatient')).
'\'); */
740 var signature = $(
"#signature").jSignature(
"getData",
"image");
741 var
name = document.getElementById(
"name").value;
744 url: \
''.DOL_URL_ROOT.
'/core/ajax/onlineSign.php\',
747 "action" : \'importSignature\',
749 "signaturebase64" : signature,
750 "onlinesignname" :
name,
751 "ref" : \
''.dol_escape_js($REF).
'\',
752 "securekey" : \
''.dol_escape_js($SECUREKEY).
'\',
753 "mode" : \
''.dol_escape_js($source).
'\',
754 "entity" : \
''.dol_escape_js((
string) $entity).
'\',
756 success:
function(response) {
757 if (response.trim() ===
"success") {
758 console.log(
"Success on saving signature");
761 document.body.style.cursor = \
'auto\';
762 console.error(response);
763 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
766 error: function(response) {
767 document.body.style.cursor = \'auto\';
768 console.error(response);
769 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
776 $("#clearsignature").on("click",function(){
777 $("#signature").jSignature("clear");
778 $("#signbutton").attr("disabled",true);
779 // document.getElementById("onlinesignname").value = "";
782 $("#signbutton").attr("disabled",true);
786 if ($source ==
'proposal') {
787 if (
$object->status == $object::STATUS_SIGNED) {
789 if ($message ==
'signed') {
790 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
791 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
793 print
img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
794 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
796 } elseif (
$object->status == $object::STATUS_NOTSIGNED) {
798 if ($message ==
'refused') {
799 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
800 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
802 print
img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
803 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
806 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
807 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
809 } elseif ($source ==
'contract') {
810 if ($message ==
'signed') {
811 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
813 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
815 } elseif ($source ==
'fichinter') {
816 if ($message ==
'signed') {
817 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
819 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
821 } elseif ($source ==
'expedition') {
822 if ($message ==
'signed' ||
$object->signed_status == Expedition::$SIGNED_STATUSES[
'STATUS_SIGNED_SENDER']) {
823 print
'<span class="ok">'.$langs->trans(
"ExpeditionSigned").
'</span>';
825 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignExpedition").
'">';
828 if ($message ==
'signed') {
829 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
831 print
'<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
835print
'</td></tr>'.
"\n";
836print
'</table>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts description of third parties.
Class to manage proposals.
Class to manage Dolibarr users.
htmlPrintOnlineHeader($mysoc, $langs, $suffix='')
Show header of 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_ucfirst($string, $encoding="UTF-8")
Convert first character of the first word of a string to upper.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_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, $includequotes=0)
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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,...