diff --git a/app/Factory/RecurringInvoiceToInvoiceFactory.php b/app/Factory/RecurringInvoiceToInvoiceFactory.php index 02671cddf453..5c12fa7bab38 100644 --- a/app/Factory/RecurringInvoiceToInvoiceFactory.php +++ b/app/Factory/RecurringInvoiceToInvoiceFactory.php @@ -29,7 +29,7 @@ class RecurringInvoiceToInvoiceFactory $invoice->public_notes = $recurring_invoice->public_notes; $invoice->private_notes = $recurring_invoice->private_notes; //$invoice->date = now()->format($client->date_format()); - $invoice->due_date = $recurring_invoice->calculateDueDate(now()); + //$invoice->due_date = $recurring_invoice->calculateDueDate(now()); $invoice->is_deleted = $recurring_invoice->is_deleted; $invoice->line_items = $recurring_invoice->line_items; $invoice->tax_name1 = $recurring_invoice->tax_name1; diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 2ce0ce4bb20d..7de201cb0579 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -300,7 +300,9 @@ class PreviewController extends BaseController ->increment() ->batch(); } - + + DB::connection()->getDoctrineConnection()->close(); + DB::disconnect(); $response = Response::make($file_path, 200); $response->header('Content-Type', 'application/pdf'); diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index 6d5b6986fcbf..4370a7320db3 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -60,7 +60,8 @@ class SendRecurring implements ShouldQueue $invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client); $invoice->date = now()->format('Y-m-d'); - + $invoice->due_date = $this->recurring_invoice->calculateDueDate(now()->format('Y-m-d')); + if($invoice->client->getSetting('auto_email_invoice')) { $invoice = $invoice->service() diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 7b01cc890c18..416847cac797 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -1297,7 +1297,8 @@ class Import implements ShouldQueue } if(!$entity) - throw new Exception("Resource invoice/quote document not available."); + continue; + // throw new Exception("Resource invoice/quote document not available."); } diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index d008f38f0bd1..904052d9b8c8 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -133,6 +133,7 @@ class PaymentEmailEngine extends BaseEmailEngine $data['$email'] = ['value' => isset($this->contact) ? $this->contact->email : 'no contact email on record', 'label' => ctrans('texts.email')]; $data['$client_name'] = ['value' => $this->client->present()->name() ?: ' ', 'label' => ctrans('texts.client_name')]; $data['$client.name'] = &$data['$client_name']; + $data['$client'] = &$data['$client_name']; $data['$client.address1'] = &$data['$address1']; $data['$client.address2'] = &$data['$address2']; $data['$client_address'] = ['value' => $this->client->present()->address() ?: ' ', 'label' => ctrans('texts.address')]; @@ -164,6 +165,7 @@ class PaymentEmailEngine extends BaseEmailEngine $data['$contact.custom2'] = ['value' => isset($this->contact) ? $this->contact->custom_value2 : ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'contact1')]; $data['$contact.custom3'] = ['value' => isset($this->contact) ? $this->contact->custom_value3 : ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'contact1')]; $data['$contact.custom4'] = ['value' => isset($this->contact) ? $this->contact->custom_value4 : ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'contact1')]; + $data['$firstName'] = &$data['$contact.first_name']; $data['$company.city_state_postal'] = ['value' => $this->company->present()->cityStateZip($this->settings->city, $this->settings->state, $this->settings->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')]; $data['$company.postal_city_state'] = ['value' => $this->company->present()->cityStateZip($this->settings->city, $this->settings->state, $this->settings->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')]; @@ -191,7 +193,11 @@ class PaymentEmailEngine extends BaseEmailEngine $data['$company4'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company4', $this->settings->custom_value4, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company4')]; $data['$view_link'] = ['value' => ''.ctrans('texts.view_payment').'', 'label' => ctrans('texts.view_payment')]; + $data['$paymentLink'] = &$data['$view_link']; + $data['$portalButton'] = &$data['$view_link']; + $data['$view_url'] = ['value' => $this->payment->getLink(), 'label' => ctrans('texts.view_payment')]; + $data['$signature'] = ['value' => $this->settings->email_signature ?: ' ', 'label' => '']; $data['$invoices'] = ['value' => $this->formatInvoices(), 'label' => ctrans('texts.invoices')]; diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index b5913f8b37b3..8a83d29e8124 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -162,7 +162,7 @@ class PaymentRepository extends BaseRepository { if ( ! $is_existing_payment && ! $this->import_mode ) { - if (array_key_exists('email_receipt', $data) && $data['email_receipt'] == true) + if (array_key_exists('email_receipt', $data) && $data['email_receipt'] == 'true') $payment->service()->sendEmail(); elseif(!array_key_exists('email_receipt', $data) && $payment->client->getSetting('client_manual_payment_notification')) $payment->service()->sendEmail(); diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 70a0731d9440..f4b464a148fe 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -130,6 +130,7 @@ class HtmlEngine $data['$terms'] = &$data['$entity.terms']; $data['$view_link'] = ['value' => ''.ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; $data['$viewLink'] = &$data['$view_link']; + $data['$viewButton'] = &$data['$view_link']; $data['$view_url'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')]; $data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->entity->client->date_format(), $this->entity->client->locale()) ?: ' ', 'label' => ctrans('texts.invoice_date')]; @@ -422,6 +423,10 @@ class HtmlEngine $data['$autoBill'] = ['value' => ctrans('texts.auto_bill_notification_placeholder'), 'label' => '']; $data['$auto_bill'] = &$data['$autoBill']; + /*Payment Aliases*/ + $data['$paymentLink'] = ['value' => ''.ctrans('texts.view_payment').'', 'label' => ctrans('texts.view_payment')]; + $data['$portalButton'] = &$data['$paymentLink']; + $arrKeysLength = array_map('strlen', array_keys($data)); array_multisort($arrKeysLength, SORT_DESC, $data); diff --git a/database/migrations/2021_08_05_235942_add_zelle_payment_type.php b/database/migrations/2021_08_05_235942_add_zelle_payment_type.php new file mode 100644 index 000000000000..ae200d7c022b --- /dev/null +++ b/database/migrations/2021_08_05_235942_add_zelle_payment_type.php @@ -0,0 +1,40 @@ +first(); + + if(!$pt){ + + $payment_type = new PaymentType(); + $payment_type->id = 33; + $payment_type->name = 'Zelle'; + $payment_type->save(); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/seeders/PaymentTypesSeeder.php b/database/seeders/PaymentTypesSeeder.php index 1569bba9dc41..8967bb2c7653 100644 --- a/database/seeders/PaymentTypesSeeder.php +++ b/database/seeders/PaymentTypesSeeder.php @@ -70,6 +70,7 @@ class PaymentTypesSeeder extends Seeder ['name' => 'GoCardless', 'gateway_type_id' => self::GATEWAY_TYPE_GOCARDLESS], ['name' => 'Crypto', 'gateway_type_id' => self::GATEWAY_TYPE_CRYPTO], ['name' => 'Credit', 'gateway_type_id' => self::GATEWAY_TYPE_CREDIT], + ['name' => 'Zelle'], ]; $x = 1;