1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 06:02:39 +01:00

Merge pull request #7795 from turbo124/v5-stable

v5.5.19
This commit is contained in:
David Bomba 2022-09-02 21:42:15 +10:00 committed by GitHub
commit 0b2ba335cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 73 additions and 19 deletions

View File

@ -1 +1 @@
5.5.18 5.5.19

View File

@ -436,9 +436,12 @@ class CompanySettings extends BaseSettings
public $auto_archive_invoice_cancelled = false; public $auto_archive_invoice_cancelled = false;
public $vendor_portal_enable_uploads=false; public $vendor_portal_enable_uploads = false;
public $send_email_on_mark_paid = false;
public static $casts = [ public static $casts = [
'send_email_on_mark_paid' => 'bool',
'vendor_portal_enable_uploads' => 'bool', 'vendor_portal_enable_uploads' => 'bool',
'besr_id' => 'string', 'besr_id' => 'string',
'qr_iban' => 'string', 'qr_iban' => 'string',

View File

@ -900,6 +900,10 @@ class BaseController extends Controller
return redirect('/')->with(['signup' => 'true']); return redirect('/')->with(['signup' => 'true']);
} }
$canvas_path_array = parse_url(config('ninja.app_url'));
$canvas_path = (array_key_exists('path', $canvas_path_array)) ? $canvas_path_array['path'] : '';
$data = []; $data = [];
//pass report errors bool to front end //pass report errors bool to front end
@ -910,6 +914,7 @@ class BaseController extends Controller
$data['build'] = request()->has('build') ? request()->input('build') : ''; $data['build'] = request()->has('build') ? request()->input('build') : '';
$data['login'] = request()->has('login') ? request()->input('login') : 'false'; $data['login'] = request()->has('login') ? request()->input('login') : 'false';
$data['signup'] = request()->has('signup') ? request()->input('signup') : 'false'; $data['signup'] = request()->has('signup') ? request()->input('signup') : 'false';
$data['canvas_path'] = $canvas_path;
if (request()->session()->has('login')) { if (request()->session()->has('login')) {
$data['login'] = 'true'; $data['login'] = 'true';

View File

@ -56,6 +56,7 @@ class SubscriptionPlanSwitch extends Component
*/ */
public $total; public $total;
public $hide_button = false;
/** /**
* @var array * @var array
*/ */
@ -139,12 +140,20 @@ class SubscriptionPlanSwitch extends Component
public function handlePaymentNotRequired() public function handlePaymentNotRequired()
{ {
return $this->target->service()->createChangePlanCredit([ $this->hide_button = true;
$response = $this->target->service()->createChangePlanCredit([
'recurring_invoice' => $this->recurring_invoice, 'recurring_invoice' => $this->recurring_invoice,
'subscription' => $this->subscription, 'subscription' => $this->subscription,
'target' => $this->target, 'target' => $this->target,
'hash' => $this->hash, 'hash' => $this->hash,
]); ]);
$this->hide_button = true;
$this->dispatchBrowserEvent('redirectRoute', ['route' => $response]);
// return redirect($response);
} }
public function render() public function render()

View File

@ -80,9 +80,9 @@ class AdjustProductInventory implements ShouldQueue
$p->in_stock_quantity -= $item->quantity; $p->in_stock_quantity -= $item->quantity;
$p->saveQuietly(); $p->saveQuietly();
if ($p->stock_notification_threshold && $p->in_stock_quantity <= $p->stock_notification_threshold) { if ($this->company->stock_notification && $p->stock_notification && $p->stock_notification_threshold && $p->in_stock_quantity <= $p->stock_notification_threshold) {
$this->notifyStockLevels($p, 'product'); $this->notifyStockLevels($p, 'product');
} elseif ($this->company->stock_notification_threshold && $p->in_stock_quantity <= $this->company->stock_notification_threshold) { } elseif ($this->company->stock_notification && $p->stock_notification && $this->company->inventory_notification_threshold && $p->in_stock_quantity <= $this->company->inventory_notification_threshold) {
$this->notifyStocklevels($p, 'company'); $this->notifyStocklevels($p, 'company');
} }
} }

View File

@ -14,8 +14,10 @@ namespace App\Jobs\Util;
use App\DataMapper\InvoiceItem; use App\DataMapper\InvoiceItem;
use App\Events\Invoice\InvoiceWasEmailed; use App\Events\Invoice\InvoiceWasEmailed;
use App\Jobs\Entity\EmailEntity; use App\Jobs\Entity\EmailEntity;
use App\Jobs\Ninja\TransactionLog;
use App\Libraries\MultiDB; use App\Libraries\MultiDB;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\TransactionEvent;
use App\Utils\Ninja; use App\Utils\Ninja;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesReminders; use App\Utils\Traits\MakesReminders;
@ -201,10 +203,20 @@ class ReminderJob implements ShouldQueue
$client = $invoice->client; $client = $invoice->client;
$client = $client->fresh(); $client = $client->fresh();
nlog('adjusting client balance and invoice balance by '.($invoice->balance - $temp_invoice_balance)); nlog('adjusting client balance and invoice balance by #'.$invoice->number.' '.($invoice->balance - $temp_invoice_balance));
$client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save(); $client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save();
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}"); $invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
$transaction = [
'invoice' => $invoice->transaction_event(),
'payment' => [],
'client' => $client->transaction_event(),
'credit' => [],
'metadata' => ['setLateFee'],
];
TransactionLog::dispatch(TransactionEvent::CLIENT_STATUS, $transaction, $invoice->company->db);
return $invoice; return $invoice;
} }
} }

View File

@ -74,6 +74,9 @@ class UpdatePaymentMethods
{ {
$sources = $customer->sources; $sources = $customer->sources;
if(!property_exists($sources, 'data'))
return;
foreach ($sources->data as $method) { foreach ($sources->data as $method) {
$token_exists = ClientGatewayToken::where([ $token_exists = ClientGatewayToken::where([
'gateway_customer_reference' => $customer->id, 'gateway_customer_reference' => $customer->id,

View File

@ -88,6 +88,7 @@ class ApplyPayment extends AbstractService
$this->invoice $this->invoice
->client ->client
->fresh()
->service() ->service()
->updateBalance($amount_paid) ->updateBalance($amount_paid)
->save(); ->save();

View File

@ -17,6 +17,7 @@ use App\Factory\PaymentFactory;
use App\Jobs\Invoice\InvoiceWorkflowSettings; use App\Jobs\Invoice\InvoiceWorkflowSettings;
use App\Jobs\Payment\EmailPayment; use App\Jobs\Payment\EmailPayment;
use App\Libraries\Currency\Conversion\CurrencyApi; use App\Libraries\Currency\Conversion\CurrencyApi;
use App\Models\Client;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Payment; use App\Models\Payment;
use App\Services\AbstractService; use App\Services\AbstractService;
@ -87,11 +88,13 @@ class ApplyPaymentAmount extends AbstractService
$this->invoice $this->invoice
->client ->client
->fresh()
->service() ->service()
->updateBalance($payment->amount * -1) ->updateBalance($payment->amount * -1)
->updatePaidToDate($payment->amount) ->updatePaidToDate($payment->amount)
->save(); ->save();
if ($this->invoice->client->getSetting('client_manual_payment_notification')) { if ($this->invoice->client->getSetting('client_manual_payment_notification')) {
$payment->service()->sendEmail(); $payment->service()->sendEmail();
} }

View File

@ -92,6 +92,9 @@ class MarkPaid extends AbstractService
$payment->service()->applyNumber()->save(); $payment->service()->applyNumber()->save();
if($payment->company->getSetting('send_email_on_mark_paid'))
$payment->service()->sendEmail();
$this->setExchangeRate($payment); $this->setExchangeRate($payment);
/* Create a payment relationship to the invoice entity */ /* Create a payment relationship to the invoice entity */

View File

@ -69,6 +69,7 @@ class MarkSent extends AbstractService
$client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first(); $client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
$client->balance += $adjustment; $client->balance += $adjustment;
$client->save(); $client->save();
}, 1); }, 1);
$this->invoice->markInvitationsSent(); $this->invoice->markInvitationsSent();

View File

@ -477,10 +477,14 @@ class SubscriptionService
nlog($response); nlog($response);
if($credit) if($credit){
return $this->handleRedirect('/client/credits/'.$credit->hashed_id); // return $this->handleRedirect('/client/credits/'.$credit->hashed_id);
else return '/client/credits/'.$credit->hashed_id;
return $this->handleRedirect('/client/credits'); }
else{
// return $this->handleRedirect('/client/credits');
return '/client/credits';
}
} }

View File

@ -160,7 +160,7 @@ class HtmlEngine
$data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.invoice_date')]; $data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->client->date_format(), $this->client->locale()) ?: '&nbsp;', 'label' => ctrans('texts.invoice_date')];
if($this->entity->project) { if($this->entity->project) {
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')]; $data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')];
$data['$invoice.project'] = &$data['$project.name']; $data['$invoice.project'] = &$data['$project.name'];
} }

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.18', 'app_version' => '5.5.19',
'app_tag' => '5.5.18', 'app_tag' => '5.5.19',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''), 'api_secret' => env('API_SECRET', ''),

View File

@ -21,7 +21,7 @@
</script> </script>
<script> <script>
window.flutterConfiguration = { window.flutterConfiguration = {
canvasKitBaseUrl: "/canvaskit/" canvasKitBaseUrl: "{{ $canvas_path }}/canvaskit/"
}; };
</script> </script>
</head> </head>

View File

@ -15,7 +15,7 @@
@if(!array_key_exists('filled', $field)) @if(!array_key_exists('filled', $field))
@component('portal.ninja2020.components.general.card-element', ['title' => $field['label']]) @component('portal.ninja2020.components.general.card-element', ['title' => $field['label']])
@if($field['name'] == 'client_country_id' || $field['name'] == 'client_shipping_country_id') @if($field['name'] == 'client_country_id' || $field['name'] == 'client_shipping_country_id')
<select id="client_country" class="input w-full form-select" name="{{ $field['name'] }}" wire:model="{{ str_replace(["client_","_line_","contact_"], ["client.","","contact."], $field['name']) }}"> <select id="client_country" class="input w-full form-select" name="{{ $field['name'] }}" wire:model.lazy="{{ str_replace(["client_","_line_","contact_"], ["client.","","contact."], $field['name']) }}">
<option value="none"></option> <option value="none"></option>
@foreach($countries as $country) @foreach($countries as $country)
@ -25,7 +25,7 @@
@endforeach @endforeach
</select> </select>
@else @else
<input class="input w-full" type="{{ $field['type'] ?? 'text' }}" name="{{ $field['name'] }}" wire:model="{{ str_replace(["client_","_line_","contact_"], ["client.","","contact."], $field['name']) }}"> <input class="input w-full" type="{{ $field['type'] ?? 'text' }}" name="{{ $field['name'] }}" wire:model.lazy="{{ str_replace(["client_","_line_","contact_"], ["client.","","contact."], $field['name']) }}">
@endif @endif
@if(session()->has('validation_errors') && array_key_exists($field['name'], session('validation_errors'))) @if(session()->has('validation_errors') && array_key_exists($field['name'], session('validation_errors')))

View File

@ -1,3 +1,4 @@
<div>
<div class="grid grid-cols-12 gap-8 mt-8"> <div class="grid grid-cols-12 gap-8 mt-8">
<div class="col-span-12 md:col-span-5 md:col-start-4 px-4 py-5"> <div class="col-span-12 md:col-span-5 md:col-start-4 px-4 py-5">
<!-- Total price --> <!-- Total price -->
@ -62,6 +63,7 @@
</div> </div>
</div> </div>
@elseif($amount <= 0) @elseif($amount <= 0)
<div class="relative flex justify-center text-sm leading-5"> <div class="relative flex justify-center text-sm leading-5">
<h1 class="text-2xl font-bold tracking-wide bg-gray-100 px-6 py-0"> <h1 class="text-2xl font-bold tracking-wide bg-gray-100 px-6 py-0">
{{ ctrans('texts.total') }}: {{ \App\Utils\Number::formatMoney($amount, $subscription->company) }} {{ ctrans('texts.total') }}: {{ \App\Utils\Number::formatMoney($amount, $subscription->company) }}
@ -69,12 +71,20 @@
</div> </div>
<div class="relative flex justify-center text-sm leading-5 mt-10"> <div class="relative flex justify-center text-sm leading-5 mt-10">
<button wire:click="handlePaymentNotRequired" class="px-3 py-2 border rounded mr-4 hover:border-blue-600"> <button wire:click="handlePaymentNotRequired" class="px-3 py-2 border rounded mr-4 hover:border-blue-600" wire:loading.attr="disabled" @if($hide_button) disabled @endif>
{{ ctrans('texts.click_to_continue') }} @if($hide_button) {{ ctrans('texts.loading') }} @else {{ ctrans('texts.click_to_continue') }} @endif
</button> </button>
</div> </div>
@endif @endif
</div> </div>
</div> </div>
<script defer>
window.addEventListener('redirectRoute', event => {
window.location.href = event.detail.route;
})
</script>
</div>