diff --git a/app/Helpers/Invoice/InvoiceSum.php b/app/Helpers/Invoice/InvoiceSum.php index a66a04d912f1..da45f65a7ca8 100644 --- a/app/Helpers/Invoice/InvoiceSum.php +++ b/app/Helpers/Invoice/InvoiceSum.php @@ -53,6 +53,9 @@ class InvoiceSum { $this->invoice = $invoice; + // if(!$this->invoice->relationLoaded('client')) + // $this->invoice->load('client'); + $this->tax_map = new Collection; } diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 72378bb0ec34..20e7ed40c865 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -629,7 +629,7 @@ class InvoiceController extends BaseController } private function performAction(Invoice $invoice, $action, $bulk = false) - { + { /*If we are using bulk actions, we don't want to return anything */ switch ($action) { case 'clone_to_invoice': diff --git a/app/Http/Controllers/RecurringInvoiceController.php b/app/Http/Controllers/RecurringInvoiceController.php index cd81b2d51ba5..f88a07ccabae 100644 --- a/app/Http/Controllers/RecurringInvoiceController.php +++ b/app/Http/Controllers/RecurringInvoiceController.php @@ -210,6 +210,10 @@ class RecurringInvoiceController extends BaseController $recurring_invoice->next_send_date = Carbon::parse($recurring_invoice->next_send_date)->startOfDay()->addSeconds($offset); $recurring_invoice->save(); + $recurring_invoice->service() + ->triggeredActions($request) + ->save(); + return $this->itemResponse($recurring_invoice); } diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php index 4b08ad38ca44..0f126f7a45aa 100644 --- a/app/Http/Middleware/QueryLogging.php +++ b/app/Http/Middleware/QueryLogging.php @@ -36,9 +36,9 @@ class QueryLogging { // Enable query logging for development - if (!Ninja::isHosted() || !config('beacon.enabled')) { - return $next($request); - } + // if (!Ninja::isHosted() || !config('beacon.enabled')) { + // return $next($request); + // } $timeStart = microtime(true); DB::enableQueryLog(); @@ -52,7 +52,7 @@ class QueryLogging $timeEnd = microtime(true); $time = $timeEnd - $timeStart; - // info("Query count = {$count}"); + info("Query count = {$count}"); if($count > 175){ nlog("Query count = {$count}"); diff --git a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php index d2f4e09d2893..8f764f3b2e78 100644 --- a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php @@ -105,7 +105,7 @@ class StoreRecurringInvoiceRequest extends Request if (isset($input['auto_bill'])) { $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); } else { - if ($client = Client::find($input['client_id'])) { + if (array_key_exists('client_id', $input) && $client = Client::find($input['client_id'])) { $input['auto_bill'] = $client->getSetting('auto_bill'); $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); } diff --git a/app/Jobs/Entity/CreateEntityPdf.php b/app/Jobs/Entity/CreateEntityPdf.php index bb7a511aa19c..f545db11aadb 100644 --- a/app/Jobs/Entity/CreateEntityPdf.php +++ b/app/Jobs/Entity/CreateEntityPdf.php @@ -93,7 +93,8 @@ class CreateEntityPdf implements ShouldQueue $this->contact = $invitation->contact; $this->client = $invitation->contact->client; - + $this->client->load('company'); + $this->disk = Ninja::isHosted() ? config('filesystems.default') : $disk; } @@ -107,7 +108,7 @@ class CreateEntityPdf implements ShouldQueue /* Init a new copy of the translator*/ $t = app('translator'); /* Set the locale*/ - App::setLocale($this->contact->preferredLocale()); + App::setLocale($this->client->locale()); /* Set customized translations _NOW_ */ $t->replace(Ninja::transformTranslations($this->client->getMergedSettings())); diff --git a/app/Mail/Admin/EntityCreatedObject.php b/app/Mail/Admin/EntityCreatedObject.php index c4cfc886c5d0..33bb612a7d9a 100644 --- a/app/Mail/Admin/EntityCreatedObject.php +++ b/app/Mail/Admin/EntityCreatedObject.php @@ -49,6 +49,7 @@ class EntityCreatedObject /* Set customized translations _NOW_ */ $t->replace(Ninja::transformTranslations($this->entity->company->settings)); + $this->entity->load('client.country', 'client.company'); $this->client = $this->entity->client; $this->company = $this->entity->company; diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 039ff44242ff..69557674a4f7 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -87,7 +87,7 @@ class TemplateEmail extends Mailable $this->from(config('mail.from.address'), $email_from_name); if (strlen($settings->bcc_email) > 1) - $this->bcc(explode(",",$settings->bcc_email)); + $this->bcc(explode(",",str_replace(" ", "", $settings->bcc_email)));//remove whitespace if any has been inserted. $this->subject($this->build_email->getSubject()) ->text('email.template.plain', [ diff --git a/app/Repositories/ActivityRepository.php b/app/Repositories/ActivityRepository.php index c2ed5748bbea..c2d0e946a0c9 100644 --- a/app/Repositories/ActivityRepository.php +++ b/app/Repositories/ActivityRepository.php @@ -81,7 +81,8 @@ class ActivityRepository extends BaseRepository || get_class($entity) == Credit::class || get_class($entity) == RecurringInvoice::class ) { - $entity->load('company', 'client'); + + $entity->load('client'); $contact = $entity->client->primary_contact()->first(); $backup->html_backup = $this->generateHtml($entity); $backup->amount = $entity->amount; @@ -95,7 +96,7 @@ class ActivityRepository extends BaseRepository public function getTokenId(array $event_vars) { if ($event_vars['token']) { - $company_token = CompanyToken::whereRaw('BINARY `token`= ?', [$event_vars['token']])->first(); + $company_token = CompanyToken::where('token', $event_vars['token'])->first(); if ($company_token) { return $company_token->id; @@ -117,7 +118,7 @@ class ActivityRepository extends BaseRepository $entity_design_id = 'credit_design_id'; } - $entity->load('client','client.company'); + // $entity->load('client.company'); $entity_design_id = $entity->design_id ? $entity->design_id : $this->decodePrimaryKey($entity->client->getSetting($entity_design_id)); @@ -128,6 +129,8 @@ class ActivityRepository extends BaseRepository return; } + $entity->load('client.company', 'invitations'); + $html = new HtmlEngine($entity->invitations->first()); if ($design->is_custom) { diff --git a/app/Services/Invoice/TriggeredActions.php b/app/Services/Invoice/TriggeredActions.php index 2169a63df6a3..d439b0c9b149 100644 --- a/app/Services/Invoice/TriggeredActions.php +++ b/app/Services/Invoice/TriggeredActions.php @@ -64,7 +64,6 @@ class TriggeredActions extends AbstractService { $reminder_template = $this->invoice->calculateTemplate('invoice'); - //$reminder_template = 'payment'; $this->invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($reminder_template) { EmailEntity::dispatch($invitation, $this->invoice->company, $reminder_template); diff --git a/app/Services/Recurring/RecurringService.php b/app/Services/Recurring/RecurringService.php index 6bd522120edd..0f7d8b892e2c 100644 --- a/app/Services/Recurring/RecurringService.php +++ b/app/Services/Recurring/RecurringService.php @@ -97,6 +97,20 @@ class RecurringService return $this; } + public function triggeredActions($request) + { + + if ($request->has('start') && $request->input('start') == 'true') { + $this->start(); + } + + if ($request->has('stop') && $request->input('stop') == 'true') { + $this->stop(); + } + + return $this; + } + public function fillDefaults() { diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index de8cd6698856..d5bd8020bfeb 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -49,7 +49,6 @@ class HtmlEngine public function __construct($invitation) { $this->invitation = $invitation; - // $invitation->load('contact.client.company', 'company'); $this->entity_string = $this->resolveEntityString(); @@ -58,9 +57,9 @@ class HtmlEngine $this->company = $invitation->company; $this->contact = $invitation->contact; - - $this->client = $invitation->contact->client; - $this->client->load('country','company'); + + $this->client = $this->contact->client->load('company','country'); + $this->entity->load('client'); $this->settings = $this->client->getMergedSettings(); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index bc6dbd2e85c8..95d83a86f805 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2479,6 +2479,8 @@ $LANG = array( 'currency_cambodian_riel' => 'Cambodian Riel', 'currency_vanuatu_vatu' => 'Vanuatu Vatu', + 'currency_cuban_peso' => 'Cuban Peso', + 'review_app_help' => 'We hope you\'re enjoying using the app.
If you\'d consider :link we\'d greatly appreciate it!', 'writing_a_review' => 'writing a review',