mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Prevent duplicate deletions
This commit is contained in:
parent
4eae70400e
commit
39f426e352
@ -20,6 +20,10 @@ class BaseRepository
|
|||||||
|
|
||||||
public function archive($entity)
|
public function archive($entity)
|
||||||
{
|
{
|
||||||
|
if ($entity->trashed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$entity->delete();
|
$entity->delete();
|
||||||
|
|
||||||
$className = $this->getEventClass($entity, 'Archived');
|
$className = $this->getEventClass($entity, 'Archived');
|
||||||
@ -31,6 +35,10 @@ class BaseRepository
|
|||||||
|
|
||||||
public function restore($entity)
|
public function restore($entity)
|
||||||
{
|
{
|
||||||
|
if ( ! $entity->trashed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$fromDeleted = false;
|
$fromDeleted = false;
|
||||||
$entity->restore();
|
$entity->restore();
|
||||||
|
|
||||||
@ -49,6 +57,10 @@ class BaseRepository
|
|||||||
|
|
||||||
public function delete($entity)
|
public function delete($entity)
|
||||||
{
|
{
|
||||||
|
if ($entity->is_deleted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$entity->is_deleted = true;
|
$entity->is_deleted = true;
|
||||||
$entity->save();
|
$entity->save();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user