Forráskód Böngészése

formateo de dato USUARIO

EmilianoOrtiz 3 hete
szülő
commit
6427210910

+ 18 - 0
sistema-mantenimiento-back/app/Http/Controllers/ProcessManagementController.php

@@ -3097,6 +3097,15 @@ class ProcessManagementController extends Controller
                 ->orderBy('w.WORK_FERE', 'desc')
                 ->get();
 
+            foreach ($results as $result) {
+                if (!empty($result->USUARIO_REGISTRO)) {
+                    $usuario = DB::table('S002V01TUSUA')->where('USUA_IDUS', $result->USUARIO_REGISTRO)->first(['USUA_NOMB', 'USUA_IDUS']);
+                    if ($usuario) {
+                        $result->USUARIO_REGISTRO = $usuario->USUA_NOMB . ' (' . $usuario->USUA_IDUS . ')';
+                    }
+                }
+            }
+
             return $this->responseController->makeResponse(false, "ÉXITO: Búsqueda de workflows completada", $results);
         } catch (\Throwable $th) {
             return $this->responseController->makeResponse(true, "Ocurrió un error en la búsqueda de workflows.", $th->getMessage(), 500);
@@ -3136,6 +3145,15 @@ class ProcessManagementController extends Controller
                 ->orderBy('ta.TAWO_SECU', 'asc')
                 ->get();
 
+            foreach ($results as $result) {
+                if (!empty($result->USUARIO)) {
+                    $usuario = DB::table('S002V01TUSUA')->where('USUA_IDUS', $result->USUARIO)->first(['USUA_NOMB', 'USUA_IDUS']);
+                    if ($usuario) {
+                        $result->USUARIO = $usuario->USUA_NOMB . ' (' . $usuario->USUA_IDUS . ')';
+                    }
+                }
+            }
+
             return $this->responseController->makeResponse(false, "ÉXITO: Historial de ejecuciones obtenido", $results);
         } catch (\Throwable $th) {
             return $this->responseController->makeResponse(true, "Ocurrió un error al obtener el historial de ejecuciones.", $th->getMessage(), 500);