diff --git a/app/Listeners/Invoice/InvoiceEmailActivity.php b/app/Listeners/Invoice/InvoiceEmailActivity.php index f1667a940822..62eb8d6301e6 100644 --- a/app/Listeners/Invoice/InvoiceEmailActivity.php +++ b/app/Listeners/Invoice/InvoiceEmailActivity.php @@ -47,6 +47,7 @@ class InvoiceEmailActivity implements ShouldQueue $fields->user_id = $event->invitation->invoice->user_id; $fields->company_id = $event->invitation->invoice->company_id; $fields->client_contact_id = $event->invitation->invoice->client_contact_id; + $fields->client_id = $event->invitation->invoice->client_id; $fields->activity_type_id = Activity::EMAIL_INVOICE; $this->activity_repo->save($fields, $event->invitation->invoice, $event->event_vars); diff --git a/app/Listeners/Quote/QuoteEmailActivity.php b/app/Listeners/Quote/QuoteEmailActivity.php index 8c2c95ace897..d99413d73996 100644 --- a/app/Listeners/Quote/QuoteEmailActivity.php +++ b/app/Listeners/Quote/QuoteEmailActivity.php @@ -48,6 +48,7 @@ class QuoteEmailActivity implements ShouldQueue $fields->user_id = $event->invitation->quote->user_id; $fields->company_id = $event->invitation->quote->company_id; $fields->client_contact_id = $event->invitation->quote->client_contact_id; + $fields->client_id = $event->invitation->quote->client_id; $fields->activity_type_id = Activity::EMAIL_QUOTE; $this->activity_repo->save($fields, $event->invitation->quote, $event->event_vars); diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index 3e7ce126f4ab..9905fdd0852c 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -431,54 +431,55 @@ trait GeneratesCounter $reset_date = Carbon::parse($client->getSetting('reset_counter_date'), $timezone->name); - if (! $reset_date->isToday() || ! $client->getSetting('reset_counter_date')) { + if (! $reset_date->lte(now()) || ! $client->getSetting('reset_counter_date')) { return false; } switch ($reset_counter_frequency) { case RecurringInvoice::FREQUENCY_DAILY: - $reset_date->addDay(); + now()->addDay(); break; case RecurringInvoice::FREQUENCY_WEEKLY: - $reset_date->addWeek(); + now()->addWeek(); break; case RecurringInvoice::FREQUENCY_TWO_WEEKS: - $reset_date->addWeeks(2); + now()->addWeeks(2); break; case RecurringInvoice::FREQUENCY_FOUR_WEEKS: - $reset_date->addWeeks(4); + now()->addWeeks(4); break; case RecurringInvoice::FREQUENCY_MONTHLY: - $reset_date->addMonth(); + now()->addMonth(); break; case RecurringInvoice::FREQUENCY_TWO_MONTHS: - $reset_date->addMonths(2); + now()->addMonths(2); break; case RecurringInvoice::FREQUENCY_THREE_MONTHS: - $reset_date->addMonths(3); + now()->addMonths(3); break; case RecurringInvoice::FREQUENCY_FOUR_MONTHS: - $reset_date->addMonths(4); + now()->addMonths(4); break; case RecurringInvoice::FREQUENCY_SIX_MONTHS: - $reset_date->addMonths(6); + now()->addMonths(6); break; case RecurringInvoice::FREQUENCY_ANNUALLY: - $reset_date->addYear(); + now()->addYear(); break; case RecurringInvoice::FREQUENCY_TWO_YEARS: - $reset_date->addYears(2); + now()->addYears(2); break; } $settings = $client->company->settings; - $settings->reset_counter_date = $reset_date->format($client->date_format()); + $settings->reset_counter_date = $reset_date->format('Y-m-d'); $settings->invoice_number_counter = 1; $settings->quote_number_counter = 1; $settings->credit_number_counter = 1; $client->company->settings = $settings; $client->company->save(); + } private function resetCompanyCounters($company) @@ -487,7 +488,7 @@ trait GeneratesCounter $reset_date = Carbon::parse($company->settings->reset_counter_date, $timezone->name); - if (! $reset_date->isToday() || ! $company->settings->reset_counter_date) { + if (! $reset_date->lte(now()) || ! $company->settings->reset_counter_date) { return false; } diff --git a/composer.lock b/composer.lock index 1781f3ddc8ab..8fa65833cc1f 100644 --- a/composer.lock +++ b/composer.lock @@ -9746,16 +9746,16 @@ }, { "name": "turbo124/beacon", - "version": "1.0.14", + "version": "1.0.16", "source": { "type": "git", "url": "https://github.com/turbo124/beacon.git", - "reference": "177d72f42dce4b2555b9870f07de37ecceefe864" + "reference": "17b6fc4370422a935ff7f2038c5167945905533f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/turbo124/beacon/zipball/177d72f42dce4b2555b9870f07de37ecceefe864", - "reference": "177d72f42dce4b2555b9870f07de37ecceefe864", + "url": "https://api.github.com/repos/turbo124/beacon/zipball/17b6fc4370422a935ff7f2038c5167945905533f", + "reference": "17b6fc4370422a935ff7f2038c5167945905533f", "shasum": "" }, "require": { @@ -9803,9 +9803,9 @@ "turbo124" ], "support": { - "source": "https://github.com/turbo124/beacon/tree/1.0.14" + "source": "https://github.com/turbo124/beacon/tree/1.0.16" }, - "time": "2021-05-04T13:58:59+00:00" + "time": "2021-05-05T01:09:24+00:00" }, { "name": "turbo124/laravel-gmail",