1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

refactor invoice deletion

This commit is contained in:
David Bomba 2020-12-03 15:30:32 +11:00
parent f96bde6fca
commit d30ef031a2

View File

@ -77,11 +77,23 @@ class InvoiceRepository extends BaseRepository
return $invoice;
}
public function restore() :Invoice
/**
* Handles the restoration on a deleted invoice.
*
* @param [type] $invoice [description]
* @return [type] [description]
*/
public function restore($invoice) :Invoice
{
if(!$invoice->is_deleted)
return $invoice
//if we have just archived, only perform a soft restore
if(!$invoice->is_deleted) {
parent::restore($invoice);
return $invoice;
}
// reversed delete invoice actions
$invoice = $invoice->service()->handeRestore()->save()
parent::restore($invoice);