feat(database): leyenda de aviso SAT solo si el cliente cambio de sistema (T2026-06-111) (#18)
Some checks failed
Aduanasoft/PANEL_BASES_ANEXO24/pipeline/head There was a failure building this commit

Nuevo parametro anexo24c_cambio_sistema por nodo, editable desde el modal
de Gestion de Bases de Datos (checkbox "Presento aviso de cambio de sistema
(Anexo 24C)"). Solo cuando esta marcado Y el cliente esta inactivo, el login
de SCAII Web muestra la leyenda del SAT; el campo de fecha se habilita solo
si el checkbox esta activo.

- controldesk-pg.ts: anexo24c_cambio_sistema en ROW_DATABASE_NODE, insert y update.
- +page.server.ts: parseo del campo en createDatabase / updateDatabase.
- +page.svelte: checkbox en el modal + fecha condicionada al checkbox.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Reviewed-on: #18
Co-authored-by: Galindo97 <agalindo@aduanasoft.com.mx>
Co-committed-by: Galindo97 <agalindo@aduanasoft.com.mx>
This commit is contained in:
2026-07-17 14:14:32 +00:00
committed by acazares
parent 26eed5726c
commit a9a1dcb9ae
3 changed files with 51 additions and 15 deletions

View File

@@ -173,7 +173,8 @@ const ROW_DATABASE_NODE = `
server_name AS "ServerName",
database_name AS "BDName",
restore_target_id AS "RestoreTargetId",
anexo24c_aviso_fecha AS "Anexo24CAvisoFecha"
anexo24c_aviso_fecha AS "Anexo24CAvisoFecha",
anexo24c_cambio_sistema AS "Anexo24CCambioSistema"
`;
const ROW_PORTAL_USER = `
@@ -378,6 +379,7 @@ export async function insertDatabaseNode(row: {
activo: number;
restoreTargetId?: number | null;
anexo24CAvisoFecha?: string | null;
anexo24CCambioSistema?: boolean;
}): Promise<void> {
// server_name y sql_password se derivan del servidor de restauración asignado (su IP y su
// credencial SQL cifrada); si el target aún no tiene IP, se conserva el serverName recibido.
@@ -386,13 +388,13 @@ export async function insertDatabaseNode(row: {
INSERT INTO ${qNodes()} (
node_subnode_key, rfc, legal_name, branch_name,
notification_email, server_name, database_name, is_active, restore_target_id,
sql_password, anexo24c_aviso_fecha
sql_password, anexo24c_aviso_fecha, anexo24c_cambio_sistema
) VALUES (
$1, $2, $3, $4, $5,
COALESCE((SELECT server_ip FROM ${qRestoreTargets()} WHERE id = $9), $6),
$7, $8, $9,
(SELECT sql_password_encrypted FROM ${qRestoreTargets()} WHERE id = $9),
$10
$10, $11
)
`,
[
@@ -405,7 +407,8 @@ export async function insertDatabaseNode(row: {
row.bdName,
row.activo,
row.restoreTargetId ?? null,
row.anexo24CAvisoFecha ?? null
row.anexo24CAvisoFecha ?? null,
row.anexo24CCambioSistema ?? false
]
);
}
@@ -423,6 +426,7 @@ export async function updateDatabaseNode(
activo: number;
restoreTargetId?: number | null;
anexo24CAvisoFecha?: string | null;
anexo24CCambioSistema?: boolean;
}
): Promise<void> {
await pgPool.query(
@@ -438,8 +442,9 @@ export async function updateDatabaseNode(
is_active = $8,
restore_target_id = $9,
sql_password = (SELECT sql_password_encrypted FROM ${qRestoreTargets()} WHERE id = $9),
anexo24c_aviso_fecha = $10
WHERE id = $11
anexo24c_aviso_fecha = $10,
anexo24c_cambio_sistema = $11
WHERE id = $12
`,
[
row.nodoSubNodo,
@@ -452,6 +457,7 @@ export async function updateDatabaseNode(
row.activo,
row.restoreTargetId ?? null,
row.anexo24CAvisoFecha ?? null,
row.anexo24CCambioSistema ?? false,
id
]
);