1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Prevent duplicate deletions

This commit is contained in:
Hillel Coren 2016-03-23 15:02:53 +02:00
parent 4eae70400e
commit 39f426e352

View File

@ -20,6 +20,10 @@ class BaseRepository
public function archive($entity)
{
if ($entity->trashed()) {
return;
}
$entity->delete();
$className = $this->getEventClass($entity, 'Archived');
@ -31,6 +35,10 @@ class BaseRepository
public function restore($entity)
{
if ( ! $entity->trashed()) {
return;
}
$fromDeleted = false;
$entity->restore();
@ -49,6 +57,10 @@ class BaseRepository
public function delete($entity)
{
if ($entity->is_deleted) {
return;
}
$entity->is_deleted = true;
$entity->save();