mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for tests
This commit is contained in:
parent
bbcbfe9821
commit
5ed098fc9c
@ -114,7 +114,7 @@ class StoreInvoiceRequest extends Request
|
||||
}
|
||||
|
||||
//handles edge case where we need for force set the due date of the invoice.
|
||||
if((isset($input['partial_due_date']) && strlen($input['partial_due_date']) > 1) && (!array_key_exists('due_date', $input) || strlen($input['due_date']) == 0)) {
|
||||
if((isset($input['partial_due_date']) && strlen($input['partial_due_date']) > 1) && (!array_key_exists('due_date', $input) || (empty($input['due_date']) && empty($this->invoice->due_date)))) {
|
||||
$client = \App\Models\Client::withTrashed()->find($input['client_id']);
|
||||
$input['due_date'] = \Illuminate\Support\Carbon::parse($input['date'])->addDays($client->getSetting('payment_terms'))->format('Y-m-d');
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class UpdateInvoiceRequest extends Request
|
||||
}
|
||||
|
||||
//handles edge case where we need for force set the due date of the invoice.
|
||||
if((isset($input['partial_due_date']) && strlen($input['partial_due_date']) > 1) && (!array_key_exists('due_date', $input) || strlen($input['due_date']) == 0 || empty($this->invoice->due_date))) {
|
||||
if((isset($input['partial_due_date']) && strlen($input['partial_due_date']) > 1) && (!array_key_exists('due_date', $input) || (empty($input['due_date']) && empty($this->invoice->due_date)))) {
|
||||
$client = \App\Models\Client::withTrashed()->find($input['client_id']);
|
||||
$input['due_date'] = \Illuminate\Support\Carbon::parse($input['date'])->addDays($client->getSetting('payment_terms'))->format('Y-m-d');
|
||||
}
|
||||
|
@ -18,6 +18,28 @@ use App\Utils\Traits\MakesHash;
|
||||
class StoreSchedulerRequest extends Request
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
public array $client_statuses = [
|
||||
'all',
|
||||
'draft',
|
||||
'paid',
|
||||
'unpaid',
|
||||
'overdue',
|
||||
'pending',
|
||||
'invoiced',
|
||||
'logged',
|
||||
'partial',
|
||||
'applied',
|
||||
'active',
|
||||
'paused',
|
||||
'completed',
|
||||
'approved',
|
||||
'expired',
|
||||
'upcoming',
|
||||
'converted',
|
||||
'uninvoiced',
|
||||
];
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
@ -73,10 +95,18 @@ class StoreSchedulerRequest extends Request
|
||||
|
||||
if(isset($input['parameters']['status'])) {
|
||||
|
||||
$task_statuses = [];
|
||||
|
||||
if($input['parameters']['report_name'] == 'task') {
|
||||
$task_statuses = array_diff(explode(",", $input['parameters']['status']), $this->client_statuses);
|
||||
}
|
||||
|
||||
$input['parameters']['status'] = collect(explode(",", $input['parameters']['status']))
|
||||
->filter(function ($status) {
|
||||
return in_array($status, ['all','draft','paid','unpaid','overdue']);
|
||||
})->implode(",") ?? '';
|
||||
return in_array($status, $this->client_statuses);
|
||||
})->merge($task_statuses)
|
||||
->implode(",") ?? '';
|
||||
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
|
@ -137,7 +137,7 @@ class Gateway extends StaticModel
|
||||
case 56:
|
||||
return [
|
||||
GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true, 'webhooks' => ['payment_intent.succeeded', 'payment_intent.payment_failed']],
|
||||
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'customer.source.updated','payment_intent.processing', 'payment_intent.payment_failed']],
|
||||
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'customer.source.updated','payment_intent.processing', 'payment_intent.payment_failed', 'charge.failed']],
|
||||
GatewayType::DIRECT_DEBIT => ['refund' => false, 'token_billing' => false, 'webhooks' => ['payment_intent.processing','payment_intent.succeeded','payment_intent.partially_funded', 'payment_intent.payment_failed']],
|
||||
GatewayType::ALIPAY => ['refund' => false, 'token_billing' => false],
|
||||
GatewayType::APPLE_PAY => ['refund' => false, 'token_billing' => false],
|
||||
|
@ -359,7 +359,7 @@ class RecurringInvoice extends BaseModel
|
||||
return self::STATUS_COMPLETED;
|
||||
elseif ($new_model && $this->status_id == self::STATUS_ACTIVE && Carbon::parse($this->next_send_date)->isFuture())
|
||||
return self::STATUS_PENDING;
|
||||
elseif($this->remaining_cycles != 0)
|
||||
elseif($this->remaining_cycles != 0 && ($this->status_id == self::STATUS_COMPLETED))
|
||||
return self::STATUS_ACTIVE;
|
||||
|
||||
return $this->status_id;
|
||||
|
Loading…
Reference in New Issue
Block a user