close #3099 Fixed: Recurring transaction number dublicate issue

This commit is contained in:
Cüneyt Şentürk 2023-11-29 15:06:05 +03:00
parent 4132ef51b6
commit 116480762d
3 changed files with 5 additions and 5 deletions

View File

@ -70,7 +70,7 @@ class RecurringTransactions extends Controller
$real_type = $this->getTypeTransaction(request()->get('real_type', $this->getRealTypeOfRecurringTransaction($type)));
$contact_type = config('type.transaction.' . $real_type . '.contact_type', 'customer');
$number = $this->getNextTransactionNumber('-recurring');
$number = $this->getNextTransactionNumber($type, '-recurring');
$account_currency_code = Account::where('id', setting('default.account'))->pluck('currency_code')->first();
@ -169,7 +169,7 @@ class RecurringTransactions extends Controller
$real_type = $this->getTypeTransaction(request()->get('real_type', $this->getRealTypeOfRecurringTransaction($type)));
$contact_type = config('type.transaction.' . $real_type . '.contact_type', 'customer');
$number = $this->getNextTransactionNumber('-recurring');
$number = $this->getNextTransactionNumber($type, '-recurring');
$currency = Currency::where('code', $recurring_transaction->currency_code)->first();

View File

@ -20,6 +20,6 @@ class IncreaseNextTransactionNumber
$suffix = $event->transaction->isRecurringTransaction() ? '-recurring' : '';
// Update next transaction number
$this->increaseNextTransactionNumber($suffix);
$this->increaseNextTransactionNumber($event->transaction->type, $suffix);
}
}

View File

@ -243,10 +243,10 @@ class Version300 extends Listener
// Create the recurring template
$clone = $model->duplicate();
$clone->type = $clone->type . '-recurring';
$clone->$number_field = $this->getNextTransactionNumber('-recurring');
$clone->$number_field = $this->getNextTransactionNumber($clone->type, '-recurring');
$clone->saveQuietly();
$this->increaseNextTransactionNumber('-recurring');
$this->increaseNextTransactionNumber($clone->type, '-recurring');
// Update the recurring table
$recurring->recurable_id = $clone->id;