mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-11-13 18:07:10 -05:00
* Performance improvements moving from str_replace to strtr * Remove legacy docs * Clean up credit transformer * Working on invoice emails * Clean up for invoice designs * Tests for light and dark theme emails * Working on reminder scheduling * Reminder Job Class * Fixes for github actions * PHP CS * Test for reminders * Test for reminders
45 lines
1.2 KiB
PHP
45 lines
1.2 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_SENT || $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;
|
|
}
|
|
}
|