Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Core/Lib/AjaxForms/PurchasesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ protected function recalculateAction(bool $renderLines): bool
return false;
}

protected function saveDocAction(): bool
protected function saveDocAction(bool $sendOk = true): bool
{
$this->setTemplate(false);

Expand Down Expand Up @@ -403,7 +403,10 @@ protected function saveDocAction(): bool
return false;
}

$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
if ($sendOk) {
$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
}

$this->dataBase->commit();
return true;
}
Expand Down Expand Up @@ -476,7 +479,7 @@ protected function saveStatusAction(): bool
return false;
}

if ($this->getModel()->editable && false === $this->saveDocAction()) {
if ($this->getModel()->editable && false === $this->saveDocAction(false)) {
return false;
}

Expand Down
9 changes: 6 additions & 3 deletions Core/Lib/AjaxForms/SalesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ protected function recalculateAction(bool $renderLines): bool
return false;
}

protected function saveDocAction(): bool
protected function saveDocAction(bool $sendOk = true): bool
{
$this->setTemplate(false);

Expand Down Expand Up @@ -418,7 +418,10 @@ protected function saveDocAction(): bool
return false;
}

$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
if ($sendOk) {
$this->sendJsonWithLogs(['ok' => true, 'newurl' => $model->url() . '&action=save-ok']);
}

$this->dataBase->commit();
return true;
}
Expand Down Expand Up @@ -490,7 +493,7 @@ protected function saveStatusAction(): bool
return false;
}

if ($this->getModel()->editable && false === $this->saveDocAction()) {
if ($this->getModel()->editable && false === $this->saveDocAction(false)) {
return false;
}

Expand Down
Loading