Fixes for tests

This commit is contained in:
David Bomba 2023-08-24 13:51:48 +10:00
parent fec6fe8f31
commit 2bc75feb21
2 changed files with 13 additions and 7 deletions

View File

@ -925,21 +925,27 @@ class BaseExport
{ {
$parts = explode(".", $value); $parts = explode(".", $value);
if(in_array($parts[0], ['credit','quote','invoice','purchase_order','recurring_invoice'])){ if(count($parts) == 2 && in_array($parts[0], ['credit','quote','invoice','purchase_order','recurring_invoice'])){
$entity = "invoice".substr($parts[1], -1); $entity = "invoice".substr($parts[1], -1);
$header[] = "{$prefix}" . $helper->makeCustomField($this->company->custom_fields, $entity);
} }
else { elseif(count($parts) == 2 && stripos($parts[0], 'contact') !== false) {
$entity = $parts[0].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]}");
$header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string;
} }
else{
$header[] = $helper->makeCustomField($this->company->custom_fields, $entity); nlog("else".$key);
$header[] = "{$prefix}" . ctrans("texts.{$key}");
}
} }
else else
{ {
$header[] = "{$prefix}" . ctrans("texts.{$key}"); $header[] = "{$prefix}" . ctrans("texts.{$key}");
} }
} }
nlog($header);
return $header; return $header;
} }
} }

View File

@ -673,7 +673,7 @@ class ReportCsvGenerationTest extends TestCase
])->post('/api/v1/reports/clients', $data); ])->post('/api/v1/reports/clients', $data);
$csv = $response->streamedContent(); $csv = $response->streamedContent();
nlog($csv);
$reader = Reader::createFromString($csv); $reader = Reader::createFromString($csv);
$reader->setHeaderOffset(0); $reader->setHeaderOffset(0);