mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 12:42:36 +01:00
Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop
This commit is contained in:
commit
0e10ec9d49
@ -95,4 +95,9 @@ class UserPresenter extends EntityPresenter
|
||||
{
|
||||
return $this->entity->phone ?? ' ';
|
||||
}
|
||||
|
||||
public function email(): string
|
||||
{
|
||||
return $this->entity->email ?? ' ';
|
||||
}
|
||||
}
|
||||
|
@ -565,9 +565,9 @@ $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiv
|
||||
$party->PhysicalLocation = $address;
|
||||
|
||||
$contact = new Contact();
|
||||
$contact->ElectronicMail = $this->invoice->company->owner()->email ?? 'owner@gmail.com';
|
||||
$contact->Telephone = '';
|
||||
$contact->Name = '';
|
||||
$contact->ElectronicMail = $this->getSetting('Invoice.AccountingSupplierParty.Party.Contact') ?? $this->invoice->company->owner()->present()->email();
|
||||
$contact->Telephone = $this->getSetting('Invoice.AccountingSupplierParty.Party.Telephone') ?? $this->invoice->company->getSetting('phone');
|
||||
$contact->Name = $this->getSetting('Invoice.AccountingSupplierParty.Party.Name') ?? $this->invoice->company->owner()->present()->name();
|
||||
|
||||
$party->Contact = $contact;
|
||||
|
||||
@ -693,20 +693,26 @@ $tax_amount->amount = $this->invoice->uses_inclusive_taxes ? $this->calcInclusiv
|
||||
//only scans for top level props
|
||||
foreach($settings as $prop => $visibility){
|
||||
|
||||
if($prop_value = PropertyResolver::resolve($this->invoice->client->e_invoice, $prop))
|
||||
if($prop_value = $this->getSetting($prop))
|
||||
$this->p_invoice->{$prop} = $prop_value;
|
||||
elseif($prop_value = PropertyResolver::resolve($this->invoice->company->e_invoice, $prop)) {
|
||||
$this->p_invoice->{$prop} = $prop_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSetting(object $e_invoice, string $property_path): mixed
|
||||
public function getSetting(string $property_path): mixed
|
||||
{
|
||||
return PropertyResolver::resolve($e_invoice, $property_path);
|
||||
|
||||
if($prop_value = PropertyResolver::resolve($this->invoice->e_invoice, $property_path))
|
||||
return $prop_value;
|
||||
elseif($prop_value = PropertyResolver::resolve($this->invoice->client->e_invoice, $property_path))
|
||||
return $prop_value;
|
||||
elseif($prop_value = PropertyResolver::resolve($this->invoice->company->e_invoice, $property_path))
|
||||
return $prop_value;
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public function countryLevelMutators():self
|
||||
|
@ -19,18 +19,19 @@ use Tests\MockAccountData;
|
||||
use App\DataMapper\InvoiceItem;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Factory\CompanyUserFactory;
|
||||
use InvoiceNinja\EInvoice\EInvoice;
|
||||
use InvoiceNinja\EInvoice\Symfony\Encode;
|
||||
use App\Services\EDocument\Standards\Peppol;
|
||||
use App\Services\EDocument\Standards\FatturaPANew;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronica;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\BranchType\FinancialInstitutionBranch;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\FinancialAccountType\PayeeFinancialAccount;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaBodyType\FatturaElettronicaBody;
|
||||
use InvoiceNinja\EInvoice\Models\FatturaPA\FatturaElettronicaHeaderType\FatturaElettronicaHeader;
|
||||
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -92,6 +93,12 @@ class PeppolTest extends TestCase
|
||||
'settings' => $settings,
|
||||
'e_invoice' => $einvoice,
|
||||
]);
|
||||
|
||||
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
||||
$cu->is_owner = true;
|
||||
$cu->is_admin = true;
|
||||
$cu->is_locked = false;
|
||||
$cu->save();
|
||||
|
||||
$client_settings = ClientSettings::defaults();
|
||||
$client_settings->currency_id = '3';
|
||||
@ -206,6 +213,12 @@ class PeppolTest extends TestCase
|
||||
'e_invoice' => $einvoice,
|
||||
]);
|
||||
|
||||
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
||||
$cu->is_owner = true;
|
||||
$cu->is_admin = true;
|
||||
$cu->is_locked = false;
|
||||
$cu->save();
|
||||
|
||||
$client_settings = ClientSettings::defaults();
|
||||
$client_settings->currency_id = '3';
|
||||
|
||||
@ -301,6 +314,13 @@ class PeppolTest extends TestCase
|
||||
'account_id' => $this->account->id,
|
||||
'settings' => $settings,
|
||||
]);
|
||||
|
||||
|
||||
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
||||
$cu->is_owner = true;
|
||||
$cu->is_admin = true;
|
||||
$cu->is_locked = false;
|
||||
$cu->save();
|
||||
|
||||
$client_settings = ClientSettings::defaults();
|
||||
$client_settings->currency_id = '3';
|
||||
|
Loading…
Reference in New Issue
Block a user