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",
"members",
"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) {
141 $langs->load(
'errors');
146global $dolibarr_main_instance_unique_id;
147$defaultsalt = substr(
dol_hash(
'dolibarr'.$dolibarr_main_instance_unique_id,
'sha256'), 0, 32);
151if ($source ==
'proposal') {
152 $securekeyseed =
getDolGlobalString(
'PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
153} elseif ($source ==
'contract') {
154 $securekeyseed =
getDolGlobalString(
'CONTRACT_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
155} elseif ($source ==
'fichinter') {
156 $securekeyseed =
getDolGlobalString(
'FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
157} elseif ($source ==
'societe_rib') {
158 $securekeyseed =
getDolGlobalString(
'SOCIETE_RIB_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
159} elseif ($source ==
'order') {
160 $securekeyseed =
getDolGlobalString(
'ORDER_ONLINE_SIGNATURE_SECURITY_TOKEN', $defaultsalt);
164if (!
dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled(
'multicompany') ? $entity :
''), $SECUREKEY,
'hash')) {
168if ($source ==
'proposal') {
169 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
171 $result =
$object->fetch(0, $ref,
'', $entity);
172} elseif ($source ==
'contract') {
173 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
175 $result =
$object->fetch(0, $ref);
176} elseif ($source ==
'fichinter') {
177 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
179 $result =
$object->fetch(0, $ref);
180} elseif ($source ==
'societe_rib') {
181 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
183 $result =
$object->fetch(0, $ref);
184} elseif ($source ==
'order') {
185 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
187 $result =
$object->fetch(0, $ref);
188} elseif ($source ==
'expedition') {
189 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
191 $result =
$object->fetch(0, $ref);
193 $langs->load(
'errors');
194 httponly_accessforbidden($langs->trans(
'ErrorBadParameters').
" - Bad value for source. Value not supported.", 400, 1);
198$hookmanager->initHooks(array(
'onlinesign'));
207if ($action ==
'confirm_refusepropal' && $confirm ==
'yes') {
210 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"propal";
211 $sql .=
" SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).
", note_private = '".$db->escape((
string)
$object->note_private).
"', date_signature = '".$db->idate(
dol_now()).
"'";
212 $sql .=
" WHERE rowid = ".((int)
$object->id);
215 $resql = $db->query($sql);
223 $message =
'refused';
224 setEventMessages(
"PropalRefused",
null,
'warnings');
225 $object->context = array(
'closedfromonlinesignature' =>
'closedfromonlinesignature');
226 $result =
$object->call_trigger(
'PROPAL_CLOSE_REFUSED', $user);
244$form =
new Form($db);
248 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_SIGN_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
251$conf->dol_hide_topmenu = 1;
252$conf->dol_hide_leftmenu = 1;
254$title = $langs->trans(
"OnlineSignature");
256$replacemainarea = (empty(
$conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
257llxHeader($head, $title,
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1);
259htmlPrintOnlineHeader(
$mysoc, $langs, 1,
'',
'ONLINE_SIGN_IMAGE_PUBLIC_INTERFACE',
'ONLINE_SIGN_LOGO_'.$suffix,
'ONLINE_SIGN_LOGO');
261if ($action ==
'refusepropal') {
262 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);
266if ( in_array($ref, array(
'member_ref',
'contractline_ref',
'invoice_ref',
'order_ref',
'proposal_ref',
''))) {
267 $langs->load(
"errors");
268 dol_print_error_email(
'BADREFINONLINESIGNFORM', $langs->trans(
"ErrorBadLinkSourceSetButBadValueForRef", $source, $ref));
275print
'<span id="dolpaymentspan"></span>'.
"\n";
276print
'<div class="center">'.
"\n";
277print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
278print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
279print
'<input type="hidden" name="action" value="dosign">'.
"\n";
280print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
281print
'<input type="hidden" name="suffix" value="'.GETPOST(
"suffix",
'alpha').
'">'.
"\n";
282print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
283print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
284print
'<input type="hidden" name="page_y" value="" />';
285print
'<input type="hidden" name="source" value="'.$source.
'" />';
286print
'<input type="hidden" name="ref" value="'.$ref.
'" />';
288print
'<!-- Form to sign -->'.
"\n";
291 print
'<div class="backimagepublicproposalsign">';
292 print
'<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'PROPOSAL_IMAGE_PUBLIC_SIGN').
'">';
296print
'<table id="dolpublictable" summary="Payment form" class="center">'.
"\n";
302 if (preg_match(
'/^\((.*)\)$/',
$conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) {
303 $text .= $langs->trans($reg[1]).
"<br>\n";
307 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
310 if ($source ==
'proposal') {
311 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageProposal",
$mysoc->name).
'</strong></td></tr>'.
"\n";
312 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromProposal", $creditor).
'<br><br></td></tr>'.
"\n";
313 } elseif ($source ==
'contract') {
314 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageContract",
$mysoc->name).
'</strong></td></tr>'.
"\n";
315 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromContract", $creditor).
'<br><br></td></tr>'.
"\n";
316 } elseif ($source ==
'fichinter') {
317 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageFichinter",
$mysoc->name).
'</strong></td></tr>'.
"\n";
318 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromFichinter", $creditor).
'<br><br></td></tr>'.
"\n";
319 } elseif ($source ==
'expedition') {
320 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePageExpedition",
$mysoc->name).
'</strong></td></tr>'.
"\n";
321 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFromExpedition", $creditor).
'<br><br></td></tr>'.
"\n";
323 $text .=
'<tr><td class="textpublicpayment"><br><strong>'.$langs->trans(
"WelcomeOnOnlineSignaturePage".
dol_ucfirst($source),
$mysoc->name).
'</strong></td></tr>'.
"\n";
324 $text .=
'<tr><td class="textpublicpayment small opacitymedium">'.$langs->trans(
"ThisScreenAllowsYouToSignDocFrom".
dol_ucfirst($source), $creditor).
'<br><br></td></tr>'.
"\n";
330print
'<tr><td align="center">';
331print
'<table with="100%" id="tablepublicpayment">';
332if ($source ==
'proposal') {
333 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignProposal").
'<br><br></td></tr>'.
"\n";
334} elseif ($source ==
'contract') {
335 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignContract").
'<br><br></td></tr>'.
"\n";
336} elseif ($source ==
'fichinter') {
337 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignFichinter").
'<br><br></td></tr>'.
"\n";
338} elseif ($source ==
'expedition') {
339 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSignExpedition").
'<br><br></td></tr>'.
"\n";
341 print
'<tr><td colspan="2" class="left small opacitymedium">'.$langs->trans(
"ThisIsInformationOnDocumentToSign".
dol_ucfirst($source)).
'<br><br></td></tr>'.
"\n";
347if ($source ==
'proposal') {
349 $langs->load(
"proposal");
354 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
355 print
'</td><td class="CTableRow2">';
356 print img_picto(
'',
'company',
'class="pictofixedwidth"');
357 print
'<b>'.$creditor.
'</b>';
358 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
359 print
'</td></tr>'.
"\n";
362 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
363 print
'</td><td class="CTableRow2">';
364 print img_picto(
'',
'company',
'class="pictofixedwidth"');
365 print
'<b>'.$object->thirdparty->name.
'</b>';
366 print
'</td></tr>'.
"\n";
370 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
371 $amount .=
'</td><td class="CTableRow2">';
374 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
376 $amount .=
'</td></tr>'.
"\n";
379 $parameters = array(
'source' => $source);
380 $reshook = $hookmanager->executeHooks(
'amountPropalSign', $parameters,
$object, $action);
381 if (empty($reshook)) {
382 $amount .= $hookmanager->resPrint;
383 } elseif ($reshook > 0) {
384 $amount = $hookmanager->resPrint;
390 $text =
'<b>'.$langs->trans(
"SignatureProposalRef",
$object->ref).
'</b>';
391 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
392 print
'</td><td class="CTableRow2">'.$text;
394 $last_main_doc_file =
$object->last_main_doc;
396 if (
$object->status == $object::STATUS_VALIDATED) {
397 $object->last_main_doc = preg_replace(
'/_signed-(\d+)/',
'',
$object->last_main_doc);
399 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
402 $defaulttemplate =
'';
403 $object->generateDocument($defaulttemplate, $langs);
406 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
407 if ($directdownloadlink) {
408 print
'<br><a href="'.$directdownloadlink.
'">';
410 print $langs->trans(
"DownloadDocument").
'</a>';
413 if (
$object->status == $object::STATUS_NOTSIGNED) {
414 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
415 if ($directdownloadlink) {
416 print
'<br><a href="'.$directdownloadlink.
'">';
417 print
img_mime($last_main_doc_file,
'');
418 print $langs->trans(
"DownloadDocument").
'</a>';
420 } elseif (
$object->status == $object::STATUS_SIGNED ||
$object->status == $object::STATUS_BILLED) {
421 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
422 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
425 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
427 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
428 $directdownloadlink =
$object->getLastMainDocLink(
'proposal');
429 if ($directdownloadlink) {
430 print
'<br><a href="'.$directdownloadlink.
'">';
432 print $langs->trans(
"DownloadDocument").
'</a>';
439 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
440 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
441 print
'</td></tr>'.
"\n";
442} elseif ($source ==
'order') {
444 $langs->load(
"orders");
449 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Creditor");
450 print
'</td><td class="CTableRow2">';
451 print img_picto(
'',
'company',
'class="pictofixedwidth"');
452 print
'<b>'.$creditor.
'</b>';
453 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
454 print
'</td></tr>'.
"\n";
457 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
458 print
'</td><td class="CTableRow2">';
459 print img_picto(
'',
'company',
'class="pictofixedwidth"');
460 print
'<b>'.$object->thirdparty->name.
'</b>';
461 print
'</td></tr>'.
"\n";
464 $amount =
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Amount");
465 $amount .=
'</td><td class="CTableRow2">';
468 $amount .=
' ('.price(
$object->multicurrency_total_ttc, 0, $langs, 1, -1, -1,
$object->multicurrency_code).
')';
470 $amount .=
'</td></tr>'.
"\n";
475 $text =
'<b>'.$langs->trans(
"SignatureOrderRef",
$object->ref).
'</b>';
476 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
477 print
'</td><td class="CTableRow2">'.$text;
479 $last_main_doc_file =
$object->last_main_doc;
481 if (
$object->status == $object::STATUS_VALIDATED) {
482 $object->last_main_doc = preg_replace(
'/_signed-(\d+)/',
'',
$object->last_main_doc);
484 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
487 $defaulttemplate =
'';
488 $object->generateDocument($defaulttemplate, $langs);
491 $directdownloadlink =
$object->getLastMainDocLink(
'order');
492 if ($directdownloadlink) {
493 print
'<br><a href="'.$directdownloadlink.
'">';
495 print $langs->trans(
"DownloadDocument").
'</a>';
498 if (
$object->status == $object::STATUS_DRAFT) {
499 $directdownloadlink =
$object->getLastMainDocLink(
'order');
500 if ($directdownloadlink) {
501 print
'<br><a href="'.$directdownloadlink.
'">';
502 print
img_mime($last_main_doc_file,
'');
503 print $langs->trans(
"DownloadDocument").
'</a>';
506 if (preg_match(
'/_signed-(\d+)/', $last_main_doc_file)) {
507 $last_main_doc_file_not_signed = preg_replace(
'/_signed-(\d+)/',
'', $last_main_doc_file);
510 $datefilenotsigned =
dol_filemtime($last_main_doc_file_not_signed);
512 if (empty($datefilenotsigned) || $datefilesigned > $datefilenotsigned) {
513 $directdownloadlink =
$object->getLastMainDocLink(
'order');
514 if ($directdownloadlink) {
515 print
'<br><a href="'.$directdownloadlink.
'">';
517 print $langs->trans(
"DownloadDocument").
'</a>';
524 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
525 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
526 print
'</td></tr>'.
"\n";
527} elseif ($source ==
'contract') {
529 $langs->load(
"contract");
534 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
535 print
'</td><td class="CTableRow2">';
536 print img_picto(
'',
'company',
'class="pictofixedwidth"');
537 print
'<b>'.$creditor.
'</b>';
538 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
539 print
'</td></tr>'.
"\n";
542 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
543 print
'</td><td class="CTableRow2">';
544 print img_picto(
'',
'company',
'class="pictofixedwidth"');
545 print
'<b>'.$object->thirdparty->name.
'</b>';
546 print
'</td></tr>'.
"\n";
549 $text =
'<b>'.$langs->trans(
"SignatureContractRef",
$object->ref).
'</b>';
550 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
551 print
'</td><td class="CTableRow2">'.$text;
553 $last_main_doc_file =
$object->last_main_doc;
555 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
558 $defaulttemplate =
'';
559 $object->generateDocument($defaulttemplate, $langs);
562 $directdownloadlink =
$object->getLastMainDocLink(
'contract');
563 if ($directdownloadlink) {
564 print
'<br><a href="'.$directdownloadlink.
'">';
566 if ($message ==
"signed") {
567 print $langs->trans(
"DownloadSignedDocument").
'</a>';
569 print $langs->trans(
"DownloadDocument").
'</a>';
574 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
575 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
576 print
'</td></tr>'.
"\n";
577} elseif ($source ==
'fichinter') {
580 $langs->load(
"interventions");
585 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
586 print
'</td><td class="CTableRow2">';
587 print img_picto(
'',
'company',
'class="pictofixedwidth"');
588 print
'<b>'.$creditor.
'</b>';
589 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
590 print
'</td></tr>'.
"\n";
593 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
594 print
'</td><td class="CTableRow2">';
595 print img_picto(
'',
'company',
'class="pictofixedwidth"');
596 print
'<b>'.$object->thirdparty->name.
'</b>';
597 print
'</td></tr>'.
"\n";
600 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
601 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
602 print
'</td><td class="CTableRow2">'.$text;
604 $last_main_doc_file =
$object->last_main_doc;
606 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
609 $defaulttemplate =
'';
610 $object->generateDocument($defaulttemplate, $langs);
613 $directdownloadlink =
$object->getLastMainDocLink(
'fichinter');
614 if ($directdownloadlink) {
615 print
'<br><a href="'.$directdownloadlink.
'">';
617 if ($message ==
"signed") {
618 print $langs->trans(
"DownloadSignedDocument").
'</a>';
620 print $langs->trans(
"DownloadDocument").
'</a>';
623 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
624 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
625 print
'</td></tr>'.
"\n";
626} elseif ($source ==
'societe_rib') {
628 $langs->loadLangs(array(
"companies",
"commercial",
"withdrawals"));
630 $result =
$object->fetch_thirdparty();
633 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"CreditorName");
634 print
'</td><td class="CTableRow2">';
635 print img_picto(
'',
'company',
'class="pictofixedwidth"');
636 print
'<b>' . $creditor .
'</b>';
637 print
'<input type="hidden" name="creditor" value="' . $creditor .
'">';
638 print
'</td></tr>' .
"\n";
641 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"ThirdParty");
642 print
'</td><td class="CTableRow2">';
643 print img_picto(
'',
'company',
'class="pictofixedwidth"');
644 print
'<b>' .
$object->thirdparty->name .
'</b>';
645 print
'</td></tr>' .
"\n";
648 $text =
'<b>' . $langs->trans(
"Signature" .
dol_ucfirst($source) .
"Ref",
$object->ref) .
'</b>';
649 print
'<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans(
"Designation");
650 print
'</td><td class="CTableRow2">' . $text;
652 $last_main_doc_file =
$object->last_main_doc;
653 $diroutput =
$conf->societe->multidir_output[
$object->thirdparty->entity].
'/'
654 .dol_sanitizeFileName((
string)
$object->thirdparty->id).
'/';
655 if ((empty($last_main_doc_file) ||
658 && $message !=
"signed") {
664 $object->setDocModel($user, $defaulttemplate);
666 'use_companybankid' =>
$object->id,
667 'force_dir_output' => $diroutput
669 $result =
$object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
672 $directdownloadlink =
$object->getLastMainDocLink(
'company');
673 if ($directdownloadlink) {
674 print
'<br><a href="'.$directdownloadlink.
'">';
676 if ($message ==
"signed") {
677 print $langs->trans(
"DownloadSignedDocument").
'</a>';
679 print $langs->trans(
"DownloadDocument").
'</a>';
682} elseif ($source ==
'expedition') {
685 $langs->load(
"interventions");
690 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
691 print
'</td><td class="CTableRow2">';
692 print img_picto(
'',
'company',
'class="pictofixedwidth"');
693 print
'<b>'.$creditor.
'</b>';
694 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
695 print
'</td></tr>'.
"\n";
698 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
699 print
'</td><td class="CTableRow2">';
700 print img_picto(
'',
'company',
'class="pictofixedwidth"');
701 print
'<b>'.$object->thirdparty->name.
'</b>';
702 print
'</td></tr>'.
"\n";
705 $text =
'<b>'.$langs->trans(
"SignatureFichinterRef",
$object->ref).
'</b>';
706 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
707 print
'</td><td class="CTableRow2">'.$text;
709 $last_main_doc_file =
$object->last_main_doc;
710 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
713 $defaulttemplate =
'';
714 $object->generateDocument($defaulttemplate, $langs);
716 $directdownloadlink =
$object->getLastMainDocLink(
'', 0, 0);
717 if ($directdownloadlink) {
718 print
'<br><a href="'.$directdownloadlink.
'">';
720 if ($message ==
"signed") {
721 print $langs->trans(
"DownloadSignedDocument").
'</a>';
723 print $langs->trans(
"DownloadDocument").
'</a>';
726 print
'<input type="hidden" name="source" value="'.GETPOST(
"source",
'alpha').
'">';
727 print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
728 print
'</td></tr>'.
"\n";
731 $langs->load(
'companies');
734 $result =
$object->fetch_thirdparty();
738 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Proposer");
739 print
'</td><td class="CTableRow2">';
740 print img_picto(
'',
'company',
'class="pictofixedwidth"');
741 print
'<b>'.$creditor.
'</b>';
742 print
'<input type="hidden" name="creditor" value="'.$creditor.
'">';
743 print
'</td></tr>'.
"\n";
746 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"ThirdParty");
747 print
'</td><td class="CTableRow2">';
748 print img_picto(
'',
'company',
'class="pictofixedwidth"');
749 print
'<b>'.$object->thirdparty->name.
'</b>';
750 print
'</td></tr>'.
"\n";
753 $text =
'<b>'.$langs->trans(
"Signature".
dol_ucfirst($source).
"Ref",
$object->ref).
'</b>';
754 print
'<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans(
"Designation");
755 print
'</td><td class="CTableRow2">'.$text;
757 $last_main_doc_file =
$object->last_main_doc;
759 if (empty($last_main_doc_file) || !
dol_is_file(DOL_DATA_ROOT.
'/'.
$object->last_main_doc)) {
762 $defaulttemplate =
'';
763 $object->generateDocument($defaulttemplate, $langs);
766 $directdownloadlink =
$object->getLastMainDocLink($source);
767 if ($directdownloadlink) {
768 print
'<br><a href="'.$directdownloadlink.
'">';
770 if ($message ==
"signed") {
771 print $langs->trans(
"DownloadSignedDocument").
'</a>';
773 print $langs->trans(
"DownloadDocument").
'</a>';
779$parameters = array(
'source' => $source);
780$reshook = $hookmanager->executeHooks(
'addFormSign', $parameters,
$object, $action);
783 $langs->load(
'errors');
784 print
'<tr><td class="center" colspan="2"><br><div class="warning">'.dol_escape_htmltag($langs->transnoentitiesnoconv(
"ErrorBadParameters")).
'</div></td></tr>'.
"\n";
787print
'</table>'.
"\n";
790if ($action !=
'dosign') {
791 if ($found && !$error) {
800print
'</td></tr>'.
"\n";
801print
'<tr><td class="center">';
804if ($action ==
"dosign" && empty($cancel)) {
806 print
'<div class="tablepublicpayment">';
807 print
'<input type="text" class="paddingleftonly marginleftonly paddingright marginrightonly marginbottomonly borderbottom" id="name" placeholder="'.$langs->trans(
"Lastname").
'" spellcheck="false" autofocus>';
808 print
'<div id="signature" style="border:solid;"></div>';
810 print
'<input type="button" class="small noborderall cursorpointer buttonreset" id="clearsignature" value="'.$langs->trans(
"ClearSignature").
'">';
814 print
'<input type="button" class="button butActionSign marginleftonly marginrightonly" id="signbutton" value="'.$langs->trans(
"Sign").
'">';
815 print
'<input type="submit" class="button butActionDelete marginleftonly marginrightonly" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
820 $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT;
825 $urltogo = $_SERVER[
"PHP_SELF"].
'?ref='.urlencode($ref).
'&source='.urlencode($source).
'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled(
'multicompany') ?
'&entity='.(int) $entity :
'');
826 print
'<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.
'/public/includes/jquery/plugins/jSignature/jSignature.js"></script>
827 <script type="text/javascript">
828 $(document).ready(function() {
829 $("#signature").jSignature({ color:"#000", lineWidth:0, '.(empty(
$conf->dol_optimize_smallscreen) ?
'' :
'width: 280, ').
'height: 180});
831 $("#signature").on("change",function(){
832 $("#clearsignature").css("display","");
833 $("#signbutton").attr("disabled",false);
834 if(!$._data($("#signbutton")[0], "events")){
835 $("#signbutton").on("click",function(){
836 console.log("We click on button sign");
837 document.body.style.cursor = \'wait\';
838 var signature = $("#signature").jSignature("getData", "image");
839 var name = document.getElementById("name").value;
842 url: \''.DOL_URL_ROOT.
'/core/ajax/onlineSign.php\',
845 "action" : \'importSignature\',
847 "signaturebase64" : signature,
848 "onlinesignname" :
name,
849 "ref" : \
''.dol_escape_js($REF).
'\',
850 "securekey" : \
''.dol_escape_js($SECUREKEY).
'\',
851 "mode" : \
''.dol_escape_js($source).
'\',
852 "entity" : \
''.dol_escape_js((
string) $entity).
'\',
854 success:
function(response) {
855 if (response.trim() ===
"success") {
856 console.log(
"Success on saving signature");
859 document.body.style.cursor = \
'auto\';
860 console.error(response);
861 alert("Error on calling the core/ajax/onlineSign.php. See console log.");
864 error: function(response) {
865 document.body.style.cursor = \'auto\';
866 console.error(response);
867 alert("Error on calling the core/ajax/onlineSign.php. "+response.responseText);
874 $("#clearsignature").on("click",function(){
875 $("#signature").jSignature("clear");
876 $("#signbutton").attr("disabled",true);
877 // document.getElementById("onlinesignname").value = "";
880 $("#signbutton").attr("disabled",true);
884 if ($source ==
'proposal') {
885 if (
$object->status == $object::STATUS_SIGNED) {
887 if ($message ==
'signed') {
888 print img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
889 print
'<span class="ok">'.$langs->trans(
"PropalSigned").
'</span>';
891 print img_picto(
'',
'check',
'', 0, 0, 0,
'',
'size2x').
'<br>';
892 print
'<span class="ok">'.$langs->trans(
"PropalAlreadySigned").
'</span>';
894 } elseif (
$object->status == $object::STATUS_NOTSIGNED) {
896 if ($message ==
'refused') {
897 print img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
898 print
'<span class="ok">'.$langs->trans(
"PropalRefused").
'</span>';
900 print img_picto(
'',
'cross',
'', 0, 0, 0,
'',
'size2x').
'<br>';
901 print
'<span class="warning">'.$langs->trans(
"PropalAlreadyRefused").
'</span>';
904 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignPropal").
'">';
905 print
'<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"RefusePropal").
'">';
907 } elseif ($source ==
'contract') {
908 if ($message ==
'signed') {
909 print
'<span class="ok">'.$langs->trans(
"ContractSigned").
'</span>';
911 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignContract").
'">';
913 } elseif ($source ==
'fichinter') {
914 if ($message ==
'signed') {
915 print
'<span class="ok">'.$langs->trans(
"FichinterSigned").
'</span>';
917 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignFichinter").
'">';
919 } elseif ($source ==
'expedition') {
920 if ($message ==
'signed' ||
$object->signed_status == Expedition::$SIGNED_STATUSES[
'STATUS_SIGNED_SENDER']) {
921 print
'<span class="ok">'.$langs->trans(
"ExpeditionSigned").
'</span>';
923 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"SignExpedition").
'">';
926 if ($message ==
'signed') {
927 print
'<span class="ok">'.$langs->trans(
dol_ucfirst($source).
"Signed").
'</span>';
929 print
'<input type="submit" class="butAction butActionSign small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans(
"Sign".
dol_ucfirst($source)).
'">';
933print
'</td></tr>'.
"\n";
934print
'</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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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,...