فهرست منبع

validacion para asegurar que los archivos a procesar no han sido eliminados logicamente.

EmilianoOrtiz 2 ماه پیش
والد
کامیت
36e9b38a86
1فایلهای تغییر یافته به همراه26 افزوده شده و 0 حذف شده
  1. 26 0
      sistema-mantenimiento-back/app/Http/Controllers/AsyncValidateLoadArchivesController.php

+ 26 - 0
sistema-mantenimiento-back/app/Http/Controllers/AsyncValidateLoadArchivesController.php

@@ -278,6 +278,27 @@ class AsyncValidateLoadArchivesController extends Controller
         $finalFiles = [];
         
         try {
+            // Verificar estado de archivos antes de procesarlos
+            $tempFiles = [$form['temp_files']['excel'], $form['temp_files']['zip']];
+            foreach ($form['individual_temp_files'] as $tempFile) {
+                $tempFiles[] = $tempFile['temp_id'];
+            }
+            
+            foreach ($tempFiles as $tempId) {
+                $tempIdDec = $this->encryptionController->decrypt($tempId);
+                if ($tempIdDec) {
+                    $tempFile = DB::table('S002V01TARTE')->where('ARTE_IDAR', $tempIdDec)->first();
+                    if ($tempFile && $tempFile->ARTE_ESTA === 'Eliminado') {
+                        return $this->responseController->makeResponse(
+                            true, 
+                            'La acción no puede completarse porque uno o más archivos han sido eliminados lógicamente.', 
+                            [], 
+                            400
+                        );
+                    }
+                }
+            }
+            
             // Move Excel to final
             $excelFinal = $this->moveToFinal($form['temp_files']['excel'], $form['linea'], $idUser);
             if (!$excelFinal) {
@@ -327,6 +348,11 @@ class AsyncValidateLoadArchivesController extends Controller
                 return false;
             }
             
+            // Validar estado del archivo temporal
+            if ($tempFile->ARTE_ESTA === 'Eliminado') {
+                return false;
+            }
+            
             $result = $this->documentManagementController->moveFinalFile($line, 'ADSI', 'LA', $tempFile, $idUser);
             return $result[0] ? $result[1] : false;