mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
55838ede51
@ -77,7 +77,7 @@ class Handler extends ExceptionHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Ninja::isHosted()){
|
if(Ninja::isHosted() && !($exception instanceof ValidationException)){
|
||||||
|
|
||||||
app('sentry')->configureScope(function (Scope $scope): void {
|
app('sentry')->configureScope(function (Scope $scope): void {
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class PreviewController extends BaseController
|
|||||||
$t = app('translator');
|
$t = app('translator');
|
||||||
$t->replace(Ninja::transformTranslations(auth()->user()->company()->settings));
|
$t->replace(Ninja::transformTranslations(auth()->user()->company()->settings));
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::connection(config('database.default'))->beginTransaction();
|
||||||
|
|
||||||
$client = Client::factory()->create([
|
$client = Client::factory()->create([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
@ -230,7 +230,7 @@ class PreviewController extends BaseController
|
|||||||
|
|
||||||
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
|
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
|
||||||
|
|
||||||
DB::rollBack();
|
DB::connection(config('database.default'))->rollBack();
|
||||||
|
|
||||||
$response = Response::make($file_path, 200);
|
$response = Response::make($file_path, 200);
|
||||||
$response->header('Content-Type', 'application/pdf');
|
$response->header('Content-Type', 'application/pdf');
|
||||||
|
@ -45,6 +45,7 @@ class RecurringInvoicesCron
|
|||||||
if (! config('ninja.db.multi_db_enabled')) {
|
if (! config('ninja.db.multi_db_enabled')) {
|
||||||
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
||||||
->whereNotNull('next_send_date')
|
->whereNotNull('next_send_date')
|
||||||
|
->whereNull('deleted_at')
|
||||||
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
|
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
|
||||||
->where('remaining_cycles', '!=', '0')
|
->where('remaining_cycles', '!=', '0')
|
||||||
->with('company')
|
->with('company')
|
||||||
@ -66,6 +67,7 @@ class RecurringInvoicesCron
|
|||||||
|
|
||||||
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
||||||
->whereNotNull('next_send_date')
|
->whereNotNull('next_send_date')
|
||||||
|
->whereNull('deleted_at')
|
||||||
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
|
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
|
||||||
->where('remaining_cycles', '!=', '0')
|
->where('remaining_cycles', '!=', '0')
|
||||||
->with('company')
|
->with('company')
|
||||||
|
@ -224,6 +224,13 @@ class RecurringInvoice extends BaseModel
|
|||||||
|
|
||||||
$offset = $this->client->timezone_offset();
|
$offset = $this->client->timezone_offset();
|
||||||
|
|
||||||
|
/*
|
||||||
|
As we are firing at UTC+0 if our offset is negative it is technically firing the day before so we always need
|
||||||
|
to add ON a day - a day = 86400 seconds
|
||||||
|
*/
|
||||||
|
if($offset < 0)
|
||||||
|
$offset += 86400;
|
||||||
|
|
||||||
switch ($this->frequency_id) {
|
switch ($this->frequency_id) {
|
||||||
case self::FREQUENCY_DAILY:
|
case self::FREQUENCY_DAILY:
|
||||||
return Carbon::parse($this->next_send_date)->startOfDay()->addDay()->addSeconds($offset);
|
return Carbon::parse($this->next_send_date)->startOfDay()->addDay()->addSeconds($offset);
|
||||||
@ -428,17 +435,14 @@ class RecurringInvoice extends BaseModel
|
|||||||
'due_date' => $next_due_date_string
|
'due_date' => $next_due_date_string
|
||||||
];
|
];
|
||||||
|
|
||||||
$next_send_date = $this->nextDateByFrequency($next_send_date->format('Y-m-d'));
|
/* Fixes the timeshift in case the offset is negative which cause a infinite loop due to UTC +0*/
|
||||||
|
if($this->client->timezone_offset() < 0){
|
||||||
|
$next_send_date = $this->nextDateByFrequency($next_send_date->addDay()->format('Y-m-d'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$next_send_date = $this->nextDateByFrequency($next_send_date->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*If no due date is set - unset the due_date value */
|
|
||||||
// if(!$this->due_date_days || $this->due_date_days == 0){
|
|
||||||
|
|
||||||
// foreach($data as $key => $value)
|
|
||||||
// $data[$key]['due_date'] = '';
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class ACH
|
|||||||
|
|
||||||
public function paymentResponse($request)
|
public function paymentResponse($request)
|
||||||
{
|
{
|
||||||
nlog($request->all());
|
// nlog($request->all());
|
||||||
|
|
||||||
$token = ClientGatewayToken::find($this->decodePrimaryKey($request->input('source')));
|
$token = ClientGatewayToken::find($this->decodePrimaryKey($request->input('source')));
|
||||||
$token_meta = $token->meta;
|
$token_meta = $token->meta;
|
||||||
|
@ -24,8 +24,13 @@ trait WePayCommon
|
|||||||
private function processSuccessfulPayment($response, $payment_status, $gateway_type)
|
private function processSuccessfulPayment($response, $payment_status, $gateway_type)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if($gateway_type == GatewayType::BANK_TRANSFER)
|
||||||
|
$payment_type = PaymentType::ACH;
|
||||||
|
else
|
||||||
|
$payment_type = PaymentType::CREDIT_CARD_OTHER;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_type' => PaymentType::CREDIT_CARD_OTHER,
|
'payment_type' => $payment_type,
|
||||||
'amount' => $response->amount,
|
'amount' => $response->amount,
|
||||||
'transaction_reference' => $response->checkout_id,
|
'transaction_reference' => $response->checkout_id,
|
||||||
'gateway_type_id' => $gateway_type,
|
'gateway_type_id' => $gateway_type,
|
||||||
|
@ -45,8 +45,8 @@ class SubscriptionRepository extends BaseRepository
|
|||||||
private function calculatePrice($subscription) :array
|
private function calculatePrice($subscription) :array
|
||||||
{
|
{
|
||||||
|
|
||||||
DB::beginTransaction();
|
// DB::beginTransaction();
|
||||||
|
DB::connection(config('database.default'))->beginTransaction();
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$client = Client::factory()->create([
|
$client = Client::factory()->create([
|
||||||
@ -90,8 +90,9 @@ class SubscriptionRepository extends BaseRepository
|
|||||||
|
|
||||||
$data['promo_price'] = $invoice->calc()->getTotal();
|
$data['promo_price'] = $invoice->calc()->getTotal();
|
||||||
|
|
||||||
DB::rollBack();
|
// DB::rollBack();
|
||||||
|
DB::connection(config('database.default'))->rollBack();
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ class TemplateEngine
|
|||||||
|
|
||||||
private function mockEntity()
|
private function mockEntity()
|
||||||
{
|
{
|
||||||
DB::beginTransaction();
|
DB::connection(config('database.default'))->beginTransaction();
|
||||||
|
|
||||||
$client = Client::factory()->create([
|
$client = Client::factory()->create([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
@ -277,6 +277,6 @@ class TemplateEngine
|
|||||||
|
|
||||||
private function tearDown()
|
private function tearDown()
|
||||||
{
|
{
|
||||||
DB::rollBack();
|
DB::connection(config('database.default'))->rollBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user