BUG 10957 "Feature request - Limit input document..." SOLVED

- Feature request - Limit input document maximum size
- Problema resuelto, al crear un nuevo Input Document se ha adicionado un nuevo campo "Maximum file size" y un dropdown
  que determina la unidad de medida en "KB y MB", esto permite definir el limite del tamañel archivo a anexar.
  Cuando se ejectua el caso al hacer click en "Attach", se muestra el tamañaximo que se puede adjuntar el archivo si es
  mayor	al limite se mostrara un mensaje; asi tambien si se tiene un file asocioado a un input document al igual que lo
  anterior se mostrara un mensaje.
This commit is contained in:
Luis Fernando Saisa Lopez
2014-09-18 14:01:56 -04:00
parent 5512f19413
commit 06412695ed
6 changed files with 19 additions and 23 deletions

View File

@@ -3550,14 +3550,16 @@ class Cases
$inputDocument = new InputDocument();
$arrayInputDocumentData = $inputDocument->load($inputDocumentUid);
//---
//--- Validate Filesize of $_FILE
$inpDocMaxFilesize = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"];
$inpDocMaxFilesizeUnit = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"];
$inpDocMaxFilesize = $inpDocMaxFilesize * (($inpDocMaxFilesizeUnit == "MB")? 1024 *1024 : 1024); //Bytes
if ($fileSize > $inpDocMaxFilesize) {
throw new Exception(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"));
if ($inpDocMaxFilesize > 0 && $fileSize > 0) {
if ($fileSize > $inpDocMaxFilesize) {
throw new Exception(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"));
}
}
//Get the Custom Folder ID (create if necessary)

View File

@@ -51,11 +51,13 @@ var verifyInfo = function(oForm)
return;
}
var flagFilesize = inputDocumentVerifySize(parseInt(getField("INP_DOC_MAX_FILESIZE").value), getField("APP_DOC_FILENAME"));
if (getField("INP_DOC_MAX_FILESIZE").value != "" && getField("INP_DOC_MAX_FILESIZE").value > 0) {
var flagFilesize = inputDocumentVerifySize(parseInt(getField("INP_DOC_MAX_FILESIZE").value), getField("APP_DOC_FILENAME"));
if (flagFilesize == 0) {
new leimnud.module.app.alert().make({label: _("ID_SIZE_VERY_LARGE_PERMITTED")});
return;
if (flagFilesize == 0) {
new leimnud.module.app.alert().make({label: _("ID_SIZE_VERY_LARGE_PERMITTED")});
return;
}
}
docType = oAux.value.split(".");

View File

@@ -31,7 +31,7 @@
<en><![CDATA[Allowed file extensions (use *.* to allow any extension)]]></en>
</INP_DOC_TYPE_FILE>
<INP_DOC_MAX_FILESIZE type="text" maxlength="10" size="8" mode="edit">
<INP_DOC_MAX_FILESIZE type="text" defaultvalue="0" maxlength="10" size="8" mode="edit">
<en>Maximum file size</en>
</INP_DOC_MAX_FILESIZE>

View File

@@ -45,29 +45,21 @@ var currentPagedTable = @#PAGED_TABLE_ID;
}
}
if (getField("INP_DOC_MAX_FILESIZE").value.trim() != "") {
var maxFilesize = parseInt(getField("INP_DOC_MAX_FILESIZE").value.trim());
var maxFilesizeUnit = getField("INP_DOC_MAX_FILESIZE_UNIT").value;
var maxFilesize = parseInt(getField("INP_DOC_MAX_FILESIZE").value.trim());
var maxFilesizeUnit = getField("INP_DOC_MAX_FILESIZE_UNIT").value;
var uploadMaxFilesize = parseInt(getField("INP_DOC_UPLOAD_MAX_FILESIZE").value);
var uploadMaxFilesize = parseInt(getField("INP_DOC_UPLOAD_MAX_FILESIZE").value);
maxFilesize = maxFilesize * ((maxFilesizeUnit == "MB")? 1024 * 1024 : 1024);
maxFilesize = maxFilesize * ((maxFilesizeUnit == "MB")? 1024 * 1024 : 1024);
if (maxFilesize != "" && maxFilesize != 0) {
if(maxFilesize > 0) {
if(maxFilesize > uploadMaxFilesize) {
new leimnud.module.app.alert().make({label: _("ID_SIZE_VERY_LARGE_PERMITTED")});
getField("INP_DOC_MAX_FILESIZE").focus();
return false;
}
} else {
new leimnud.module.app.alert().make({label: _("ID_MAXIMUM_SIZE_FILE_GREATER_THAN_ZERO")});
getField("INP_DOC_MAX_FILESIZE").focus();
return false;
}
} else {
new leimnud.module.app.alert().make({label: _("ID_MAXIMUM_SIZE_FILE_REQUIRED")});
getField("INP_DOC_MAX_FILESIZE").focus();
return false;
}
return true;