Minor fixeS

This commit is contained in:
David Bomba 2023-08-24 20:41:06 +10:00
parent 4efc0dbb9a
commit d6cdb01021
2 changed files with 8 additions and 12 deletions

View File

@ -845,7 +845,7 @@ class BaseExport
$key = array_search($value, $this->entity_keys); $key = array_search($value, $this->entity_keys);
$original_key = $key; $original_key = $key;
nlog("{$key} => {$value}"); // nlog("{$key} => {$value}");
$prefix = ''; $prefix = '';
if(!$key) { if(!$key) {
@ -938,20 +938,15 @@ class BaseExport
} }
elseif(count($parts) == 2 && stripos($parts[0], 'contact') !== false) { elseif(count($parts) == 2 && stripos($parts[0], 'contact') !== false) {
nlog("2");
$entity = "contact".substr($parts[1], -1); $entity = "contact".substr($parts[1], -1);
$custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, $entity)) > 1 ? $helper->makeCustomField($this->company->custom_fields, $entity) : ctrans("texts.{$parts[1]}"); $custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, $entity)) > 1 ? $helper->makeCustomField($this->company->custom_fields, $entity) : ctrans("texts.{$parts[1]}");
$header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string; $header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string;
} }
elseif(count($parts) == 2 && in_array(substr($original_key, 0, -1), ['credit','quote','invoice','purchase_order','recurring_invoice'])){ elseif(count($parts) == 2 && in_array(substr($original_key, 0, -1), ['credit','quote','invoice','purchase_order','recurring_invoice'])){
nlog("3");
$custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, "product".substr($original_key,-1))) > 1 ? $helper->makeCustomField($this->company->custom_fields, "product".substr($original_key,-1)) : ctrans("texts.{$parts[1]}"); $custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, "product".substr($original_key,-1))) > 1 ? $helper->makeCustomField($this->company->custom_fields, "product".substr($original_key,-1)) : ctrans("texts.{$parts[1]}");
nlog(ctrans("texts.{$parts[0]}") . " " . $custom_field_string);
$header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string; $header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string;
} }
else{ else{
nlog("else".$key);
$header[] = "{$prefix}" . ctrans("texts.{$key}"); $header[] = "{$prefix}" . ctrans("texts.{$key}");
} }
@ -961,7 +956,9 @@ class BaseExport
$header[] = "{$prefix}" . ctrans("texts.{$key}"); $header[] = "{$prefix}" . ctrans("texts.{$key}");
} }
} }
nlog($header);
nlog($header);
return $header; return $header;
} }
} }

View File

@ -41,12 +41,11 @@ class CreditExport extends BaseExport
{ {
$query = $this->init(); $query = $this->init();
$header = [];
$headerdisplay = $this->buildHeader(); $headerdisplay = $this->buildHeader();
foreach ($this->input['report_keys'] as $key => $value) { $header = collect($this->input['report_keys'])->map(function ($key, $value) use($headerdisplay){
$header[] = ['identifier' => $value, 'display_value' => $headerdisplay[$key]]; return ['identifier' => $value, 'display_value' => $headerdisplay[$key]];
} })->toArray();
$report = $query->cursor() $report = $query->cursor()
->map(function ($credit) { ->map(function ($credit) {