BUG-14990 - NEW FEATURE, permitir especificar extensiones para los inputdocs.
Nuevo campo en Input Documents, dicho campo acepta las extensiones de los inputdocs permitidos. Se agregaron validaciones para que funcione correctamente
This commit is contained in:
@@ -908,6 +908,9 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
|
||||
$Fields['APP_DOC_UID'] = $_POST['appDocId'];
|
||||
$Fields['actionType'] = $_POST['actionType'];
|
||||
$Fields['docVersion'] = $_POST['docVersion'];
|
||||
$oInputDocument = new InputDocument();
|
||||
$InpDocData = $oInputDocument->load( $Fields['DOC_UID'] );
|
||||
$Fields['fileTypes'] = $InpDocData['INP_DOC_TYPE_FILE'];
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'cases_SaveDocument?UID=' . $_POST['docID'] );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
break;
|
||||
|
||||
@@ -279,6 +279,9 @@ try {
|
||||
//Get the Custom Folder ID (create if necessary)
|
||||
$oFolder = new AppFolder();
|
||||
|
||||
//***Validating the file allowed extensions***
|
||||
G::verifyInputDocExtension($aID['INP_DOC_TYPE_FILE'], $_FILES["form"]["name"]["input"], $_FILES["form"]["tmp_name"]["input"]);
|
||||
|
||||
$aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => $indocUid,"APP_DOC_TYPE" => "INPUT","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"FOLDER_UID" => $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"] ),"APP_DOC_TAGS" => $oFolder->parseTags( $aID["INP_DOC_TAGS"] ),"APP_DOC_FIELDNAME" => $fieldName);
|
||||
} else {
|
||||
$aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => - 1,"APP_DOC_TYPE" => "ATTACHED","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"APP_DOC_FIELDNAME" => $fieldName);
|
||||
|
||||
@@ -93,8 +93,10 @@ if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
|
||||
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//***Validating the file allowed extensions***
|
||||
$oInputDocument = new InputDocument();
|
||||
$InpDocData = $oInputDocument->load( $inputDocumentUid );
|
||||
G::verifyInputDocExtension($InpDocData['INP_DOC_TYPE_FILE'], $_FILES["form"]["name"]["APP_DOC_FILENAME"], $_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]);
|
||||
|
||||
//Add Input Document
|
||||
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
|
||||
|
||||
@@ -88,6 +88,18 @@ try {
|
||||
$aData = $_POST;
|
||||
}
|
||||
|
||||
//Validating the format of the allowed extentions
|
||||
//Allowed Types has to have this format -> *.pdf, *.docx or *.* to all.
|
||||
$allowedTypes = explode(", ", $aData['INP_DOC_TYPE_FILE']);
|
||||
foreach ($allowedTypes as $types => $val) {
|
||||
if((preg_match('/^\*\.?[a-z]{2,8}$/', $val)) || ($val == '*.*')){
|
||||
}else {
|
||||
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_WRONG_ALLOWED_EXTENSION_FORMAT' );
|
||||
G::SendMessageText( $message, "ERROR" );
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
if ($aData['INP_DOC_UID'] == '') {
|
||||
unset( $aData['INP_DOC_UID'] );
|
||||
$oInputDocument->create( $aData );
|
||||
|
||||
Reference in New Issue
Block a user