fix: la fecha final del ausentismo mira hacia adelante

El selector ofrecia Hoy/Ayer/Anteayer tambien para el "hasta", cuando una
novedad que se registra hoy termina hoy o mas adelante. Ahora ese campo ofrece
Hoy/Manana/Pasado manana, y "Otra fecha" sigue aceptando cualquiera.

date_quick gana 'quick' => 'futuro'; sin esa clave se comporta igual que antes,
asi que las fechas de labores y ciclos —siempre pasadas— no cambian.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-08-20 22:53:03 -05:00
co-authored by Claude Sonnet 4.6
parent 2ef3091260
commit 6616b63683
3 changed files with 30 additions and 7 deletions
+18 -7
View File
@@ -1525,11 +1525,13 @@ class NormalBot
}
}
// ── date_quick: Hoy / Ayer / Anteayer / Otra ────────────────────────
// ── date_quick: atajos hacia atras o hacia adelante segun 'quick' ───
if ($type === 'date_quick') {
$hoy = date('Y-m-d');
$ayer = date('Y-m-d', strtotime('-1 day'));
$ant = date('Y-m-d', strtotime('-2 days'));
$man = date('Y-m-d', strtotime('+1 day'));
$pas = date('Y-m-d', strtotime('+2 days'));
return self::enqueueInteractive($to, [
'type' => 'list',
'header' => ['type' => 'text', 'text' => mb_substr($cap['header'], 0, 60)],
@@ -1537,12 +1539,21 @@ class NormalBot
'footer' => ['text' => ''],
'action' => ['button' => 'Ver fechas', 'sections' => [[
'title' => 'Fecha',
'rows' => [
['id' => $hoy, 'title' => '📅 Hoy', 'description' => $hoy],
['id' => $ayer, 'title' => '📅 Ayer', 'description' => $ayer],
['id' => $ant, 'title' => '📅 Anteayer', 'description' => $ant],
['id' => '__cap_other', 'title' => '✏️ Otra fecha', 'description' => 'Escribe la fecha'],
],
// Una fecha de cierre cae hoy o mas adelante: ofrecer ayer y
// anteayer ahi no tenia sentido. 'futuro' invierte los atajos.
'rows' => (($field['quick'] ?? 'pasado') === 'futuro')
? [
['id' => $hoy, 'title' => '📅 Hoy', 'description' => $hoy],
['id' => $man, 'title' => '📅 Mañana', 'description' => $man],
['id' => $pas, 'title' => '📅 Pasado mañana', 'description' => $pas],
['id' => '__cap_other', 'title' => '✏️ Otra fecha', 'description' => 'Escribe la fecha'],
]
: [
['id' => $hoy, 'title' => '📅 Hoy', 'description' => $hoy],
['id' => $ayer, 'title' => '📅 Ayer', 'description' => $ayer],
['id' => $ant, 'title' => '📅 Anteayer', 'description' => $ant],
['id' => '__cap_other', 'title' => '✏️ Otra fecha', 'description' => 'Escribe la fecha'],
],
]]],
], $company);
}