1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for tests and partial_due_date output

This commit is contained in:
David Bomba 2024-01-21 14:21:12 +11:00
parent 1f77856829
commit 8880dd3f49
5 changed files with 7 additions and 5 deletions

View File

@ -78,7 +78,7 @@ class ExpenseExport extends BaseExport
'expense.net_amount'
];
$this->input['report_keys'] = array_merge($this->input['report_keys'], $tax_keys);
$this->input['report_keys'] = array_unique(array_merge($this->input['report_keys'], $tax_keys));
$query = Expense::query()
->with('client')

View File

@ -167,7 +167,7 @@ class InvoiceExport extends BaseExport
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name() : '';
}
nlog($entity);
return $entity;
}
}

View File

@ -80,7 +80,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property float $amount
* @property float $balance
* @property float|null $partial
* @property string|null $partial_due_date
* @property string|null|\Carbon\Carbon $partial_due_date
* @property string|null $last_viewed
* @property int|null $created_at
* @property int|null $updated_at
@ -401,7 +401,7 @@ class Invoice extends BaseModel
public function getStatusAttribute()
{
$due_date = $this->due_date ? Carbon::parse($this->due_date) : false;
$partial_due_date = $this->partial_due_Date ? Carbon::parse($this->partial_due_date) : false;
$partial_due_date = $this->partial_due_date ? Carbon::parse($this->partial_due_date) : false;
if ($this->status_id == self::STATUS_SENT && $due_date && $due_date->gt(now())) {
return self::STATUS_UNPAID;

View File

@ -132,7 +132,7 @@ class InvoiceTransformer extends EntityTransformer
'is_amount_discount' => (bool) ($invoice->is_amount_discount ?: false),
'footer' => $invoice->footer ?: '',
'partial' => (float) ($invoice->partial ?: 0.0),
'partial_due_date' => ($invoice->partial_due_date && $invoice->partial_due_date != "-0001-11-30") ? $invoice->partial_due_date : '',
'partial_due_date' => ($invoice->partial_due_date && $invoice->partial_due_date != "-0001-11-30") ? $invoice->partial_due_date->format('Y-m-d') : '',
'custom_value1' => (string) $invoice->custom_value1 ?: '',
'custom_value2' => (string) $invoice->custom_value2 ?: '',
'custom_value3' => (string) $invoice->custom_value3 ?: '',

View File

@ -2207,6 +2207,8 @@ class ReportCsvGenerationTest extends TestCase
$response = $this->poll($hash);
$csv = $response->body();
nlog($csv);
$this->assertEquals('100', $this->getFirstValueByColumn($csv, 'Expense Amount'));
$this->assertEquals('Public', $this->getFirstValueByColumn($csv, 'Expense Public Notes'));
$this->assertEquals('Private', $this->getFirstValueByColumn($csv, 'Expense Private Notes'));