From d1716babeffefcea5dc580aea0258ff4aa257bf4 Mon Sep 17 00:00:00 2001
From: iouston <4319513+iouston@users.noreply.github.com>
Date: Wed, 27 Feb 2019 11:17:33 +0100
Subject: [PATCH 1/3] disable the auto renaming on upload
add a global variable for disable the auto renaming on upload file
corresponds to the request of this post : https://www.dolibarr.fr/forum/12-howto--aide/55094-fichiers-joints-decocher-la-case-sauver-sous#107392
---
htdocs/core/class/html.formfile.class.php | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index c53a5562997..52336e3759e 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -72,7 +72,7 @@ class FormFile
* @param string $options Add an option column
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
* Deprecated 2 should never be used and if 1 is used, option should no be enabled.
- * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
+ * @param string $dodocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
* @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')
@@ -174,14 +174,17 @@ class FormFile
$out .= "";
if ($savingdocmask)
- {
- $out .= '
';
- }
+ {
+ //add a global variable for disable the auto renaming on upload
+ if($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT==1){$rename='';}else{$rename='checked';}
+
+ $out .= '
';
+ }
$out .= "";
From f2dc6872029c4ea6df2791fa6eea1f58cb3287d3 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Wed, 27 Feb 2019 13:26:37 +0100
Subject: [PATCH 2/3] Update html.formfile.class.php
---
htdocs/core/class/html.formfile.class.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 52336e3759e..7d18d7e3a5d 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -176,7 +176,13 @@ class FormFile
if ($savingdocmask)
{
//add a global variable for disable the auto renaming on upload
- if($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT==1){$rename='';}else{$rename='checked';}
+ if (! empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT))
+ {
+ $rename='';
+ }
+ else {
+ $rename='checked';
+ }
$out .= '
';
if (! empty($options)) $out .= '
'.$options.'
';
From c240c66789861ac49d5206b8edd427456851cb07 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 28 Feb 2019 11:17:43 +0100
Subject: [PATCH 3/3] Update html.formfile.class.php
---
htdocs/core/class/html.formfile.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 7d18d7e3a5d..3d1fe06d462 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -72,7 +72,7 @@ class FormFile
* @param string $options Add an option column
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
* Deprecated 2 should never be used and if 1 is used, option should no be enabled.
- * @param string $dodocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
+ * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
* @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')