diff --git a/app/Http/Controllers/Banking/Transactions.php b/app/Http/Controllers/Banking/Transactions.php index 593464198..5329c35c5 100644 --- a/app/Http/Controllers/Banking/Transactions.php +++ b/app/Http/Controllers/Banking/Transactions.php @@ -239,6 +239,19 @@ class Transactions extends Controller */ public function update(Transaction $transaction, Request $request) { + if ($transaction->document_id) { + $message = trans('transactions.messages.update_document_transaction'); + + flash($message)->error()->important(); + + return response()->json([ + 'success' => false, + 'error' => true, + 'message' => $message, + 'redirect' => route('transactions.edit', $transaction->id), + ]); + } + $response = $this->ajaxDispatch(new UpdateTransaction($transaction, $request)); if ($response['success']) { diff --git a/resources/lang/en-GB/transactions.php b/resources/lang/en-GB/transactions.php index 99a36c51a..fbb46b73f 100644 --- a/resources/lang/en-GB/transactions.php +++ b/resources/lang/en-GB/transactions.php @@ -49,6 +49,7 @@ return [ ], 'messages' => [ + 'update_document_transaction' => 'You can update this transaction. You should go to the document and edit it there.', 'create_document_transaction_error' => 'This endpoint cannot be added to a document. Use {{akaunting_url}}/documents/{{akaunting_document_id}}/transactions', 'update_document_transaction_error' => 'This endpoint cannot be updated to a document. Use {{akaunting_url}}/documents/{{akaunting_document_id}}/transactions/{akaunting_transaction_id}', 'delete_document_transaction_error' => 'This endpoint cannot be deleted to a document. Use {{akaunting_url}}/documents/{{akaunting_document_id}}/transactions/{akaunting_transaction_id}',