1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for releases

This commit is contained in:
David Bomba 2023-07-06 12:34:35 +10:00
parent 2b24c2fd88
commit 5496cefdb8
2 changed files with 27 additions and 17 deletions

View File

@ -47,7 +47,6 @@ jobs:
npm i npm i
npm run build npm run build
cp -r dist/react/* ../public/react cp -r dist/react/* ../public/react
mkdir public/tinymce_6.4.2/tinymce/js/
cp -r node_modules/tinymce ../public/tinymce_6.4.2/tinymce/js/ cp -r node_modules/tinymce ../public/tinymce_6.4.2/tinymce/js/
cd .. cd ..
rm -rf ui rm -rf ui

View File

@ -30,6 +30,8 @@ class InvoiceItemExport extends BaseExport
public Writer $csv; public Writer $csv;
private bool $force_keys = false;
public array $entity_keys = [ public array $entity_keys = [
'amount' => 'amount', 'amount' => 'amount',
'balance' => 'balance', 'balance' => 'balance',
@ -112,6 +114,7 @@ class InvoiceItemExport extends BaseExport
$this->csv = Writer::createFromString(); $this->csv = Writer::createFromString();
if (count($this->input['report_keys']) == 0) { if (count($this->input['report_keys']) == 0) {
$this->force_keys = true;
$this->input['report_keys'] = array_values($this->entity_keys); $this->input['report_keys'] = array_values($this->entity_keys);
} }
@ -153,12 +156,10 @@ class InvoiceItemExport extends BaseExport
} }
} }
} }
nlog("item array");
nlog($item_array);
$entity = []; $entity = [];
foreach (array_values($this->input['report_keys']) as $key) { foreach (array_values($this->input['report_keys']) as $key) { //create an array of report keys only
$keyval = array_search($key, $this->entity_keys); $keyval = array_search($key, $this->entity_keys);
if (array_key_exists($key, $transformed_items)) { if (array_key_exists($key, $transformed_items)) {
@ -168,9 +169,6 @@ nlog($item_array);
} }
} }
nlog("entity");
nlog($entity);
$transformed_items = array_merge($transformed_invoice, $item_array); $transformed_items = array_merge($transformed_invoice, $item_array);
$entity = $this->decorateAdvancedFields($invoice, $transformed_items); $entity = $this->decorateAdvancedFields($invoice, $transformed_items);
@ -187,13 +185,27 @@ nlog($entity);
foreach (array_values($this->input['report_keys']) as $key) { foreach (array_values($this->input['report_keys']) as $key) {
$keyval = array_search($key, $this->entity_keys); $keyval = array_search($key, $this->entity_keys);
if(!$keyval) {
$keyval = array_search(str_replace("invoice.", "", $key), $this->entity_keys) ?? $key;
}
if(!$keyval) {
$keyval = $key;
}
nlog($keyval);
if (array_key_exists($key, $transformed_invoice)) { if (array_key_exists($key, $transformed_invoice)) {
$entity[$keyval] = $transformed_invoice[$key]; $entity[$keyval] = $transformed_invoice[$key];
} else { } elseif (array_key_exists($keyval, $transformed_invoice)) {
$entity[$keyval] = ""; $entity[$keyval] = $transformed_invoice[$keyval];
}
else {
$entity[$keyval] = $this->resolveKey($keyval, $invoice, $this->invoice_transformer);
} }
} }
nlog($entity);
return $this->decorateAdvancedFields($invoice, $entity); return $this->decorateAdvancedFields($invoice, $entity);
} }
@ -203,13 +215,12 @@ nlog($entity);
$entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code; $entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
} }
// if(in_array('client_id', $this->input['report_keys'])) if($this->force_keys) {
$entity['client'] = $invoice->client->present()->name(); $entity['client'] = $invoice->client->present()->name();
$entity['client_id_number'] = $invoice->client->id_number; $entity['client_id_number'] = $invoice->client->id_number;
$entity['client_number'] = $invoice->client->number; $entity['client_number'] = $invoice->client->number;
// if(in_array('status_id', $this->input['report_keys']))
$entity['status'] = $invoice->stringStatus($invoice->status_id); $entity['status'] = $invoice->stringStatus($invoice->status_id);
}
return $entity; return $entity;
} }