diff --git a/app/DataMapper/EmailTemplateDefaults.php b/app/DataMapper/EmailTemplateDefaults.php index 8b9a9f7660c5..5b6f29958042 100644 --- a/app/DataMapper/EmailTemplateDefaults.php +++ b/app/DataMapper/EmailTemplateDefaults.php @@ -185,8 +185,7 @@ class EmailTemplateDefaults public static function emailReminder1Template() { - return self::emailInvoiceTemplate(); - //return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailReminder2Subject() @@ -196,8 +195,7 @@ class EmailTemplateDefaults public static function emailReminder2Template() { - return self::emailInvoiceTemplate(); - //return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailReminder3Subject() @@ -207,8 +205,7 @@ class EmailTemplateDefaults public static function emailReminder3Template() { - return self::emailInvoiceTemplate(); - //return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailReminderEndlessSubject() @@ -218,8 +215,7 @@ class EmailTemplateDefaults public static function emailReminderEndlessTemplate() { - return self::emailInvoiceTemplate(); - return ''; + return self::emailInvoiceReminderTemplate(); } public static function emailStatementSubject() diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index ffc88ff8325a..5041107ecc28 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -149,6 +149,63 @@ class CompanyImport implements ShouldQueue 'system_logs', ]; + private $company_properties = [ + "convert_products", + "fill_products", + "update_products", + "show_product_details", + "client_can_register", + "custom_surcharge_taxes1", + "custom_surcharge_taxes2", + "custom_surcharge_taxes3", + "custom_surcharge_taxes4", + "show_product_cost", + "enabled_tax_rates", + "enabled_modules", + "enable_product_cost", + "enable_product_quantity", + "default_quantity", + "subdomain", + "size_id", + "first_day_of_week", + "first_month_of_year", + "portal_mode", + "portal_domain", + "enable_modules", + "custom_fields", + "industry_id", + "slack_webhook_url", + "google_analytics_key", + "created_at", + "updated_at", + "enabled_item_tax_rates", + "is_large", + "enable_shop_api", + "default_auto_bill", + "mark_expenses_invoiceable", + "mark_expenses_paid", + "invoice_expense_documents", + "auto_start_tasks", + "invoice_task_timelog", + "invoice_task_documents", + "show_tasks_table", + "is_disabled", + "default_task_is_date_based", + "enable_product_discount", + "calculate_expense_tax_by_amount", + "expense_inclusive_taxes", + "session_timeout", + "oauth_password_required", + "invoice_task_datelog", + "default_password_timeout", + "show_task_end_date", + "markdown_enabled", + "use_comma_as_decimal_place", + "report_include_drafts", + "client_registration_fields", + "convert_rate_to_client", + ]; + /** * Create a new job instance. * @@ -212,6 +269,7 @@ class CompanyImport implements ShouldQueue $this->preFlightChecks() ->purgeCompanyData() + ->importCompany() ->importData() ->postImportCleanup(); @@ -420,17 +478,24 @@ class CompanyImport implements ShouldQueue private function importCompany() { //$tmp_company = $this->backup_file->company; - $tmp_company = (object)$this->getObject("company"); + $tmp_company = (object)$this->getObject("company",true); $tmp_company->company_key = $this->createHash(); $tmp_company->db = config('database.default'); $tmp_company->account_id = $this->account->id; +nlog($tmp_company); + if(Ninja::isHosted()) $tmp_company->subdomain = MultiDB::randomSubdomainGenerator(); else $tmp_company->subdomain = ''; - $this->company = $tmp_company; + foreach($this->company_properties as $value){ + + $this->company->{$value} = $tmp_company->{$value}; + + } + $this->company->save(); return $this; diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 1cbd644ad9c9..1a7529058ec7 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -55,6 +55,11 @@ class UpdateInvoicePayment $paid_amount = $paid_invoice->amount; } + $client + ->service() + ->updatePaidToDate($paid_amount) + ->save(); + /* Need to determine here is we have an OVER payment - if YES only apply the max invoice amount */ if($paid_amount > $invoice->partial && $paid_amount > $invoice->balance) $paid_amount = $invoice->balance; @@ -77,7 +82,6 @@ class UpdateInvoicePayment $client ->service() ->updateBalance($paid_amount * -1) - ->updatePaidToDate($paid_amount) ->save(); $pivot_invoice = $this->payment->invoices->first(function ($inv) use ($paid_invoice) { diff --git a/composer.json b/composer.json index 3895ca8e59d1..9d6a0aa36836 100644 --- a/composer.json +++ b/composer.json @@ -87,10 +87,9 @@ "wildbit/swiftmailer-postmark": "^3.3" }, "require-dev": { - "php": "^7.3|^7.4|^8.0", + "php": "^7.4|^8.0", "anahkiasen/former": "^4.2", "barryvdh/laravel-debugbar": "^3.4", - "beyondcode/laravel-query-detector": "^1.5", "brianium/paratest": "^6.1", "darkaonline/l5-swagger": "^8.0", "facade/ignition": "^2.3.6",