mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 21:44:35 -04:00
refactor invoice deletion
This commit is contained in:
parent
f96bde6fca
commit
d30ef031a2
@ -77,11 +77,23 @@ class InvoiceRepository extends BaseRepository
|
|||||||
return $invoice;
|
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)
|
//if we have just archived, only perform a soft restore
|
||||||
return $invoice
|
if(!$invoice->is_deleted) {
|
||||||
|
|
||||||
|
parent::restore($invoice);
|
||||||
|
|
||||||
|
return $invoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reversed delete invoice actions
|
||||||
$invoice = $invoice->service()->handeRestore()->save()
|
$invoice = $invoice->service()->handeRestore()->save()
|
||||||
|
|
||||||
parent::restore($invoice);
|
parent::restore($invoice);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user