1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #7340 from turbo124/v5-develop

Fixes for custom messages
This commit is contained in:
David Bomba 2022-03-29 19:03:12 +11:00 committed by GitHub
commit e5798b442b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 24 deletions

View File

@ -529,17 +529,17 @@ class Client extends BaseModel implements HasLocalePreference
}
if ($this->currency()->code == 'EUR' && in_array(GatewayType::SEPA, array_column($pms, 'gateway_type_id'))) {
foreach ($pms as $pm) {
if ($pm['gateway_type_id'] == GatewayType::SEPA) {
$cg = CompanyGateway::find($pm['company_gateway_id']);
// if ($this->currency()->code == 'EUR' && in_array(GatewayType::SEPA, array_column($pms, 'gateway_type_id'))) {
// foreach ($pms as $pm) {
// if ($pm['gateway_type_id'] == GatewayType::SEPA) {
// $cg = CompanyGateway::find($pm['company_gateway_id']);
if ($cg && $cg->fees_and_limits->{GatewayType::SEPA}->is_enabled) {
return $cg;
}
}
}
}
// if ($cg && $cg->fees_and_limits->{GatewayType::SEPA}->is_enabled) {
// return $cg;
// }
// }
// }
// }
if ($this->country && $this->country->iso_3166_3 == 'GBR' && in_array(GatewayType::DIRECT_DEBIT, array_column($pms, 'gateway_type_id'))) {
foreach ($pms as $pm) {

View File

@ -34,6 +34,12 @@ class SEPA
public function authorizeView($data)
{
$data['gateway'] = $this->stripe;
$data['payment_method_id'] = GatewayType::SEPA;
$data['client'] = $this->stripe->client;
$data['country'] = $this->stripe->client->country->iso_3166_2;
$data['currency'] = $this->stripe->client->currency();
return render('gateways.stripe.sepa.authorize', $data);
}

View File

@ -362,6 +362,8 @@ class InvoiceService
if(!collect($this->invoice->line_items)->contains('type_id', 3))
return $this;
$pre_count = count($this->invoice->line_items);
$this->invoice->line_items = collect($this->invoice->line_items)
->reject(function ($item) {
return $item->type_id == '3';
@ -372,7 +374,7 @@ class InvoiceService
/* 24-03-2022 */
$new_balance = $this->invoice->balance;
if(floatval($balance) - floatval($new_balance) != 0)
if($pre_count != count($this->invoice->line_items))
{
$adjustment = $balance - $new_balance;

View File

@ -96,17 +96,10 @@ class MarkPaid extends AbstractService
$payment->ledger()
->updatePaymentBalance($payment->amount * -1);
// $client = $this->invoice->client->fresh();
// $client->paid_to_date += $payment->amount;
// $client->balance += $payment->amount * -1;
// $client->save();
$this->invoice
->client
->service()
->updateBalance($payment->amount * -1)
->updatePaidToDate($payment->amount)
->save();
$client = $this->invoice->client->fresh();
$client->paid_to_date += $payment->amount;
$client->balance += $payment->amount * -1;
$client->save();
$this->invoice = $this->invoice
->service()

View File

@ -0,0 +1,41 @@
<?php
use App\Models\Gateway;
use App\Utils\Ninja;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ReverseAppleDomainForHosted extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(Ninja::isHosted())
{
$stripe_connect = Gateway::find(56);
if($stripe_connect){
$stripe_connect->fields = '{"account_id":""}';
$stripe_connect->save();
}
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -31,7 +31,7 @@
@endif
<!-- Title -->
@if(isset($account) && !$account->isPaid())
@if(isset($company->account) && !$company->account->isPaid())
<title>@yield('meta_title', '') Invoice Ninja</title>
@elseif(isset($company) && !is_null($company))
<title>@yield('meta_title', '') {{ $company->present()->name() }}</title>
@ -74,7 +74,7 @@
{{-- Feel free to push anything to header using @push('header') --}}
@stack('head')
@if((isset($account) && $account->isPaid()) || ((bool) \App\Utils\Ninja::isSelfHost() && !empty($client->getSetting('portal_custom_head'))))
@if((isset($company) && $company->account->isPaid() && !empty($client->getSetting('portal_custom_head'))) || ((bool) \App\Utils\Ninja::isSelfHost() && !empty($client->getSetting('portal_custom_head'))))
<div class="py-1 text-sm text-center text-white bg-primary">
{!! $client->getSetting('portal_custom_head') !!}
</div>