Skip to content

Bug al responder por controlador las llamadas ajax de los documentos al cambiar el estado#6

Closed
daniel89fg wants to merge 1 commit intomasterfrom
bug-sendok-ajax-documents
Closed

Bug al responder por controlador las llamadas ajax de los documentos al cambiar el estado#6
daniel89fg wants to merge 1 commit intomasterfrom
bug-sendok-ajax-documents

Conversation

@daniel89fg
Copy link
Owner

Cuando se cambia el estado de un documento antes de nada guarda el documento y eso hace que la devolución json ya se ejecute, de tal forma que luego al cambiar el estado si una extensión como verifactu quiere devolver false, el estado no se cambia que es lo esperado, pero no muestra los mensajes de error de porque no.

¿Cómo has probado los cambios?

Toda modificación debe haber sido mínimamente probada. Marca o describe las pruebas que has realizado:

  • He revisado mi código antes de enviarlo.
  • He probado que funciona correctamente en mi PC.
  • He probado que funciona correctamente con una base de datos vacía.
  • He ejecutado los tests unitarios.

Copilot AI review requested due to automatic review settings November 19, 2025 17:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where AJAX responses for document status changes were being sent prematurely, preventing error messages from being displayed when extensions (like verifactu) reject the status change.

  • Modified saveDocAction to optionally suppress the JSON response
  • Updated saveStatusAction to call saveDocAction(false) to prevent premature JSON response
  • Applied the fix consistently across both SalesController and PurchasesController

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Core/Lib/AjaxForms/SalesController.php Added $sendOk parameter to saveDocAction and updated saveStatusAction to prevent premature JSON responses when changing document status
Core/Lib/AjaxForms/PurchasesController.php Applied the same fix as SalesController to ensure consistent behavior for purchases documents

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@daniel89fg daniel89fg closed this Nov 26, 2025
@daniel89fg daniel89fg deleted the bug-sendok-ajax-documents branch November 28, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants