diff --git a/app/Models/Banking/Transaction.php b/app/Models/Banking/Transaction.php
index 20fcdedd6..f4fab4b7b 100644
--- a/app/Models/Banking/Transaction.php
+++ b/app/Models/Banking/Transaction.php
@@ -610,17 +610,19 @@ class Transaction extends Model
} catch (\Exception $e) {}
}
} else {
- try {
- $actions[] = [
- 'title' => trans('general.end'),
- 'icon' => 'block',
- 'url' => route($prefix. '.end', $this->id),
- 'permission' => 'update-banking-transactions',
- 'attributes' => [
- 'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id,
- ],
- ];
- } catch (\Exception $e) {}
+ if ($this->recurring && $this->recurring->status != 'ended') {
+ try {
+ $actions[] = [
+ 'title' => trans('general.end'),
+ 'icon' => 'block',
+ 'url' => route($prefix. '.end', $this->id),
+ 'permission' => 'update-banking-transactions',
+ 'attributes' => [
+ 'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id,
+ ],
+ ];
+ } catch (\Exception $e) {}
+ }
}
return $actions;
diff --git a/app/Models/Document/Document.php b/app/Models/Document/Document.php
index 314eb2eb3..aa6d4f26a 100644
--- a/app/Models/Document/Document.php
+++ b/app/Models/Document/Document.php
@@ -672,17 +672,19 @@ class Document extends Model
];
} catch (\Exception $e) {}
} else {
- try {
- $actions[] = [
- 'title' => trans('general.end'),
- 'icon' => 'block',
- 'url' => route($prefix. '.end', $this->id),
- 'permission' => 'update-' . $group . '-' . $permission_prefix,
- 'attributes' => [
- 'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id,
- ],
- ];
- } catch (\Exception $e) {}
+ if ($this->recurring && $this->recurring->status != 'ended') {
+ try {
+ $actions[] = [
+ 'title' => trans('general.end'),
+ 'icon' => 'block',
+ 'url' => route($prefix. '.end', $this->id),
+ 'permission' => 'update-' . $group . '-' . $permission_prefix,
+ 'attributes' => [
+ 'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id,
+ ],
+ ];
+ } catch (\Exception $e) {}
+ }
}
return $actions;
diff --git a/resources/views/components/documents/show/more-buttons.blade.php b/resources/views/components/documents/show/more-buttons.blade.php
index 3f6421010..9a84c9023 100644
--- a/resources/views/components/documents/show/more-buttons.blade.php
+++ b/resources/views/components/documents/show/more-buttons.blade.php
@@ -98,7 +98,7 @@
@stack('end_button_start')
- @if (! $hideEnd && $document->recurring)
+ @if (! $hideEnd && $document->recurring && $document->recurring->status != 'ended')
{{ trans('recurring.end') }}
diff --git a/resources/views/components/transactions/show/more-buttons.blade.php b/resources/views/components/transactions/show/more-buttons.blade.php
index 51eda8727..14fcd2c1c 100644
--- a/resources/views/components/transactions/show/more-buttons.blade.php
+++ b/resources/views/components/transactions/show/more-buttons.blade.php
@@ -107,7 +107,7 @@
@stack('button_end_start')
- @if (! $hideButtonEnd)
+ @if (! $hideButtonEnd && $transaction->recurring && $transaction->recurring->status != 'ended')
{{ trans('recurring.end') }}