From 8fb7d129c91ba861c76dbd30b5d4e783bbe4d6dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Jul 2022 00:36:38 +0200 Subject: [PATCH 1/2] Trans --- htdocs/admin/mails.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index f065760f62d..67bf775bdd9 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -870,7 +870,7 @@ if ($action == 'edit') { if (!empty($dnsinfo) && is_array($dnsinfo)) { foreach ($dnsinfo as $info) { if (strpos($info['txt'], 'v=spf') !== false) { - $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']); + $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $companyemail, $info['txt']); } } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 13e5fde204c..5b43bc2b457 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -504,7 +504,7 @@ WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to se WarningPHPMailD=Also, it is therefore recommended to change the sending method of e-mails to the value "SMTP". If you really want to keep the default "PHP" method to send emails, just ignore this warning, or remove it by setting the MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP constant to 1 in Home - Setup - Other. WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: %s. WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask your domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: %s. -ActualMailSPFRecordFound=Actual SPF record found : %s +ActualMailSPFRecordFound=Actual SPF record found (for email %s) : %s ClickToShowDescription=Click to show description DependsOn=This module needs the module(s) RequiredBy=This module is required by module(s) From 7505e2a1abdbefb9508df21616357c68883c222e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Jul 2022 10:26:27 +0200 Subject: [PATCH 2/2] Debug v16 --- htdocs/core/js/lib_foot.js.php | 42 ++++++++++++++++++------------- htdocs/core/lib/functions.lib.php | 12 +++++---- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 9167e08e599..3310554e530 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -231,33 +231,41 @@ print ' ); jQuery(\'.clipboardCPValue, .clipboardCPButton, .clipboardCPValueToPrint\').click(function() { - /* console.log(this.parentNode); */ console.log("We click on a clipboardCPButton or clipboardCPValueToPrint class and we want to copy content of clipboardCPValue class"); if (window.getSelection) { - range = document.createRange(); - - /* We select value to print using the parent. */ - /* We should use the class clipboardCPValue but it may have several element with copy/paste so class to select is not enough */ - range.selectNodeContents(this.parentNode.firstChild); + jqobj=$(this).parent().children(".clipboardCPValue"); + console.log(jqobj.html()); selection = window.getSelection(); /* get the object used for selection */ selection.removeAllRanges(); /* clear current selection */ + + /* We select the value to print using the parentNode.firstChild */ + /* We should use the class clipboardCPValue but it may have several element with copy/paste so class to select is not enough */ + range = document.createRange(); + range.selectNodeContents(this.parentNode.firstChild); selection.addRange(range); /* make the new selection with the value to copy */ + + /* copy selection into clipboard */ + var succeed; + try { + console.log("We set the style display to unset for the span so the copy will work"); + jqobj.css("display", "unset"); /* Because copy does not work on "block" object */ + + succeed = document.execCommand(\'copy\'); + + console.log("We set the style display back to inline-block"); + jqobj.css("display", "inline-block"); + } catch(e) { + succeed = false; + } + + /* Remove the selection to avoid to see the hidden field to copy selected */ + window.getSelection().removeAllRanges(); } - /* copy selection into clipboard */ - var succeed; - try { - succeed = document.execCommand(\'copy\'); - } catch(e) { - succeed = false; - } - - /* Remove the selection to avoid to see the hidden field to copy selected */ - window.getSelection().removeAllRanges(); - /* Show message */ + /* TODO Show message into a top left corner or center of screen */ var lastchild = this.parentNode.lastChild; /* .parentNode is clipboardCP and last child is clipboardCPText */ var tmp = lastchild.innerHTML if (succeed) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 316d4f79a6d..9b75313d73d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11030,12 +11030,12 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) } /** - * Create a button to copy $valuetocopy in the clipboard. - * Code that handle the click is inside lib_foot.jsp.php. + * Create a button to copy $valuetocopy in the clipboard (for copy and paste feature). + * Code that handle the click is inside core/js/lib_foot.js.php. * * @param string $valuetocopy The value to print * @param int $showonlyonhover Show the copy-paste button only on hover - * @param string $texttoshow Replace the value to show with this text + * @param string $texttoshow Replace the value to show with this text. Use 'none' to show no text (only the copy-paste picto) * @return string The string to print for the button */ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '') @@ -11047,8 +11047,10 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex $showonlyonhover = 0; }*/ - $tag = 'span'; // Using div does not work when using the js copy code. - if ($texttoshow) { + $tag = 'span'; // Using div (like any style of type 'block') does not work when using the js copy code. + if ($texttoshow === 'none') { + $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''; + } elseif ($texttoshow) { $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.dol_escape_htmltag($texttoshow, 1, 1).''; } else { $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 1e37d372e86..ba67bf5fdcf 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7260,7 +7260,7 @@ span.clipboardCPValueToPrint, div.clipboardCPValueToPrint { } span.clipboardCPValue.hidewithsize { width: 0 !important; - display: inline-block; + display: inline-block; /* this will be modifiy on the fly by the copy-paste js code in lib_foot.js.php to have copy feature working */ color: transparent; white-space: nowrap; overflow-x: hidden; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index bc201f7da68..a710e8417ec 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -7026,7 +7026,7 @@ span.clipboardCPValueToPrint, div.clipboardCPValueToPrint { } span.clipboardCPValue.hidewithsize { width: 0 !important; - display: inline-block; + display: inline-block; /* this will be modifiy on the fly by the copy-paste js code in lib_foot.js.php to have copy feature working */ color: transparent; white-space: nowrap; overflow-x: hidden;