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
This commit is contained in:
iouston 2019-02-27 11:17:33 +01:00 committed by GitHub
parent bcf1d57456
commit d1716babef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 .= "</td></tr>";
if ($savingdocmask)
{
$out .= '<tr>';
if (! empty($options)) $out .= '<td>'.$options.'</td>';
$out .= '<td class="nowrap valignmiddle">';
$out .= '<input type="checkbox" checked class="savingdocmask" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/', $langs->transnoentitiesnoconv("OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
$out .= '</td>';
$out .= '</tr>';
}
{
//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 .= '<tr>';
if (! empty($options)) $out .= '<td>'.$options.'</td>';
$out .= '<td valign="middle" class="nowrap">';
$out .= '<input type="checkbox" '.$rename.' class="savingdocmask" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
$out .= '</td>';
$out .= '</tr>';
}
$out .= "</table>";