Skip to content

Commit daaf104

Browse files
author
Daniel Fernández Giménez
committed
Bug al responder por controlador las llamadas ajax de los documentos al cambiar el estado
1 parent 136f500 commit daaf104

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Core/Lib/AjaxForms/PurchasesController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ protected function recalculateAction(bool $renderLines): bool
351351
return false;
352352
}
353353

354-
protected function saveDocAction(): bool
354+
protected function saveDocAction(bool $sendOk = true): bool
355355
{
356356
$this->setTemplate(false);
357357

@@ -403,7 +403,10 @@ protected function saveDocAction(): bool
403403
return false;
404404
}
405405

406-
$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
406+
if ($sendOk) {
407+
$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
408+
}
409+
407410
$this->dataBase->commit();
408411
return true;
409412
}
@@ -476,7 +479,7 @@ protected function saveStatusAction(): bool
476479
return false;
477480
}
478481

479-
if ($this->getModel()->editable && false === $this->saveDocAction()) {
482+
if ($this->getModel()->editable && false === $this->saveDocAction(false)) {
480483
return false;
481484
}
482485

Core/Lib/AjaxForms/SalesController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ protected function recalculateAction(bool $renderLines): bool
366366
return false;
367367
}
368368

369-
protected function saveDocAction(): bool
369+
protected function saveDocAction(bool $sendOk = true): bool
370370
{
371371
$this->setTemplate(false);
372372

@@ -418,7 +418,10 @@ protected function saveDocAction(): bool
418418
return false;
419419
}
420420

421-
$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
421+
if ($sendOk) {
422+
$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
423+
}
424+
422425
$this->dataBase->commit();
423426
return true;
424427
}
@@ -490,7 +493,7 @@ protected function saveStatusAction(): bool
490493
return false;
491494
}
492495

493-
if ($this->getModel()->editable && false === $this->saveDocAction()) {
496+
if ($this->getModel()->editable && false === $this->saveDocAction(false)) {
494497
return false;
495498
}
496499

0 commit comments

Comments
 (0)