1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Fixes for required client info

This commit is contained in:
David Bomba 2022-03-10 13:05:01 +11:00
parent 6351cc8c60
commit b1887f8fa8
4 changed files with 49 additions and 8 deletions

View File

@ -0,0 +1,28 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\Transactions;
use App\Models\Client;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\Payment;
use App\Models\TransactionEvent;
/**
* InvoiceReversalTransaction.
*/
class InvoiceReversalTransaction extends BaseTransaction implements TransactionInterface
{
public $event_id = TransactionEvent::INVOICE_REVERSED;
}

View File

@ -82,6 +82,18 @@ class RequiredClientInfo extends Component
'client.state' => '',
'client.postal_code' => '',
'client.country_id' => '',
'client.shipping_address1' => '',
'client.shipping_address2' => '',
'client.shipping_city' => '',
'client.shipping_state' => '',
'client.shipping_postal_code' => '',
'client.shipping_country_id' => '',
'contact.first_name' => '',
'contact.last_name' => '',
'contact.email' => '',
'client.name' => '',
'client.website' => '',
'client.phone' => '',
];
public $show_form = false;
@ -93,6 +105,11 @@ class RequiredClientInfo extends Component
MultiDB::setDb($this->company->db);
$this->client = $this->contact->client;
count($this->fields) > 0
? $this->checkFields()
: $this->show_form = false;
}
public function handleSubmit(array $data): bool
@ -213,10 +230,6 @@ class RequiredClientInfo extends Component
public function render()
{
count($this->fields) > 0
? $this->checkFields()
: $this->show_form = false;
return render('components.livewire.required-client-info');
}
}

View File

@ -91,14 +91,14 @@ class UpdateInvoicePayment
$this->payment->applied += $paid_amount;
$transaction = [
'invoice' => $this->invoice->transaction_event(),
'invoice' => $invoice->transaction_event(),
'payment' => $this->payment->transaction_event(),
'client' => $client->transaction_event(),
'credit' => [],
'metadata' => [],
];
TransactionLog::dispatch(TransactionEvent::GATEWAY_PAYMENT_MADE, $transaction, $this->invoice->company->db);
TransactionLog::dispatch(TransactionEvent::GATEWAY_PAYMENT_MADE, $transaction, $invoice->company->db);
});

View File

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