mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:17:30 -04:00
Fixes for report exports
This commit is contained in:
parent
6f80c6fab8
commit
25e75fbc52
@ -151,9 +151,9 @@ class InvoiceExport extends BaseExport
|
|||||||
// $entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
// $entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
||||||
// $entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
$entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (in_array('invoice.auto_bill_enabled', $this->input['report_keys'])) {
|
if (in_array('invoice.auto_bill_enabled', $this->input['report_keys'])) {
|
||||||
$entity['invoice.auto_bill_enabled'] = $invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no');
|
$entity['invoice.auto_bill_enabled'] = $invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no');
|
||||||
|
@ -236,9 +236,9 @@ class InvoiceItemExport extends BaseExport
|
|||||||
// $entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
// $entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
||||||
// $entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
$entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (in_array('invoice.assigned_user_id', $this->input['report_keys'])) {
|
if (in_array('invoice.assigned_user_id', $this->input['report_keys'])) {
|
||||||
$entity['invoice.assigned_user_id'] = $invoice->assigned_user ? $invoice->assigned_user->present()->name() : '';
|
$entity['invoice.assigned_user_id'] = $invoice->assigned_user ? $invoice->assigned_user->present()->name() : '';
|
||||||
|
@ -31,51 +31,6 @@ class PurchaseOrderExport extends BaseExport
|
|||||||
|
|
||||||
private Decorator $decorator;
|
private Decorator $decorator;
|
||||||
|
|
||||||
public array $entity_keys = [
|
|
||||||
'amount' => 'purchase_order.amount',
|
|
||||||
'balance' => 'purchase_order.balance',
|
|
||||||
'vendor' => 'purchase_order.vendor_id',
|
|
||||||
// 'custom_surcharge1' => 'purchase_order.custom_surcharge1',
|
|
||||||
// 'custom_surcharge2' => 'purchase_order.custom_surcharge2',
|
|
||||||
// 'custom_surcharge3' => 'purchase_order.custom_surcharge3',
|
|
||||||
// 'custom_surcharge4' => 'purchase_order.custom_surcharge4',
|
|
||||||
'custom_value1' => 'purchase_order.custom_value1',
|
|
||||||
'custom_value2' => 'purchase_order.custom_value2',
|
|
||||||
'custom_value3' => 'purchase_order.custom_value3',
|
|
||||||
'custom_value4' => 'purchase_order.custom_value4',
|
|
||||||
'date' => 'purchase_order.date',
|
|
||||||
'discount' => 'purchase_order.discount',
|
|
||||||
'due_date' => 'purchase_order.due_date',
|
|
||||||
'exchange_rate' => 'purchase_order.exchange_rate',
|
|
||||||
'footer' => 'purchase_order.footer',
|
|
||||||
'number' => 'purchase_order.number',
|
|
||||||
'paid_to_date' => 'purchase_order.paid_to_date',
|
|
||||||
'partial' => 'purchase_order.partial',
|
|
||||||
'partial_due_date' => 'purchase_order.partial_due_date',
|
|
||||||
'po_number' => 'purchase_order.po_number',
|
|
||||||
'private_notes' => 'purchase_order.private_notes',
|
|
||||||
'public_notes' => 'purchase_order.public_notes',
|
|
||||||
'status' => 'purchase_order.status',
|
|
||||||
'tax_name1' => 'purchase_order.tax_name1',
|
|
||||||
'tax_name2' => 'purchase_order.tax_name2',
|
|
||||||
'tax_name3' => 'purchase_order.tax_name3',
|
|
||||||
'tax_rate1' => 'purchase_order.tax_rate1',
|
|
||||||
'tax_rate2' => 'purchase_order.tax_rate2',
|
|
||||||
'tax_rate3' => 'purchase_order.tax_rate3',
|
|
||||||
'terms' => 'purchase_order.terms',
|
|
||||||
'total_taxes' => 'purchase_order.total_taxes',
|
|
||||||
'currency_id' => 'purchase_order.currency_id',
|
|
||||||
];
|
|
||||||
|
|
||||||
private array $decorate_keys = [
|
|
||||||
'country',
|
|
||||||
'currency_id',
|
|
||||||
'status',
|
|
||||||
'vendor',
|
|
||||||
'project',
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(Company $company, array $input)
|
public function __construct(Company $company, array $input)
|
||||||
{
|
{
|
||||||
$this->company = $company;
|
$this->company = $company;
|
||||||
@ -169,7 +124,7 @@ class PurchaseOrderExport extends BaseExport
|
|||||||
if (is_array($parts) && $parts[0] == 'purchase_order' && array_key_exists($parts[1], $transformed_purchase_order)) {
|
if (is_array($parts) && $parts[0] == 'purchase_order' && array_key_exists($parts[1], $transformed_purchase_order)) {
|
||||||
$entity[$key] = $transformed_purchase_order[$parts[1]];
|
$entity[$key] = $transformed_purchase_order[$parts[1]];
|
||||||
} else {
|
} else {
|
||||||
// nlog($key);
|
nlog($key);
|
||||||
$entity[$key] = $this->decorator->transform($key, $purchase_order);
|
$entity[$key] = $this->decorator->transform($key, $purchase_order);
|
||||||
// $entity[$key] = '';
|
// $entity[$key] = '';
|
||||||
|
|
||||||
@ -184,16 +139,13 @@ class PurchaseOrderExport extends BaseExport
|
|||||||
|
|
||||||
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity): array
|
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity): array
|
||||||
{
|
{
|
||||||
if (in_array('country_id', $this->input['report_keys'])) {
|
|
||||||
$entity['country'] = $purchase_order->vendor->country ? ctrans("texts.country_{$purchase_order->vendor->country->name}") : '';
|
if (in_array('purchase_order.currency_id', $this->input['report_keys'])) {
|
||||||
|
$entity['purchase_order.currency_id'] = $purchase_order->vendor->currency() ? $purchase_order->vendor->currency()->code : $purchase_order->company->currency()->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
if (in_array('purchase_order.vendor_id', $this->input['report_keys'])) {
|
||||||
$entity['currency_id'] = $purchase_order->vendor->currency() ? $purchase_order->vendor->currency()->code : $purchase_order->company->currency()->code;
|
$entity['purchase_order.vendor_id'] = $purchase_order->vendor->present()->name();
|
||||||
}
|
|
||||||
|
|
||||||
if (in_array('vendor_id', $this->input['report_keys'])) {
|
|
||||||
$entity['vendor'] = $purchase_order->vendor->present()->name();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('purchase_order.status', $this->input['report_keys'])) {
|
if (in_array('purchase_order.status', $this->input['report_keys'])) {
|
||||||
|
@ -192,23 +192,35 @@ class PurchaseOrderItemExport extends BaseExport
|
|||||||
|
|
||||||
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity): array
|
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity): array
|
||||||
{
|
{
|
||||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||||
$entity['currency'] = $purchase_order->vendor->currency() ? $purchase_order->vendor->currency()->code : $purchase_order->company->currency()->code;
|
// $entity['currency'] = $purchase_order->vendor->currency() ? $purchase_order->vendor->currency()->code : $purchase_order->company->currency()->code;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(array_key_exists('type', $entity)) {
|
||||||
|
// $entity['type'] = $purchase_order->typeIdString($entity['type']);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(array_key_exists('tax_category', $entity)) {
|
||||||
|
// $entity['tax_category'] = $purchase_order->taxTypeString($entity['tax_category']);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if($this->force_keys) {
|
||||||
|
// $entity['vendor'] = $purchase_order->vendor->present()->name();
|
||||||
|
// $entity['vendor_id_number'] = $purchase_order->vendor->id_number;
|
||||||
|
// $entity['vendor_number'] = $purchase_order->vendor->number;
|
||||||
|
// $entity['status'] = $purchase_order->stringStatus($purchase_order->status_id);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (in_array('purchase_order.currency_id', $this->input['report_keys'])) {
|
||||||
|
$entity['purchase_order.currency_id'] = $purchase_order->vendor->currency() ? $purchase_order->vendor->currency()->code : $purchase_order->company->currency()->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array_key_exists('type', $entity)) {
|
if (in_array('purchase_order.vendor_id', $this->input['report_keys'])) {
|
||||||
$entity['type'] = $purchase_order->typeIdString($entity['type']);
|
$entity['purchase_order.vendor_id'] = $purchase_order->vendor->present()->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array_key_exists('tax_category', $entity)) {
|
if (in_array('purchase_order.status', $this->input['report_keys'])) {
|
||||||
$entity['tax_category'] = $purchase_order->taxTypeString($entity['tax_category']);
|
$entity['purchase_order.status'] = $purchase_order->stringStatus($purchase_order->status_id);
|
||||||
}
|
|
||||||
|
|
||||||
if($this->force_keys) {
|
|
||||||
$entity['vendor'] = $purchase_order->vendor->present()->name();
|
|
||||||
$entity['vendor_id_number'] = $purchase_order->vendor->id_number;
|
|
||||||
$entity['vendor_number'] = $purchase_order->vendor->number;
|
|
||||||
$entity['status'] = $purchase_order->stringStatus($purchase_order->status_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('purchase_order.user_id', $this->input['report_keys'])) {
|
if (in_array('purchase_order.user_id', $this->input['report_keys'])) {
|
||||||
|
@ -79,7 +79,6 @@ class InvoiceDecorator extends Decorator implements DecoratorInterface
|
|||||||
return $invoice->partial_due_date ?? '';
|
return $invoice->partial_due_date ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function assigned_user_id(Invoice $invoice)
|
public function assigned_user_id(Invoice $invoice)
|
||||||
{
|
{
|
||||||
return $invoice->assigned_user ? $invoice->assigned_user->present()->name() : '';
|
return $invoice->assigned_user ? $invoice->assigned_user->present()->name() : '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user