mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Working on multi-language support
This commit is contained in:
parent
58f6c0ff97
commit
6e532063fd
@ -143,7 +143,8 @@ class InvoiceController extends \BaseController {
|
||||
$data = array(
|
||||
'showBreadcrumbs' => false,
|
||||
'invoice' => $invoice->hidePrivateFields(),
|
||||
'invitation' => $invitation
|
||||
'invitation' => $invitation,
|
||||
'invoiceLabels' => $client->account->getInvoiceLabels(),
|
||||
);
|
||||
|
||||
return View::make('invoices.view', $data);
|
||||
@ -223,7 +224,7 @@ class InvoiceController extends \BaseController {
|
||||
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'invoiceLabels' => Auth::user()->getInvoiceLabels(),
|
||||
'invoiceLabels' => Auth::user()->account->getInvoiceLabels(),
|
||||
'frequencies' => array(
|
||||
1 => 'Weekly',
|
||||
2 => 'Two weeks',
|
||||
|
@ -168,4 +168,37 @@ class Account extends Eloquent
|
||||
Session::put(SESSION_DATETIME_FORMAT, $this->datetime_format ? $this->datetime_format->format : DEFAULT_DATETIME_FORMAT);
|
||||
Session::put(SESSION_CURRENCY, $this->currency_id ? $this->currency_id : DEFAULT_CURRENCY);
|
||||
}
|
||||
|
||||
public function getInvoiceLabels()
|
||||
{
|
||||
$data = [];
|
||||
$fields = [
|
||||
'invoice',
|
||||
'invoice_date',
|
||||
'due_date',
|
||||
'invoice_number',
|
||||
'po_number',
|
||||
'dicount',
|
||||
'taxes',
|
||||
'tax',
|
||||
'item',
|
||||
'description',
|
||||
'unit_cost',
|
||||
'quantity',
|
||||
'line_total',
|
||||
'subtotal',
|
||||
'paid_to_date',
|
||||
'balance_due',
|
||||
'terms',
|
||||
'your_invoice',
|
||||
];
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$data[$field] = trans("fields.$field");
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
@ -110,38 +110,6 @@ class User extends ConfideUser implements UserInterface, RemindableInterface
|
||||
return $language->locale;
|
||||
}
|
||||
|
||||
public function getInvoiceLabels()
|
||||
{
|
||||
$data = [];
|
||||
$fields = [
|
||||
'invoice',
|
||||
'invoice_date',
|
||||
'due_date',
|
||||
'invoice_number',
|
||||
'po_number',
|
||||
'dicount',
|
||||
'taxes',
|
||||
'tax',
|
||||
'item',
|
||||
'description',
|
||||
'unit_cost',
|
||||
'quantity',
|
||||
'line_total',
|
||||
'subtotal',
|
||||
'paid_to_date',
|
||||
'balance_due',
|
||||
'terms',
|
||||
'your_invoice',
|
||||
];
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$data[$field] = trans("fields.$field");
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function showGreyBackground()
|
||||
{
|
||||
return !$this->theme_id || in_array($this->theme_id, [2, 3, 5, 6, 7, 8, 10, 11, 12]);
|
||||
|
@ -29,6 +29,19 @@
|
||||
|
||||
$(function() {
|
||||
window.invoice = {{ $invoice->toJson() }};
|
||||
|
||||
invoice.imageLogo1 = "{{ HTML::image_data('images/report_logo1.jpg') }}";
|
||||
invoice.imageLogoWidth1 =120;
|
||||
invoice.imageLogoHeight1 = 40
|
||||
|
||||
invoice.imageLogo2 = "{{ HTML::image_data('images/report_logo2.jpg') }}";
|
||||
invoice.imageLogoWidth2 =325/2;
|
||||
invoice.imageLogoHeight2 = 81/2;
|
||||
|
||||
invoice.imageLogo3 = "{{ HTML::image_data('images/report_logo3.jpg') }}";
|
||||
invoice.imageLogoWidth3 =325/2;
|
||||
invoice.imageLogoHeight3 = 81/2;
|
||||
|
||||
@if (file_exists($invoice->client->account->getLogoPath()))
|
||||
invoice.image = "{{ HTML::image_data($invoice->client->account->getLogoPath()) }}";
|
||||
invoice.imageWidth = {{ $invoice->client->account->getLogoWidth() }};
|
||||
@ -60,6 +73,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
var invoiceLabels = {{ json_encode($invoiceLabels) }};
|
||||
|
||||
function onDownloadClick() {
|
||||
var doc = generatePDF(invoice);
|
||||
doc.save('Invoice-' + invoice.invoice_number + '.pdf');
|
||||
|
@ -1390,11 +1390,15 @@ function displayGrid(doc, invoice, data, x, y, layout, hasheader, rightAlignX, r
|
||||
}
|
||||
doc.text(marginLeft, y, value);
|
||||
|
||||
/*
|
||||
if (rightAlignTitleX && i === 0) {
|
||||
doc.setFontType('bold');
|
||||
} else {
|
||||
doc.setFontType('normal');
|
||||
}
|
||||
*/
|
||||
|
||||
doc.setFontType('normal');
|
||||
|
||||
key = invoiceLabels[key];
|
||||
if (rightAlignTitleX) {
|
||||
|
Loading…
Reference in New Issue
Block a user