Merged in bugfix/PMCORE-1435 (pull request #7334)
PMCORE-1435 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
ef9024159b
@@ -77,33 +77,4 @@ class CasesTest extends TestCase
|
||||
$case = new Cases();
|
||||
$case->deleteCase($application->APP_UID, $_SESSION['USER_LOGGED']);
|
||||
}
|
||||
/**
|
||||
* This checks the validation of documents
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::validateAppDocUid()
|
||||
* @test
|
||||
*/
|
||||
public function it_should_validate_app_doc_uid()
|
||||
{
|
||||
$arrayVariableDocument = [
|
||||
0 => [
|
||||
"appDocUid" => "4371401485e7cd60d160062060139220",
|
||||
"name" => "test_1.txt",
|
||||
"version" => "1"
|
||||
],
|
||||
1 => [
|
||||
"name" => "test_1.txt",
|
||||
"version" => "1"
|
||||
],
|
||||
2 => [
|
||||
"appDocUid" => "6837968225e7cd60dc17588042896388",
|
||||
"name" => "test_1.txt",
|
||||
"version" => "1"
|
||||
]
|
||||
];
|
||||
$case = new Cases();
|
||||
$newArrayVariableDocument = $case->validateAppDocUid($arrayVariableDocument);
|
||||
$this->assertNotEmpty($newArrayVariableDocument);
|
||||
$this->assertNotEquals($newArrayVariableDocument, $arrayVariableDocument);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3230,8 +3230,6 @@ class Cases
|
||||
$arrayApplicationData = $this->getApplicationRecordByPk($applicationUid, [], false);
|
||||
$arrayApplicationData['APP_DATA'] = $case->unserializeData($arrayApplicationData['APP_DATA']);
|
||||
$flagDelete = false;
|
||||
$arrayVariableDocumentToDelete = $this->validateAppDocUid($arrayVariableDocumentToDelete);
|
||||
|
||||
foreach ($arrayVariableDocumentToDelete as $key => $value) {
|
||||
if (is_array($value) && !empty($value)) {
|
||||
$type = '';
|
||||
@@ -3256,6 +3254,7 @@ class Cases
|
||||
$arrayDocumentDelete = $value;
|
||||
|
||||
foreach ($arrayDocumentDelete as $value2) {
|
||||
if ($value2['appDocUid'] !== "") {
|
||||
$appDocument->remove($value2['appDocUid'], (int)($value2['version']));
|
||||
|
||||
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
|
||||
@@ -3264,6 +3263,7 @@ class Cases
|
||||
|
||||
$flagDelete = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'GRID':
|
||||
$grid = $key;
|
||||
@@ -3274,6 +3274,7 @@ class Cases
|
||||
$arrayDocumentDelete = $value3;
|
||||
|
||||
foreach ($arrayDocumentDelete as $value4) {
|
||||
if ($value4['appDocUid'] !== "") {
|
||||
$appDocument->remove($value4['appDocUid'], (int)($value4['version']));
|
||||
|
||||
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
|
||||
@@ -3284,6 +3285,7 @@ class Cases
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3316,24 +3318,6 @@ class Cases
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate if all documents have appDocUid
|
||||
*
|
||||
* @param array $arrayVariableDocument
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validateAppDocUid(array $arrayVariableDocument)
|
||||
{
|
||||
$newArrayVariableDocument = [];
|
||||
foreach ($arrayVariableDocument as $value) {
|
||||
if (array_key_exists('appDocUid', $value)) {
|
||||
$newArrayVariableDocument[] = $value;
|
||||
}
|
||||
}
|
||||
return $newArrayVariableDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Permissions, Participate, Access, Objects supervisor
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user