1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 14:42:42 +01:00
invoiceninja/app/Utils/Traits/Invoice/ActionsInvoice.php
David Bomba 2fd3229efd
Implementation of Invoice Reversal (#3602)
* Version bump 0.0.2

* code cleanup

* Working on reversing an invoice

* Working on reversing an invoice

* Working on refunding invoice

* Reversing invoices

* Test for invoice reversals

* Invoice Reversal
2020-04-08 20:48:31 +10:00

46 lines
1.1 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Utils\Traits\Invoice;
use App\Models\Invoice;
trait ActionsInvoice
{
public function invoiceDeletable($invoice) :bool
{
if($invoice->status_id <= Invoice::STATUS_SENT && $invoice->is_deleted == false && $invoice->deleted_at == NULL)
return true;
return false;
}
public function invoiceCancellable($invoice) :bool
{
if($invoice->status_id == Invoice::STATUS_PARTIAL && $invoice->is_deleted == false && $invoice->deleted_at == NULL)
return true;
return false;
}
public function invoiceReversable($invoice) :bool
{
if(($invoice->status_id == Invoice::STATUS_SENT || $invoice->status_id == Invoice::STATUS_PARTIAL || $invoice->status_id == Invoice::STATUS_PAID) && $invoice->is_deleted == false && $invoice->deleted_at == NULL)
return true;
return false;
}
}