Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop

This commit is contained in:
David Bomba 2021-06-17 17:28:12 +10:00
commit c33a9d0ae5
12 changed files with 40 additions and 45 deletions

View File

@ -50,7 +50,7 @@ class UpdateCompanyRequest extends Request
} else {
if(Ninja::isHosted()){
$rules['subdomain'] = ['nullable', 'regex:/^[a-zA-Z0-9][a-zA-Z0-9.-]+[a-zA-Z0-9]$/', new ValidSubdomain($this->all())];
$rules['subdomain'] = ['nullable', 'regex:/^[a-zA-Z0-9.-]+[a-zA-Z0-9]$/', new ValidSubdomain($this->all())];
}
else
$rules['subdomain'] = 'nullable|alpha_num';

View File

@ -14,6 +14,7 @@ namespace App\Mail\Engine;
use App\DataMapper\EmailTemplateDefaults;
use App\Models\Account;
use App\Utils\Helpers;
use App\Utils\Ninja;
use App\Utils\Number;
use App\Utils\Traits\MakesDates;
@ -77,7 +78,10 @@ class PaymentEmailEngine extends BaseEmailEngine
$this->payment->invoices->each(function ($invoice){
$this->setAttachments([$invoice->pdf_file_path($invoice->invitations->first())]);
if(Ninja::isHosted())
$this->setAttachments([$invoice->pdf_file_path($invoice->invitations->first(), 'url', true)]);
else
$this->setAttachments([$invoice->pdf_file_path($invoice->invitations->first())]);
});

View File

@ -414,7 +414,7 @@ class Invoice extends BaseModel
if(Ninja::isHosted() && $portal && Storage::disk(config('filesystems.default'))->exists($file_path)){
return Storage::disk(config('filesystems.default'))->{$type}($file_path);
}
elseif(Ninja::isHosted() && $portal){
elseif(Ninja::isHosted()){
$file_path = CreateEntityPdf::dispatchNow($invitation, config('filesystems.default'));
return Storage::disk(config('filesystems.default'))->{$type}($file_path);
}

View File

@ -33,9 +33,9 @@ class MailCssInlinerServiceProvider extends ServiceProvider
return new CssInlinerPlugin([]);
});
$this->app->afterResolving('mail.manager', function (MailManager $mailManager) {
$mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class));
return $mailManager;
});
// $this->app->afterResolving('mail.manager', function (MailManager $mailManager) {
// $mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class));
// return $mailManager;
// });
}
}

View File

@ -3,10 +3,11 @@
namespace App\Providers;
use App\Helpers\Mail\GmailTransportManager;
use App\Utils\CssInlinerPlugin;
use Coconuts\Mail\PostmarkTransport;
use GuzzleHttp\Client as HttpClient;
use Illuminate\Mail\MailServiceProvider as MailProvider;
use Illuminate\Mail\TransportManager;
use GuzzleHttp\Client as HttpClient;
class MailServiceProvider extends MailProvider
{
@ -27,21 +28,23 @@ class MailServiceProvider extends MailProvider
return new GmailTransportManager($app);
});
// $this->app->bind('mail.manager', function($app) {
// return new GmailTransportManager($app);
// });
$this->app->bind('mailer', function ($app) {
return $app->make('mail.manager')->mailer();
});
$this->app['mail.manager']->extend('postmark', function () {
return new PostmarkTransport(
$this->guzzle(config('postmark.guzzle', [])),
config('postmark.secret')
);
});
$this->app->afterResolving('mail.manager', function (GmailTransportManager $mailManager) {
$mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class));
return $mailManager;
});
}
protected function guzzle(array $config): HttpClient
@ -57,6 +60,7 @@ class MailServiceProvider extends MailProvider
{
return [
'mail.manager',
'mailer' ];
'mailer'
];
}
}

View File

@ -346,7 +346,7 @@ class Design extends BaseDesign
$items = $this->transformLineItems($this->entity->line_items, $type);
// $this->processMarkdownOnLineItems($items);
// $this->processMarkdownOnLineItems($items);
if (count($items) == 0) {
return [];
@ -498,6 +498,15 @@ class Design extends BaseDesign
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client']), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]],
]];
}
} elseif (Str::startsWith($variable, '$custom_surcharge')) {
$_variable = ltrim($variable, '$'); // $custom_surcharge1 -> custom_surcharge1
$visible = $this->entity->{$_variable} == '0';
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
['element' => 'span', 'content' => $variable . '_label', 'properties' => ['hidden' => $visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']],
['element' => 'span', 'content' => $variable, 'properties' => ['hidden' => $visible, 'data-ref' => 'totals_table-' . substr($variable, 1)]],
]];
} elseif (Str::startsWith($variable, '$custom')) {
$field = explode('_', $variable);
$visible = is_object($this->client->company->custom_fields) && property_exists($this->client->company->custom_fields, $field[1]) && !empty($this->client->company->custom_fields->{$field[1]});

View File

@ -483,33 +483,6 @@ class SubscriptionService
}
/**
* Handle a plan change where no payment is required
*
* @param array $data
* @deprecated - no usage found
*/
public function handlePlanChangeNoPayment($data)
{
$recurring_invoice = $this->createNewRecurringInvoice($data['recurring_invoice']);
$context = [
'context' => 'change_plan',
'recurring_invoice' => $recurring_invoice->hashed_id,
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
'client' => $recurring_invoice->client->hashed_id,
'subscription' => $this->subscription->hashed_id,
'contact' => auth('contact')->user()->hashed_id,
];
$response = $this->triggerWebhook($context);
// nlog($response);
return $this->handleRedirect('/client/recurring_invoices/'.$recurring_invoice->hashed_id);
}
/**
* Creates a credit note if the plan change requires
*

View File

@ -77,4 +77,7 @@ return [
'client_secret' => env('BITBUCKET_CLIENT_SECRET'),
'redirect' => env('BITBUCKET_OAUTH_REDIRECT'),
],
'postmark' => [
'token' => env('POSTMARK_SECRET'),
],
];

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"/js/app.js": "/js/app.js?id=696e8203d5e8e7cf5ff5",
"/css/app.css": "/css/app.css?id=14a824656f32eec8c2b1",
"/css/app.css": "/css/app.css?id=362fcaff4938566f7508",
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=a09bb529b8e1826f13b4",
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1",
"/js/clients/linkify-urls.js": "/js/clients/linkify-urls.js?id=0dc8c34010d09195d2f7",

View File

@ -4266,6 +4266,7 @@ $LANG = array(
'quote_was_approved' => 'We would like to inform you that quote was approved.',
'company_import_failure_subject' => 'Error importing :company',
'company_import_failure_body' => 'There was an error importing the company data, the error message was:',
'recurring_invoice_due_date' => 'Due Date',
);
return $LANG;

View File

@ -3,11 +3,12 @@
@section('body')
<div class="grid lg:grid-cols-12 py-8">
<div class="col-span-12 lg:col-span-6 lg:col-start-4 xl:col-span-4 xl:col-start-5 px-6">
<div class="col-span-12 lg:col-span-8 lg:col-start-3 xl:col-span-6 xl:col-start-4 px-6">
<div class="flex justify-center">
<img class="h-32 w-auto" src="{{ $company->present()->logo() }}" alt="{{ ctrans('texts.logo') }}">
</div>
<h1 class="text-center text-3xl mt-8">{{ ctrans('texts.register') }}</h1>
<h1 class="text-center text-3xl mt-8">{{ ctrans('texts.register') }}</h1>
<p class="block text-center text-gray-600">{{ ctrans('texts.register_label') }}</p>
<form action="{{ route('client.register', request()->route('company_key')) }}" method="POST" x-data="{ more: false }">