diff --git a/modules/turnero/api/guardar_toma.php b/modules/turnero/api/guardar_toma.php index 7187a83..e009bf0 100644 --- a/modules/turnero/api/guardar_toma.php +++ b/modules/turnero/api/guardar_toma.php @@ -108,8 +108,16 @@ foreach ($esquema as $campo) { $__tcFirmas = $datosMerge['_tomas_config'] ?? null; if (is_array($__tcFirmas)) { $__allowed = []; - foreach ($__tcFirmas as $__g => $__ids) { - if (is_array($__ids)) foreach ($__ids as $__id) $__allowed[$__id] = true; + foreach ($__tcFirmas as $__v) { + if (!is_array($__v)) continue; + $__inner = reset($__v); + if (is_array($__inner)) { + // nested: { examName: { groupKey: [fids] } } + foreach ($__v as $__fids) foreach ($__fids as $__f) $__allowed[$__f] = true; + } else { + // flat: { groupKey: [fids] } + foreach ($__v as $__f) $__allowed[$__f] = true; + } } $firmasCampos = array_values(array_filter($firmasCampos, fn($f) => isset($__allowed[$f['id']]))); }