1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #6389 from turbo124/v5-develop

Set Recurring to draft if not being sent at time of creation
This commit is contained in:
David Bomba 2021-08-05 19:41:12 +10:00 committed by GitHub
commit e07befe4e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 16 deletions

View File

@ -76,6 +76,11 @@ class ClientFilters extends QueryFilters
return $this->builder->where('id_number', $id_number);
}
public function number(string $number):Builder
{
return $this->builder->where('number', $number);
}
/**
* Filter based on search text.
*

View File

@ -193,7 +193,7 @@ class PreviewController extends BaseController
try {
DB::connection(config('database.default'))->beginTransaction();
DB::connection(auth()->user()->company()->db)->beginTransaction();
if($request->has('entity_id')){
@ -253,7 +253,7 @@ class PreviewController extends BaseController
->design($template)
->build();
DB::connection(config('database.default'))->rollBack();
DB::connection(auth()->user()->company()->db)->rollBack();
if (request()->query('html') == 'true') {
return $maker->getCompiledHTML;
@ -263,7 +263,7 @@ class PreviewController extends BaseController
}
catch(\Exception $e){
DB::connection(config('database.default'))->rollBack();
DB::connection(auth()->user()->company()->db)->rollBack();
return;
}
@ -302,7 +302,7 @@ class PreviewController extends BaseController
$t = app('translator');
$t->replace(Ninja::transformTranslations(auth()->user()->company()->settings));
DB::connection(config('database.default'))->beginTransaction();
DB::connection(auth()->user()->company()->db)->beginTransaction();
$client = Client::factory()->create([
'user_id' => auth()->user()->id,
@ -377,7 +377,7 @@ class PreviewController extends BaseController
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
DB::connection(config('database.default'))->rollBack();
DB::connection(auth()->user()->company()->db)->rollBack();
$response = Response::make($file_path, 200);
$response->header('Content-Type', 'application/pdf');

View File

@ -43,7 +43,7 @@ class AutoBillCron
set_time_limit(0);
/* Get all invoices where the send date is less than NOW + 30 minutes() */
nlog("Performing Autobilling ".Carbon::now()->format('Y-m-d h:i:s'));
info("Performing Autobilling ".Carbon::now()->format('Y-m-d h:i:s'));
if (! config('ninja.db.multi_db_enabled')) {
@ -95,7 +95,7 @@ class AutoBillCron
private function runAutoBiller(Invoice $invoice)
{
nlog("Firing autobill for {$invoice->company_id} - {$invoice->number}");
info("Firing autobill for {$invoice->company_id} - {$invoice->number}");
$invoice->service()->autoBill()->save();
}
}

View File

@ -61,12 +61,22 @@ class SendRecurring implements ShouldQueue
$invoice->date = now()->format('Y-m-d');
$invoice = $invoice->service()
->markSent()
->applyNumber()
->createInvitations()
->fillDefaults()
->save();
if($invoice->client->getSetting('auto_email_invoice'))
{
$invoice = $invoice->service()
->markSent()
->applyNumber()
->createInvitations()
->fillDefaults()
->save();
}
else{
$invoice = $invoice->service()
->fillDefaults()
->save();
}
nlog("updating recurring invoice dates");
/* Set next date here to prevent a recurring loop forming */

View File

@ -105,7 +105,6 @@ class ACH
$this->stripe->init();
// $bank_account = Customer::retrieveSource($request->customer, ['source' => $request->source], $this->stripe->stripe_connect_auth);
$bank_account = Customer::retrieveSource($request->customer, $request->source, [], $this->stripe->stripe_connect_auth);
try {

View File

@ -99,6 +99,10 @@ class AutoBillInvoice extends AbstractService
->setPaymentHash($payment_hash)
->tokenBilling($gateway_token, $payment_hash);
if($payment){
info("Auto Bill payment captured for ".$this->invoice->number);
}
return $this->invoice;
}

View File

@ -3948,8 +3948,8 @@ https://invoiceninja.github.io/docs/migration/#troubleshooting',
'download_timeframe' => 'Use this link to download your files, the link will expire in 1 hour.',
'new_signup' => 'Neue Registrierung',
'new_signup_text' => 'Ein neuer Benutzer wurde von :user - :email von der IP: :ip erstellt',
'notification_payment_paid_subject' => 'Neue Zahlung von :Kunde',
'notification_partial_payment_paid_subject' => 'Neue Anzahlung von :Kunde',
'notification_payment_paid_subject' => 'Neue Zahlung von :client',
'notification_partial_payment_paid_subject' => 'Neue Anzahlung von :client',
'notification_payment_paid' => 'A payment of :amount was made by client :client towards :invoice',
'notification_partial_payment_paid' => 'A partial payment of :amount was made by client :client towards :invoice',
'notification_bot' => 'Benachrichtigungs-Bot',