From 61cb99117a09c898b5e8ed3fbbc070db88974e0d Mon Sep 17 00:00:00 2001 From: ATM john Date: Fri, 30 Oct 2020 09:33:07 +0100 Subject: [PATCH 1/5] Add missing lang trans --- htdocs/langs/en_US/bills.lang | 3 +++ htdocs/langs/fr_FR/bills.lang | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index dccc80b1918..a4ac01774f3 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -572,3 +572,6 @@ MaxNumberOfGenerationReached=Max number of gen. reached BILL_DELETEInDolibarr=Invoice deleted BILL_SUPPLIER_DELETEInDolibarr=Supplier invoice deleted UnitPriceXQtyLessDiscount=Unit price x Qty - Discount +SituationTotalRayToRest=Remainder to pay without taxe +PDFSituationTitle=Situation n° %d +SituationTotalProgress=Total progress %d %% diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 5da6bda8133..696bbf2ac32 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -575,3 +575,6 @@ BILL_SUPPLIER_DELETEInDolibarr=Facture fournisseur supprimée UnitPriceXQtyLessDiscount=Prix unitaire x Qté - Remise CustomersInvoicesArea=Zone de facturation client SupplierInvoicesArea=Zone de facturation fournisseur +SituationTotalRayToRest=Reste à payer total HT +PDFSituationTitle=Situation n° %d +SituationTotalProgress=Total progression %d %% From a4d2927f82b01e70ba62da905d0a1b26bebffec8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Oct 2020 12:11:41 +0100 Subject: [PATCH 2/5] Fix for #15016 Conflicts: htdocs/core/actions_linkedfiles.inc.php --- htdocs/core/actions_linkedfiles.inc.php | 11 +++++++---- htdocs/core/lib/files.lib.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index a1b2c12e10b..8f90234f8ab 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -103,7 +103,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $ret = dol_delete_file($file, 0, 0, 0, (is_object($object) ? $object : null)); if (!empty($fileold)) dol_delete_file($fileold, 0, 0, 0, (is_object($object) ? $object : null)); // Delete file using old path - // Si elle existe, on efface la vignette + // If it exists, remove thumb. + $regs = array(); if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) { $photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]); @@ -124,9 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') } else { setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors'); } - } - elseif ($linkid) // delete of external link - { + } elseif ($linkid) { // delete of external link require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $link = new Link($db); $link->fetch($linkid); @@ -190,6 +189,10 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) $filenamefrom = dol_sanitizeFileName(GETPOST('renamefilefrom', 'alpha'), '_', 0); // Do not remove accents $filenameto = dol_sanitizeFileName(GETPOST('renamefileto', 'alpha'), '_', 0); // Do not remove accents + // We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because + // this function is also applied when we upload and when we make try to download file (by the GETPOST(filename, 'alphanohtml') call). + $filenameto = dol_string_nohtmltag($filenameto); + if ($filenamefrom != $filenameto) { // Security: diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index eeac3566961..3fa1d083553 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1592,7 +1592,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $destfile = dol_sanitizeFileName($info['filename'].($info['extension'] != '' ? ('.'.strtolower($info['extension'])) : '')); // We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because - // this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call). + // this function is also applied when we rename and when we make try to download file (by the GETPOST(filename, 'alphanohtml') call). $destfile = dol_string_nohtmltag($destfile); $destfull = dol_string_nohtmltag($destfull); From 623cb54480c68ad213ae6a128a03c4c278bf5441 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Oct 2020 12:30:47 +0100 Subject: [PATCH 3/5] Prepare a more complete fix for #15016 --- htdocs/core/lib/functions.lib.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1a47d634299..d5ccf561e83 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5647,11 +5647,12 @@ function picto_required() * @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of
when there is both "...
\n..." * @param string $pagecodeto Encoding of input/output string * @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag) + * @param integer $removedoublespace Replace double space into one space * @return string String cleaned * * @see dol_escape_htmltag() strip_tags() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags() */ -function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0) +function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0, $removedoublespaces = 1) { if ($removelinefeed == 2) $stringtoclean = preg_replace('/]*>(\n|\r)+/ims', '
', $stringtoclean); $temp = preg_replace('/]*>/i', "\n", $stringtoclean); @@ -5669,13 +5670,14 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = $temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto); - // Supprime aussi les retours + // Remove also backspaces if ($removelinefeed == 1) $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp); - // et les espaces doubles - while (strpos($temp, " ")) - { - $temp = str_replace(" ", " ", $temp); + // And double quotes + if ($removedoublespaces) { + while (strpos($temp, " ")) { + $temp = str_replace(" ", " ", $temp); + } } return trim($temp); From 9113ecedfad12a3e54a8c58a5cfc10bc02f64bc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Oct 2020 12:55:26 +0100 Subject: [PATCH 4/5] code comment --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d5ccf561e83..62b88e53859 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5670,7 +5670,7 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = $temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto); - // Remove also backspaces + // Remove also carriage returns if ($removelinefeed == 1) $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp); // And double quotes From 41b938047d814c351b2a67ec5e8763e38aa9e51a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Oct 2020 14:51:32 +0100 Subject: [PATCH 5/5] Fix doc --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 62b88e53859..1e6ef8d6ebe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5647,7 +5647,7 @@ function picto_required() * @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of
when there is both "...
\n..." * @param string $pagecodeto Encoding of input/output string * @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag) - * @param integer $removedoublespace Replace double space into one space + * @param integer $removedoublespaces Replace double space into one space * @return string String cleaned * * @see dol_escape_htmltag() strip_tags() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags()