diff --git a/app/Filters/SystemLogFilters.php b/app/Filters/SystemLogFilters.php index 81eb088e7096..1ccf41b01d56 100644 --- a/app/Filters/SystemLogFilters.php +++ b/app/Filters/SystemLogFilters.php @@ -34,11 +34,6 @@ class SystemLogFilters extends QueryFilters return $this->builder->where('event_id', $event_id); } - public function client_id(int $client_id) :Builder - { - return $this->builder->where('client_id', $client_id); - } - /** * Filter based on search text. * diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 057045531e71..dc0fef5605ec 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -30,6 +30,7 @@ use App\Providers\MailServiceProvider; use App\Utils\Ninja; use App\Utils\Traits\MakesHash; use Dacastro4\LaravelGmail\Facade\LaravelGmail; +use GuzzleHttp\Exception\ClientException; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; @@ -118,10 +119,18 @@ class NinjaMailerJob implements ShouldQueue nlog("error failed with {$e->getMessage()}"); - if($this->nmo->entity) - $this->entityEmailFailed($e->getMessage()); + $message = $e->getMessage(); - if(Ninja::isHosted()) + if($e instanceof ClientException) { //postmark specific failure + + $response = $e->getResponse(); + $message = $response->Message; + } + + if($this->nmo->entity) + $this->entityEmailFailed($message); + + if(Ninja::isHosted() && (!$e instanceof ClientException)) // Don't send postmark failures to Sentry app('sentry')->captureException($e); } } @@ -241,6 +250,7 @@ class NinjaMailerJob implements ShouldQueue private function logMailError($errors, $recipient_object) { + SystemLogger::dispatch( $errors, SystemLog::CATEGORY_MAIL, @@ -249,19 +259,18 @@ class NinjaMailerJob implements ShouldQueue $recipient_object, $this->nmo->company ); - } - public function failed($exception = null) - { - nlog('mailer job failed'); - nlog($exception->getMessage()); - $job_failure = new EmailFailure($this->nmo->company->company_key); $job_failure->string_metric5 = 'failed_email'; - $job_failure->string_metric6 = substr($exception->getMessage(), 0, 150); + $job_failure->string_metric6 = substr($errors, 0, 150); LightLogs::create($job_failure) ->batch(); } + public function failed($exception = null) + { + + } + } \ No newline at end of file diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index fb53e5a953cd..6dad60647d25 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -301,7 +301,10 @@ trait MakesInvoiceValues $data[$key][$table_type . ".{$_table_type}3"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}3", $item->custom_value3, $this->client); $data[$key][$table_type . ".{$_table_type}4"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}4", $item->custom_value4, $this->client); - $data[$key][$table_type.'.quantity'] = Number::formatValue($item->quantity, $this->client->currency()); + //$data[$key][$table_type.'.quantity'] = Number::formatValue($item->quantity, $this->client->currency()); + + //change quantity from localized number, to decimal format with no trailing zeroes 06/09/21 + $data[$key][$table_type.'.quantity'] = rtrim($item->quantity, "0"); $data[$key][$table_type.'.unit_cost'] = Number::formatMoney($item->cost, $this->client); $data[$key][$table_type.'.cost'] = Number::formatMoney($item->cost, $this->client);