1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Utils/Traits/Invoice/ActionsInvoice.php

56 lines
1.4 KiB
PHP
Raw Normal View History

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Utils\Traits\Invoice;
use App\Models\Invoice;
trait ActionsInvoice
{
2024-01-14 05:05:00 +01:00
public function invoiceDeletable($invoice): bool
{
if ($invoice->status_id <= Invoice::STATUS_SENT &&
$invoice->is_deleted == false &&
$invoice->deleted_at == null &&
$invoice->balance == 0) {
return true;
}
return false;
}
2024-01-14 05:05:00 +01:00
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;
}
2024-01-14 05:05:00 +01:00
public function invoiceReversable($invoice): bool
{
if (($invoice->status_id == Invoice::STATUS_SENT ||
$invoice->status_id == Invoice::STATUS_PARTIAL ||
$invoice->status_id == Invoice::STATUS_CANCELLED ||
$invoice->status_id == Invoice::STATUS_PAID) &&
$invoice->is_deleted == false &&
$invoice->deleted_at == null) {
return true;
}
return false;
}
}