mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
29d6a56296
@ -1 +1 @@
|
|||||||
5.5.20
|
5.5.21
|
59
app/DataMapper/Analytics/EmailCount.php
Normal file
59
app/DataMapper/Analytics/EmailCount.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\DataMapper\Analytics;
|
||||||
|
|
||||||
|
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||||
|
|
||||||
|
class EmailCount extends GenericMixedMetric
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The type of Sample.
|
||||||
|
*
|
||||||
|
* Monotonically incrementing counter
|
||||||
|
*
|
||||||
|
* - counter
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'mixed_metric';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the counter.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name = 'account.daily_email_count';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The datetime of the counter measurement.
|
||||||
|
*
|
||||||
|
* date("Y-m-d H:i:s")
|
||||||
|
*
|
||||||
|
* @var DateTime
|
||||||
|
*/
|
||||||
|
public $datetime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class failure name
|
||||||
|
* set to 0.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $string_metric5 = 'account_key';
|
||||||
|
|
||||||
|
public $int_metric1 = 1;
|
||||||
|
|
||||||
|
public function __construct($int_metric1, $string_metric5)
|
||||||
|
{
|
||||||
|
$this->int_metric1 = $int_metric1;
|
||||||
|
$this->string_metric5 = $string_metric5;
|
||||||
|
}
|
||||||
|
}
|
@ -306,7 +306,7 @@ class PreviewController extends BaseController
|
|||||||
if (Ninja::isHosted()) {
|
if (Ninja::isHosted()) {
|
||||||
LightLogs::create(new LivePreview())
|
LightLogs::create(new LivePreview())
|
||||||
->increment()
|
->increment()
|
||||||
->queue();
|
->batch();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = Response::make($file_path, 200);
|
$response = Response::make($file_path, 200);
|
||||||
|
@ -69,7 +69,7 @@ class QueryLogging
|
|||||||
}
|
}
|
||||||
|
|
||||||
LightLogs::create(new DbQuery($request->method(), substr(urldecode($request->url()),0,180), $count, $time, $ip))
|
LightLogs::create(new DbQuery($request->method(), substr(urldecode($request->url()),0,180), $count, $time, $ip))
|
||||||
->queue();
|
->batch();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -123,7 +123,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
->send($this->nmo->mailable);
|
->send($this->nmo->mailable);
|
||||||
|
|
||||||
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
|
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
|
||||||
->queue();
|
->batch();
|
||||||
|
|
||||||
/* Count the amount of emails sent across all the users accounts */
|
/* Count the amount of emails sent across all the users accounts */
|
||||||
Cache::increment($this->company->account->key);
|
Cache::increment($this->company->account->key);
|
||||||
|
@ -217,7 +217,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
|
|||||||
$this->request['MessageID']
|
$this->request['MessageID']
|
||||||
);
|
);
|
||||||
|
|
||||||
LightLogs::create($bounce)->queue();
|
LightLogs::create($bounce)->batch();
|
||||||
|
|
||||||
SystemLogger::dispatch($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_BOUNCED, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
|
SystemLogger::dispatch($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_BOUNCED, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ class ProcessPostmarkWebhook implements ShouldQueue
|
|||||||
$this->request['MessageID']
|
$this->request['MessageID']
|
||||||
);
|
);
|
||||||
|
|
||||||
LightLogs::create($spam)->queue();
|
LightLogs::create($spam)->batch();
|
||||||
|
|
||||||
SystemLogger::dispatch($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
|
SystemLogger::dispatch($this->request, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company);
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class VendorTemplateEmail extends Mailable
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->build_email->getTemplate() == 'custom') {
|
if ($this->build_email->getTemplate() == 'custom') {
|
||||||
$this->build_email->setBody(str_replace('$body', $this->build_email->getBody(), $this->client->getSetting('email_style_custom')));
|
$this->build_email->setBody(str_replace('$body', $this->build_email->getBody(), $this->company->getSetting('email_style_custom')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings = $this->company->settings;
|
$settings = $this->company->settings;
|
||||||
|
@ -64,7 +64,7 @@ class Vendor extends BaseModel
|
|||||||
protected $touches = [];
|
protected $touches = [];
|
||||||
|
|
||||||
protected $with = [
|
protected $with = [
|
||||||
'company',
|
'contacts.company',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $presenter = VendorPresenter::class;
|
protected $presenter = VendorPresenter::class;
|
||||||
|
@ -45,10 +45,7 @@ class VendorContact extends Authenticatable implements HasLocalePreference
|
|||||||
'hashed_id',
|
'hashed_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $with = [
|
protected $with = [];
|
||||||
// 'vendor',
|
|
||||||
// 'company'
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
@ -110,8 +111,7 @@ class TemplateEngine
|
|||||||
if ($this->entity == 'purchaseOrder' || $this->entity == 'purchase_order') {
|
if ($this->entity == 'purchaseOrder' || $this->entity == 'purchase_order') {
|
||||||
$this->settings_entity = auth()->user()->company();
|
$this->settings_entity = auth()->user()->company();
|
||||||
$this->settings = $this->settings_entity->settings;
|
$this->settings = $this->settings_entity->settings;
|
||||||
}
|
} elseif ($this->entity_obj->client()->exists()) {
|
||||||
elseif ($this->entity_obj->client()->exists()) {
|
|
||||||
$this->settings_entity = $this->entity_obj->client;
|
$this->settings_entity = $this->entity_obj->client;
|
||||||
$this->settings = $this->settings_entity->getMergedSettings();
|
$this->settings = $this->settings_entity->getMergedSettings();
|
||||||
} else {
|
} else {
|
||||||
@ -155,13 +155,11 @@ class TemplateEngine
|
|||||||
$this->raw_body = $this->body;
|
$this->raw_body = $this->body;
|
||||||
$this->raw_subject = $this->subject;
|
$this->raw_subject = $this->subject;
|
||||||
|
|
||||||
if($this->entity == 'purchaseOrder'){
|
if ($this->entity_obj->client()->exists()) {
|
||||||
$this->fakerValues();
|
|
||||||
}
|
|
||||||
elseif ($this->entity_obj->client()->exists()) {
|
|
||||||
$this->entityValues($this->entity_obj->client->primary_contact()->first());
|
$this->entityValues($this->entity_obj->client->primary_contact()->first());
|
||||||
}
|
} elseif ($this->entity_obj->vendor()->exists()) {
|
||||||
else {
|
$this->entityValues($this->entity_obj->vendor->primary_contact()->first());
|
||||||
|
} else {
|
||||||
$this->fakerValues();
|
$this->fakerValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,16 +182,16 @@ class TemplateEngine
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->body = $converter->convert($this->body)->getContent();
|
$this->body = $converter->convert($this->body)->getContent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function entityValues($contact)
|
private function entityValues($contact)
|
||||||
{
|
{
|
||||||
if($this->entity == 'purchaseOrder')
|
if (in_array($this->entity, ['purchaseOrder', 'purchase_order']))
|
||||||
$this->labels_and_values = (new VendorHtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
|
$this->labels_and_values = (new VendorHtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
|
||||||
else
|
else
|
||||||
$this->labels_and_values = (new HtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
|
$this->labels_and_values = (new HtmlEngine($this->entity_obj->invitations->first()))->generateLabelsAndValues();
|
||||||
|
|
||||||
|
|
||||||
$this->body = strtr($this->body, $this->labels_and_values['labels']);
|
$this->body = strtr($this->body, $this->labels_and_values['labels']);
|
||||||
$this->body = strtr($this->body, $this->labels_and_values['values']);
|
$this->body = strtr($this->body, $this->labels_and_values['values']);
|
||||||
|
|
||||||
@ -226,7 +224,6 @@ class TemplateEngine
|
|||||||
$data['whitelabel'] = $this->entity_obj ? $this->entity_obj->company->account->isPaid() : true;
|
$data['whitelabel'] = $this->entity_obj ? $this->entity_obj->company->account->isPaid() : true;
|
||||||
$data['company'] = $this->entity_obj ? $this->entity_obj->company : '';
|
$data['company'] = $this->entity_obj ? $this->entity_obj->company : '';
|
||||||
$data['settings'] = $this->settings;
|
$data['settings'] = $this->settings;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -235,7 +232,6 @@ class TemplateEngine
|
|||||||
|
|
||||||
// In order to parse variables such as $signature in the body,
|
// In order to parse variables such as $signature in the body,
|
||||||
// we need to replace strings with the values from HTMLEngine.
|
// we need to replace strings with the values from HTMLEngine.
|
||||||
|
|
||||||
$wrapper = strtr($wrapper, $this->labels_and_values['values']);
|
$wrapper = strtr($wrapper, $this->labels_and_values['values']);
|
||||||
|
|
||||||
/*If no custom design exists, send back a blank!*/
|
/*If no custom design exists, send back a blank!*/
|
||||||
@ -321,8 +317,7 @@ class TemplateEngine
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($this->entity == 'purchaseOrder')
|
if ($this->entity == 'purchaseOrder') {
|
||||||
{
|
|
||||||
|
|
||||||
$vendor = Vendor::factory()->create([
|
$vendor = Vendor::factory()->create([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
@ -350,11 +345,9 @@ class TemplateEngine
|
|||||||
'purchase_order_id' => $this->entity_obj->id,
|
'purchase_order_id' => $this->entity_obj->id,
|
||||||
'vendor_contact_id' => $contact->id,
|
'vendor_contact_id' => $contact->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($vendor)
|
if ($vendor) {
|
||||||
{
|
|
||||||
|
|
||||||
$this->entity_obj->setRelation('invitations', $invitation);
|
$this->entity_obj->setRelation('invitations', $invitation);
|
||||||
$this->entity_obj->setRelation('vendor', $vendor);
|
$this->entity_obj->setRelation('vendor', $vendor);
|
||||||
@ -362,10 +355,7 @@ class TemplateEngine
|
|||||||
$this->entity_obj->load('vendor');
|
$this->entity_obj->load('vendor');
|
||||||
$vendor->setRelation('company', auth()->user()->company());
|
$vendor->setRelation('company', auth()->user()->company());
|
||||||
$vendor->load('company');
|
$vendor->load('company');
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->entity_obj->setRelation('invitations', $invitation);
|
$this->entity_obj->setRelation('invitations', $invitation);
|
||||||
$this->entity_obj->setRelation('client', $client);
|
$this->entity_obj->setRelation('client', $client);
|
||||||
$this->entity_obj->setRelation('company', auth()->user()->company());
|
$this->entity_obj->setRelation('company', auth()->user()->company());
|
||||||
|
@ -14,8 +14,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.5.20',
|
'app_version' => '5.5.21',
|
||||||
'app_tag' => '5.5.20',
|
'app_tag' => '5.5.21',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user