1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Minor fixes

This commit is contained in:
David Bomba 2024-10-17 11:02:46 +11:00
parent b90fb4515f
commit 8f386b1dd3
3 changed files with 74 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class ImportEDocument implements ShouldQueue
public function middleware() public function middleware()
{ {
return [new WithoutOverlapping($this->company->company_key."_expense_import")]; return [new WithoutOverlapping($this->company->company_key."_expense_import_".$this->file_name)];
} }
public function failed($exception = null) public function failed($exception = null)

View File

@ -5360,7 +5360,11 @@ $lang = array(
'vat_not_registered' => 'Seller not VAT registered', 'vat_not_registered' => 'Seller not VAT registered',
'small_company_info' => 'No disclosure of sales tax in accordance with § 19 UStG', 'small_company_info' => 'No disclosure of sales tax in accordance with § 19 UStG',
'log_duration_words' => 'Time log duration in words', 'log_duration_words' => 'Time log duration in words',
'log_duration' => 'Time log duration' 'log_duration' => 'Time log duration',
'merged_vendors' => 'Successfully merged vendors',
'hidden_taxes_warning' => 'Somes taxes are hidden due to current tax settings. :link',
'tax3' => 'Third Tax',
); );
return $lang; return $lang;

View File

@ -49,6 +49,74 @@ class InvoiceTest extends TestCase
$this->invoice_calc = new InvoiceSum($this->invoice); $this->invoice_calc = new InvoiceSum($this->invoice);
} }
public function testRefundPaidToDateRelation()
{
$c = \App\Models\Client::factory()->create([
'user_id' => $this->user->id,
'company_id' => $this->company->id,
]);
$item = InvoiceItemFactory::create();
$item->quantity = 1;
$item->cost = 10.00;
$item->type_id = '1';
$item->tax_id = '1';
$line_items[] = $item;
$i = Invoice::factory()->create([
'discount' => 0,
'tax_name1' => '',
'tax_name2' => '',
'tax_name3' => '',
'tax_rate1' => 0,
'tax_rate2' => 0,
'tax_rate3' => 0,
'user_id' => $this->user->id,
'company_id' => $this->company->id,
'client_id' => $c->id,
'line_items' => $line_items,
'status_id' => 1,
'uses_inclusive_taxes' => false,
]);
$invoice_calc = new InvoiceSum($i);
$ii = $invoice_calc->build()->getInvoice();
$ii->service()->markSent()->save();
$this->assertEquals(10, $ii->balance);
$this->assertEquals(2, $ii->status_id);
$ii = $ii->service()->markPaid()->save();
$this->assertEquals(10, $ii->amount);
$this->assertEquals(0, $ii->balance);
$this->assertEquals(10, $ii->paid_to_date);
$this->assertEquals(2, $ii->status_id);
$p = $ii->payments->first();
$this->assertEquals(10, $p->amount);
$this->assertEquals(10, $p->applied);
$this->assertEquals(0, $p->refunded);
$refund_data['gateway_refund']=false;
$refund_data['invoices'][] = [
'invoice_id' => $ii->id,
'amount' => 10
];
$p->service()->refundPayment($refund_data);
$ii = $ii->fresh();
$this->assertEquals(2, $ii->status_id);
$this->assertEquals(10, $ii->balance);
$this->assertEquals(0, $ii->paid_to_date);
}
public function testRappenRounding() public function testRappenRounding()
{ {