close #2561 Fixed: Countries prefix flaw
This commit is contained in:
parent
ddfdfdcb8e
commit
0fd7b4e0c9
@ -16,10 +16,16 @@ class Bills extends Export implements WithColumnFormatting
|
|||||||
|
|
||||||
public function map($model): array
|
public function map($model): array
|
||||||
{
|
{
|
||||||
|
$country = null;
|
||||||
|
|
||||||
|
if ($model->contact_country && array_key_exists($model->contact_country, trans('countries'))) {
|
||||||
|
$country = trans('countries.' . $model->contact_country);
|
||||||
|
}
|
||||||
|
|
||||||
$model->category_name = $model->category->name;
|
$model->category_name = $model->category->name;
|
||||||
$model->bill_number = $model->document_number;
|
$model->bill_number = $model->document_number;
|
||||||
$model->billed_at = $model->issued_at;
|
$model->billed_at = $model->issued_at;
|
||||||
$model->contact_country = ($model->contact_country) ? trans('countries.' . $model->contact_country) : null;
|
$model->contact_country = $country;
|
||||||
|
|
||||||
return parent::map($model);
|
return parent::map($model);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,13 @@ class Vendors extends Export
|
|||||||
|
|
||||||
public function map($model): array
|
public function map($model): array
|
||||||
{
|
{
|
||||||
$model->country = ($model->country) ? trans('countries.' . $model->country) : null;
|
$country = null;
|
||||||
|
|
||||||
|
if ($model->country && array_key_exists($model->country, trans('countries'))) {
|
||||||
|
$country = trans('countries.' . $model->country);
|
||||||
|
}
|
||||||
|
|
||||||
|
$model->country = $country;
|
||||||
|
|
||||||
return parent::map($model);
|
return parent::map($model);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,13 @@ class Customers extends Export
|
|||||||
|
|
||||||
public function map($model): array
|
public function map($model): array
|
||||||
{
|
{
|
||||||
$model->country = ($model->country) ? trans('countries.' . $model->country) : null;
|
$country = null;
|
||||||
|
|
||||||
|
if ($model->country && array_key_exists($model->country, trans('countries'))) {
|
||||||
|
$country = trans('countries.' . $model->country);
|
||||||
|
}
|
||||||
|
|
||||||
|
$model->country = $country;
|
||||||
|
|
||||||
return parent::map($model);
|
return parent::map($model);
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,16 @@ class Invoices extends Export implements WithColumnFormatting
|
|||||||
|
|
||||||
public function map($model): array
|
public function map($model): array
|
||||||
{
|
{
|
||||||
|
$country = null;
|
||||||
|
|
||||||
|
if ($model->contact_country && array_key_exists($model->contact_country, trans('countries'))) {
|
||||||
|
$country = trans('countries.' . $model->contact_country);
|
||||||
|
}
|
||||||
|
|
||||||
$model->category_name = $model->category->name;
|
$model->category_name = $model->category->name;
|
||||||
$model->invoice_number = $model->document_number;
|
$model->invoice_number = $model->document_number;
|
||||||
$model->invoiced_at = $model->issued_at;
|
$model->invoiced_at = $model->issued_at;
|
||||||
$model->contact_country = ($model->contact_country) ? trans('countries.' . $model->contact_country) : null;
|
$model->contact_country = $country;
|
||||||
|
|
||||||
return parent::map($model);
|
return parent::map($model);
|
||||||
}
|
}
|
||||||
|
@ -526,8 +526,10 @@ class Company extends Eloquent implements Ownable
|
|||||||
$location[] = setting('company.state');
|
$location[] = setting('company.state');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting('company.country')) {
|
$country = setting('company.country');
|
||||||
$location[] = trans('countries.' . setting('company.country'));
|
|
||||||
|
if ($country && in_array($country, trans('countries'))) {
|
||||||
|
$location[] = trans('countries.' . $country);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(', ', $location);
|
return implode(', ', $location);
|
||||||
|
@ -254,7 +254,7 @@ class Contact extends Model
|
|||||||
$location[] = $this->state;
|
$location[] = $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->country) {
|
if ($this->country && in_array($this->country, trans('countries'))) {
|
||||||
$location[] = trans('countries.' . $this->country);
|
$location[] = trans('countries.' . $this->country);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ class Document extends Model
|
|||||||
$location[] = $this->contact_state;
|
$location[] = $this->contact_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->contact_country) {
|
if ($this->contact_country && in_array($this->contact_country, trans('countries'))) {
|
||||||
$location[] = trans('countries.' . $this->contact_country);
|
$location[] = trans('countries.' . $this->contact_country);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class Country extends Component
|
|||||||
*/
|
*/
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
if (! empty($this->code)) {
|
if (! empty($this->code) && in_array($this->code, trans('countries'))) {
|
||||||
$this->country = trans('countries.' . $this->code);
|
$this->country = trans('countries.' . $this->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user