mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fixes for recurring invoice edge case
This commit is contained in:
parent
264a4df13b
commit
8f5fb2ca9f
@ -215,7 +215,7 @@ class ReminderJob implements ShouldQueue
|
||||
$client = $client->fresh();
|
||||
|
||||
nlog('adjusting client balance and invoice balance by #'.$invoice->number.' '.($invoice->balance - $temp_invoice_balance));
|
||||
$client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save();
|
||||
$client->service()->updateBalance($invoice->balance - $temp_invoice_balance);
|
||||
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
|
||||
|
||||
$transaction = [
|
||||
|
@ -125,6 +125,7 @@ class Company extends BaseModel
|
||||
'invoice_task_project',
|
||||
'report_include_deleted',
|
||||
'invoice_task_lock',
|
||||
'use_vendor_currency',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
|
@ -79,7 +79,8 @@ class PurchaseOrder extends BaseModel
|
||||
'partial',
|
||||
'paid_to_date',
|
||||
'vendor_id',
|
||||
'last_viewed'
|
||||
'last_viewed',
|
||||
'currency_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
@ -29,7 +29,6 @@ class ClientService
|
||||
|
||||
public function updateBalance(float $amount)
|
||||
{
|
||||
// $this->client->balance += $amount;
|
||||
|
||||
\DB::connection(config('database.default'))->transaction(function () use($amount) {
|
||||
|
||||
@ -44,8 +43,6 @@ class ClientService
|
||||
|
||||
public function updateBalanceAndPaidToDate(float $balance, float $paid_to_date)
|
||||
{
|
||||
// $this->client->balance += $amount;
|
||||
// $this->client->paid_to_date += $amount;
|
||||
|
||||
\DB::connection(config('database.default'))->transaction(function () use($balance, $paid_to_date) {
|
||||
|
||||
|
@ -117,7 +117,7 @@ class InvoiceService
|
||||
public function applyPayment(Payment $payment, float $payment_amount)
|
||||
{
|
||||
// $this->deletePdf();
|
||||
$this->invoice = $this->markSent();
|
||||
$this->invoice = $this->markSent()->save();
|
||||
|
||||
$this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run();
|
||||
|
||||
|
@ -189,6 +189,7 @@ class CompanyTransformer extends EntityTransformer
|
||||
'invoice_task_project' => (bool) $company->invoice_task_project,
|
||||
'report_include_deleted' => (bool) $company->report_include_deleted,
|
||||
'invoice_task_lock' => (bool) $company->invoice_task_lock,
|
||||
'use_vendor_currency' => (bool) $company->use_vendor_currency,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,7 @@ class PurchaseOrderTransformer extends EntityTransformer
|
||||
'paid_to_date' => (float)$purchase_order->paid_to_date,
|
||||
'subscription_id' => $this->encodePrimaryKey($purchase_order->subscription_id),
|
||||
'expense_id' => $this->encodePrimaryKey($purchase_order->expense_id),
|
||||
'currency_id' => $purchase_order->currency_id ? (string) $purchase_order->currency_id : '',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,12 @@ return new class extends Migration
|
||||
Schema::table('companies', function (Blueprint $table)
|
||||
{
|
||||
$table->boolean('invoice_task_lock')->default(false);
|
||||
$table->boolean('use_vendor_currency')->default(false);
|
||||
});
|
||||
|
||||
Schema::table('purchase_orders', function (Blueprint $table)
|
||||
{
|
||||
$table->unsignedInteger('currency_id')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('bank_transactions', function (Blueprint $table)
|
||||
|
Loading…
Reference in New Issue
Block a user