HOR-1576 "Support Multiple File variable for file deletion" SOLVED
Issue:
Support Multiple File variable for file deletion
Cause:
Nuevo requerimiento de funciones
Solution:
- Se implemento el metodo "\ProcessMaker\BusinessModel\Cases::deleteMultipleFile()" para la eliminacion del
documento de la BD y en el APP_DATA; esto para variables normales y grids
- Se implemento esto en:
* Web: cases_SaveData.php
* End-point: PUT /api/1.0/{workspace}/light/{app_uid}/variable?dyn_uid={dyn_uid}&del_index={del_index}
- La variable y el formato de la misma, es el siguiente:
...
[__VARIABLE_DOCUMENT_DELETE__] => Array
( [multipleFileVar001] => Array
( [0] => Array
( [appDocUid] => 42072183457acd3d2045e71059588476
[version] => 1
)
[1] => Array
( [appDocUid] => 42072183457acd3d2045e71059588476
[version] => 1
)
....
)
[gridVar001] => Array
( [1] => Array
( [multipleFile0000000002] => Array
( [0] => Array
( [appDocUid] => 88526242657acd3dccaa4b8052310943
[version] => 1
)
[1] => Array
( [appDocUid] => 88526242657acd3dccaa4b8052310943
[version] => 1
)
)
...
)
...
)
....
)
...
This commit is contained in:
@@ -101,6 +101,16 @@ try {
|
||||
throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>',G::LoadTranslation( 'ID_REOPEN' ) ) ) );
|
||||
}
|
||||
|
||||
$arrayVariableDocumentToDelete = [];
|
||||
|
||||
if (array_key_exists('__VARIABLE_DOCUMENT_DELETE__', $_POST['form'])) {
|
||||
if (is_array($_POST['form']['__VARIABLE_DOCUMENT_DELETE__']) && !empty($_POST['form']['__VARIABLE_DOCUMENT_DELETE__'])) {
|
||||
$arrayVariableDocumentToDelete = $_POST['form']['__VARIABLE_DOCUMENT_DELETE__'];
|
||||
}
|
||||
|
||||
unset($_POST['form']['__VARIABLE_DOCUMENT_DELETE__']);
|
||||
}
|
||||
|
||||
/*
|
||||
* PMDynaform
|
||||
* DYN_VERSION is 1: classic Dynaform,
|
||||
@@ -442,6 +452,13 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
//Delete MultipleFile
|
||||
if (!empty($arrayVariableDocumentToDelete)) {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
|
||||
$case->deleteMultipleFile($_SESSION['APPLICATION'], $arrayVariableDocumentToDelete);
|
||||
}
|
||||
|
||||
//Go to the next step
|
||||
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
if (isset( $_GET['_REFRESH_'] )) {
|
||||
|
||||
Reference in New Issue
Block a user