'.$text;
+
+ $last_main_doc_file = $object->last_main_doc;
+ if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) {
+ // It seems document has never been generated, or was generated and then deleted.
+ // So we try to regenerate it with its default template.
+ $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used.
+ $object->generateDocument($defaulttemplate, $langs);
+ }
+ $directdownloadlink = $object->getLastMainDocLink('', 0, 0);
+ if ($directdownloadlink) {
+ print ' ';
+ print img_mime($object->last_main_doc, '');
+ if ($message == "signed") {
+ print $langs->trans("DownloadSignedDocument").'';
+ } else {
+ print $langs->trans("DownloadDocument").'';
+ }
+ }
+ print '';
+ print '';
+ print '
'."\n";
} else {
$found = true;
$langs->load('companies');
@@ -769,6 +825,12 @@ if ($action == "dosign" && empty($cancel)) {
} else {
print '';
}
+ } elseif ($source == 'expedition') {
+ if ($message == 'signed' || $object->signed_status == Expedition::STATUS_SIGNED) {
+ print ''.$langs->trans("ExpeditionSigned").'';
+ } else {
+ print '';
+ }
} else {
if ($message == 'signed') {
print ''.$langs->trans(dol_ucfirst($source)."Signed").'';
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index dcf3c05a2f0..4c7c574425c 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -3491,12 +3491,58 @@ if (!GETPOST('hide_websitemenu')) {
// ...
//});
+ CKEDITOR.instances[idtouse].on(\'change\', function() {
+ $(this.element.$).addClass(\'modified\');
+ })
} else {
console.warn("A html section has the contenteditable=true attribute but has no id attribute");
}
})
isEditingEnabled = true;
+
+ // Trigger the function when clicking outside the elements with contenteditable=true attribute
+ $(document).on(\'click\', function(e) {
+ var target = $(e.target);
+ // Check if the click is outside the elements with contenteditable=true attribute
+ if (!target.closest(\'[contenteditable="true"]\').length) {
+ // Repeat through the elements with contenteditable="true" attribute
+ $(\'[contenteditable="true"]\').each(function() {
+ var idToUse = $(this).attr(\'id\');
+ var elementType = $(this).prop("tagName").toLowerCase(); // Get the tag name (div, section, footer...)
+ var instance = CKEDITOR.instances[idToUse];
+ // Check if the element has been modified
+ if ($(this).hasClass(\'modified\')) {
+ var content = instance.getData();
+ content = "\\n" + content;
+
+ // Retrieving the content and ID of the element
+ var elementId = $(this).attr(\'id\');
+
+ // Sending data via AJAX
+ $.ajax({
+ type: \'POST\',
+ url: \'' . DOL_URL_ROOT . '/core/ajax/editinline.php\',
+ data: {
+ website_ref: \''.$website->ref.'\',
+ page_id: \'' . $websitepage->id . '\',
+ content: content,
+ element_id: elementId,
+ element_type: elementType,
+ action: \'updatedElementContent\',
+ token: \'' . newToken() . '\'
+ },
+ success: function(response) {
+ console.log(response);
+ }
+ });
+
+ $(this).removeClass(\'modified\');
+ }
+ });
+ }
+ });
+
} else {
console.log("Disable inline edit");
for(name in CKEDITOR.instances) {