minor fixes for formatting

This commit is contained in:
David Bomba 2023-11-27 22:20:58 +11:00
parent b2b8494971
commit dc39d7f01a
8 changed files with 86 additions and 9 deletions

View File

@ -928,7 +928,11 @@ class BaseController extends Controller
} //allows us to selective display bank integrations back to the user if they can view / create bank transactions but without the bank balance being present in the response
elseif($this->entity_type == TaxRate::class && $user->hasIntersectPermissions(['create_invoice','edit_invoice','create_quote','edit_quote','create_purchase_order','edit_purchase_order'])) {
// need to show tax rates if the user has the ability to create documents.
} else {
}
elseif($this->entity_type == ExpenseCategory::class && $user->hasPermission('create_expense')) {
// need to show expense categories if the user has the ability to create expenses.
}
else {
$query->where('user_id', '=', $user->id);
}
} elseif (in_array($this->entity_type, [Design::class, GroupSetting::class, PaymentTerm::class, TaskStatus::class])) {

View File

@ -197,6 +197,8 @@ class PaymentEmailEngine extends BaseEmailEngine
$data = [];
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];
$data['$amount_paid'] = ['value' => '', 'label' => ctrans('texts.amount_paid')];
$data['$refund'] = ['value' => '', 'label' => ctrans('texts.refund')];
$data['$to'] = ['value' => '', 'label' => ctrans('texts.to')];
$data['$number'] = ['value' => $this->payment->number ?: ' ', 'label' => ctrans('texts.payment_number')];
$data['$payment.number'] = &$data['$number'];
@ -207,6 +209,7 @@ class PaymentEmailEngine extends BaseEmailEngine
$data['$amount'] = &$data['$payment.amount'];
$data['$payment.date'] = ['value' => $this->translateDate($this->payment->date, $this->client->date_format(), $this->client->locale()), 'label' => ctrans('texts.payment_date')];
$data['$transaction_reference'] = ['value' => $this->payment->transaction_reference, 'label' => ctrans('texts.transaction_reference')];
$data['$reference'] = ['value' => '', 'label' => ctrans('texts.reference')];
$data['$public_notes'] = ['value' => $this->payment->public_notes, 'label' => ctrans('texts.notes')];
$data['$payment1'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'payment1', $this->payment->custom_value1, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'payment1')];

View File

@ -432,6 +432,8 @@ class PdfMock
'$credit_no' => '0029',
'$font_size' => $this->settings->font_size,
'$view_link' => '<a class="button" href="http://ninja.test:8000/client/invoice/UAUY8vIPuno72igmXbbpldwo5BDDKIqs">View Invoice</a>',
'$reference' => '',
'$po_number' => 'PO12345',
'$page_size' => $this->settings->page_size,
'$country_2' => 'AF',
'$firstName' => 'Benedict',
@ -464,6 +466,7 @@ class PdfMock
'$client4' => 'custom value',
'$dueDate' => '2022-01-01',
'$invoice' => '0029',
'$invoices' => '0029',
'$account' => '434343',
'$country' => 'United States',
'$contact' => 'Benedict Eichmann',
@ -501,6 +504,13 @@ class PdfMock
'$show_shipping_address_visibility' => $this->settings->show_shipping_address ? 'visible' : 'hidden',
'$start_date' => '31/01/2023',
'$end_date' => '31/12/2023',
'$history' => '',
'$amount_paid' => '',
'$receipt' => '',
'$ship_to' => '',
'$delivery_note' => '',
'$quantity' => '',
'$order_number' => '',
],
'labels' => $this->mockTranslatedLabels(),
];
@ -751,6 +761,7 @@ class PdfMock
'$user_iban_label' => ctrans('texts.iban'),
'$signature_label' => ctrans('texts.signature'),
'$font_size_label' => ctrans('texts.font_size'),
'$reference_label' => ctrans('texts.reference'),
'$po_number_label' => ctrans('texts.po_number'),
'$page_size_label' => ctrans('texts.page_size'),
'$user.name_label' => ctrans('texts.name'),
@ -821,6 +832,15 @@ class PdfMock
'$to_label' => ctrans('texts.to'),
'$start_date_label' => ctrans('texts.start_date'),
'$end_date_label' => ctrans('texts.end_date'),
'$invoice_label' => ctrans('texts.invoice'),
'$invoices_label' => ctrans('texts.invoices'),
'$history_label' => ctrans('texts.history'),
'$amount_paid_label' => ctrans('texts.amount_paid'),
'$receipt_label' => ctrans('texts.receipt'),
'$ship_to_label' => ctrans('texts.ship_to'),
'$delivery_note_label' => ctrans('texts.delivery_note'),
'$quantity_label' => ctrans('texts.quantity'),
'$order_number_label' => ctrans('texts.order_number'),
];
}
@ -1018,6 +1038,7 @@ class PdfMock
'$amount_raw' => '10256.40',
'$vat_number' => 'At qui autem iusto et.',
'$portal_url' => 'http://ninja.test:8000/vendor/',
'$reference' => '',
'$po_number' => null,
'$statement' => '',
'$view_link' => '
@ -1133,6 +1154,12 @@ class PdfMock
'$dir' => 'ltr',
'$net' => 'Net',
'$to' => '',
'$amount_paid' => '',
'$receipt' => '',
'$ship_to' => '',
'$delivery_note_label' => '',
'$quantity_label' => '',
'$order_number_label' => '',
],
'labels' => $this->vendorLabels(),
];
@ -1286,6 +1313,7 @@ class PdfMock
'$amount_raw_label' => ctrans('texts.amount'),
'$vat_number_label' => ctrans('texts.vat_number'),
'$portal_url_label' => ctrans('texts.link'),
'$reference_label' => ctrans('texts.reference'),
'$po_number_label' => ctrans('texts.po_number'),
'$statement_label' => ctrans('texts.statement'),
'$view_link_label' => ctrans('texts.link'),
@ -1355,6 +1383,12 @@ class PdfMock
'$net_label' => ctrans('texts.net'),
'$dir_label' => '',
'$to_label' => ctrans('texts.to'),
'$amount_paid_label' => ctrans('texts.amount_paid'),
'$receipt_label' => ctrans('texts.receipt'),
'$ship_to_label' => ctrans('texts.ship_to'),
'$delivery_note_label' => ctrans('texts.delivery_note'),
'$quantity_label' => ctrans('texts.quantity'),
'$order_number_label' => ctrans('texts.order_number'),
];
}
}

File diff suppressed because one or more lines are too long

View File

@ -102,6 +102,12 @@ class TemplateService
});
$this->twig->addFunction($function);
$function = new \Twig\TwigFunction('t', function ($string) {
return ctrans("texts.{$string}");
});
$this->twig->addFunction($function);
$filter = new \Twig\TwigFilter('sum', function (?array $array, ?string $column) {
if(!is_array($array)) {
@ -408,6 +414,9 @@ class TemplateService
default => $processed = [],
};
nlog($key);
nlog($processed);
return $processed;
})->toArray();
@ -519,6 +528,7 @@ class TemplateService
'balance' => $invoice->client->balance,
'payment_balance' => $invoice->client->payment_balance,
'credit_balance' => $invoice->client->credit_balance,
'vat_number' => $invoice->client->vat_number ?? '',
],
'payments' => $payments,
'total_tax_map' => $invoice->calc()->getTotalTaxMap(),
@ -643,6 +653,7 @@ class TemplateService
'balance' => $payment->client->balance,
'payment_balance' => $payment->client->payment_balance,
'credit_balance' => $payment->client->credit_balance,
'vat_number' => $payment->client->vat_number ?? '',
],
'paymentables' => $pivot,
'refund_activity' => $this->getPaymentRefundActivity($payment),
@ -719,6 +730,7 @@ class TemplateService
'balance' => $quote->client->balance,
'payment_balance' => $quote->client->payment_balance,
'credit_balance' => $quote->client->credit_balance,
'vat_number' => $quote->client->vat_number ?? '',
],
'status_id' =>$quote->status_id,
'status' => Quote::stringStatus($quote->status_id),
@ -837,6 +849,7 @@ class TemplateService
'balance' => $credit->client->balance,
'payment_balance' => $credit->client->payment_balance,
'credit_balance' => $credit->client->credit_balance,
'vat_number' => $credit->client->vat_number ?? '',
],
'payments' => [],
'total_tax_map' => $credit->calc()->getTotalTaxMap(),
@ -900,6 +913,7 @@ class TemplateService
'balance' => $task->client->balance,
'payment_balance' => $task->client->payment_balance,
'credit_balance' => $task->client->credit_balance,
'vat_number' => $task->client->vat_number ?? '',
] : [],
];
@ -960,6 +974,7 @@ class TemplateService
'balance' => $project->client->balance,
'payment_balance' => $project->client->payment_balance,
'credit_balance' => $project->client->credit_balance,
'vat_number' => $project->client->vat_number ?? '',
] : [],
'user' => $this->userInfo($project->user)
];
@ -979,6 +994,7 @@ class TemplateService
return [
'vendor' => $purchase_order->vendor ? [
'name' => $purchase_order->vendor->present()->name(),
'vat_number' => $purchase_order->vendor->vat_number ?? '',
] : [],
'amount' => (float)$purchase_order->amount,
'balance' => (float)$purchase_order->balance,
@ -987,6 +1003,7 @@ class TemplateService
'balance' => $purchase_order->client->balance,
'payment_balance' => $purchase_order->client->payment_balance,
'credit_balance' => $purchase_order->client->credit_balance,
'vat_number' => $purchase_order->client->vat_number ?? '',
] : [],
'status_id' => (string)($purchase_order->status_id ?: 1),
'status' => PurchaseOrder::stringStatus($purchase_order->status_id ?? 1),
@ -1201,7 +1218,7 @@ class TemplateService
$this->client = $this->entity->client;
$shipping_address = [
['element' => 'p', 'content' => ctrans('texts.shipping_address'), 'properties' => ['data-ref' => 'shipping_address-label', 'style' => 'font-weight: bold; text-transform: uppercase']],
// ['element' => 'p', 'content' => ctrans('texts.shipping_address'), 'properties' => ['data-ref' => 'shipping_address-label', 'style' => 'font-weight: bold; text-transform: uppercase']],
['element' => 'p', 'content' => $this->client->name, 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.name']],
['element' => 'p', 'content' => $this->client->shipping_address1, 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.shipping_address1']],
['element' => 'p', 'content' => $this->client->shipping_address2, 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.shipping_address2']],

View File

@ -131,16 +131,22 @@ class HtmlEngine
// $data['$show_shipping_address_visibility'] = ['value' => $this->settings?->show_shipping_address ? 'visible' : 'hidden', 'label' => ''];
$data['$show_shipping_address_visibility'] = ['value' => $this->settings?->show_shipping_address ? 1 : 0, 'label' => ''];
$data['$order_number'] = ['value' => '', 'label' => ctrans('texts.order_number')];
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')];
$data['$amount_paid'] = ['value' => '', 'label' => ctrans('texts.amount_paid')];
$data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => ''];
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];
$data['$to'] = ['value' => '', 'label' => ctrans('texts.to')];
$data['$ship_to'] = ['value' => '', 'label' => ctrans('texts.ship_to')];
$data['$total_tax_labels'] = ['value' => $this->totalTaxLabels(), 'label' => ctrans('texts.taxes')];
$data['$total_tax_values'] = ['value' => $this->totalTaxValues(), 'label' => ctrans('texts.taxes')];
$data['$line_tax_labels'] = ['value' => $this->lineTaxLabels(), 'label' => ctrans('texts.taxes')];
$data['$line_tax_values'] = ['value' => $this->lineTaxValues(), 'label' => ctrans('texts.taxes')];
$data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->client->date_format(), $this->client->locale()) ?: ' ', 'label' => ctrans('texts.date')];
$data['$status_logo'] = ['value' => ' ', 'label' => ' '];
$data['$delivery_note'] = ['value' => ' ', 'label' => ctrans('texts.delivery_note')];
$data['$receipt'] = ['value' => ' ', 'label' => ctrans('texts.receipt')];
$data['$invoice.date'] = &$data['$date'];
$data['$invoiceDate'] = &$data['$date'];

View File

@ -175,16 +175,28 @@ class PaymentHtmlEngine
$data['$invoices'] = ['value' => $this->formatInvoices(), 'label' => ctrans('texts.invoices')];
$data['$invoice_references'] = ['value' => $this->formatInvoiceReferences(), 'label' => ctrans('texts.invoices')];
$data['$invoice'] = ['value' => $this->formatInvoice(), 'label' => ctrans('texts.invoices')];
$data['$invoice'] = ['value' => $this->formatInvoice(), 'label' => ctrans('texts.invoice')];
$data['$invoice.po_number'] = ['value' => $this->formatPoNumber(), 'label' => ctrans('texts.po_number')];
$data['$poNumber'] = &$data['$invoice.po_number'];
$data['$payment.status'] = ['value' => $this->payment->stringStatus($this->payment->status_id), 'label' => ctrans('texts.payment_status')];
$data['$invoices.amount'] = ['value' => $this->formatInvoiceField('amount'), 'label' => ctrans('texts.invoices')];
$data['$amount_paid'] = ['value' => '', 'label' => ctrans('texts.amount_paid')];
$data['$invoices.balance'] = ['value' => $this->formatInvoiceField('balance'), 'label' => ctrans('texts.invoices')];
$data['$invoices.due_date'] = ['value' => $this->formatInvoiceField('due_date'), 'label' => ctrans('texts.invoices')];
$data['$invoices.po_number'] = ['value' => $this->formatInvoiceField('po_number'), 'label' => ctrans('texts.invoices')];
$data['$date'] = ['value' => '', 'label' => ctrans('texts.date')];
$data['$method'] = ['value' => '', 'label' => ctrans('texts.method')];
$data['$transaction_reference'] = ['value' => '', 'label' => ctrans('texts.transaction_reference')];
$data['$public_notes'] = ['value' => $this->client->public_notes, 'label' => ctrans('texts.public_notes')];
$data['$receipt'] = ['value' => '', 'label' => ctrans('texts.receipt')];
$data['$amount_paid'] = ['value' => '', 'label' => ctrans('texts.amount_paid')];
$data['$refund'] = ['value' => '', 'label' => ctrans('texts.refund')];
$data['$refunded'] = ['value' => '', 'label' => ctrans('texts.refunded')];
$data['$reference'] = ['value' => '', 'label' => ctrans('texts.reference')];
$data['$total'] = ['value' => '', 'label' => ctrans('texts.total')];
$data['$history'] = ['value' => '', 'label' => ctrans('texts.history')];
if ($this->payment->status_id == 4) {
$data['$status_logo'] = ['value' => '<div class="stamp is-paid"> ' . ctrans('texts.paid') .'</div>', 'label' => ''];
} else {

View File

@ -5216,7 +5216,8 @@ $LANG = [
'activity_139' => 'Expense :expense notification sent to :contact',
'vendor_notification_subject' => 'Confirmation of payment :amount sent to :vendor',
'vendor_notification_body' => 'Payment processed for :amount dated :payment_date. <br>[Transaction Reference: :transaction_reference]',
'receipt' => 'Receipt',
'charges' => 'Charges',
];
return $LANG;