diff --git a/app/Filters/ClientFilters.php b/app/Filters/ClientFilters.php index 4d4102e0379c..528bf64b49ff 100644 --- a/app/Filters/ClientFilters.php +++ b/app/Filters/ClientFilters.php @@ -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. * diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index ba81318fcf5a..eab8fd438841 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -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'); diff --git a/app/Jobs/Cron/AutoBillCron.php b/app/Jobs/Cron/AutoBillCron.php index 789549692fbb..fcd6c3c876c0 100644 --- a/app/Jobs/Cron/AutoBillCron.php +++ b/app/Jobs/Cron/AutoBillCron.php @@ -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(); } } diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index 96ed926e734d..6d5b6986fcbf 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -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 */ diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index ea9dc5988764..1e4a3653050d 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -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 { diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index a5d2979b44ff..0926abf7b9e2 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -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; } diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index b12f3a9a80b2..2a9b36f953bf 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -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',