mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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(
|
$data = array(
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
'invoice' => $invoice->hidePrivateFields(),
|
'invoice' => $invoice->hidePrivateFields(),
|
||||||
'invitation' => $invitation
|
'invitation' => $invitation,
|
||||||
|
'invoiceLabels' => $client->account->getInvoiceLabels(),
|
||||||
);
|
);
|
||||||
|
|
||||||
return View::make('invoices.view', $data);
|
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']),
|
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||||
'invoiceDesigns' => InvoiceDesign::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(
|
'frequencies' => array(
|
||||||
1 => 'Weekly',
|
1 => 'Weekly',
|
||||||
2 => 'Two weeks',
|
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_DATETIME_FORMAT, $this->datetime_format ? $this->datetime_format->format : DEFAULT_DATETIME_FORMAT);
|
||||||
Session::put(SESSION_CURRENCY, $this->currency_id ? $this->currency_id : DEFAULT_CURRENCY);
|
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;
|
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()
|
public function showGreyBackground()
|
||||||
{
|
{
|
||||||
return !$this->theme_id || in_array($this->theme_id, [2, 3, 5, 6, 7, 8, 10, 11, 12]);
|
return !$this->theme_id || in_array($this->theme_id, [2, 3, 5, 6, 7, 8, 10, 11, 12]);
|
||||||
|
@ -29,6 +29,19 @@
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
window.invoice = {{ $invoice->toJson() }};
|
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()))
|
@if (file_exists($invoice->client->account->getLogoPath()))
|
||||||
invoice.image = "{{ HTML::image_data($invoice->client->account->getLogoPath()) }}";
|
invoice.image = "{{ HTML::image_data($invoice->client->account->getLogoPath()) }}";
|
||||||
invoice.imageWidth = {{ $invoice->client->account->getLogoWidth() }};
|
invoice.imageWidth = {{ $invoice->client->account->getLogoWidth() }};
|
||||||
@ -60,6 +73,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var invoiceLabels = {{ json_encode($invoiceLabels) }};
|
||||||
|
|
||||||
function onDownloadClick() {
|
function onDownloadClick() {
|
||||||
var doc = generatePDF(invoice);
|
var doc = generatePDF(invoice);
|
||||||
doc.save('Invoice-' + invoice.invoice_number + '.pdf');
|
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);
|
doc.text(marginLeft, y, value);
|
||||||
|
|
||||||
|
/*
|
||||||
if (rightAlignTitleX && i === 0) {
|
if (rightAlignTitleX && i === 0) {
|
||||||
doc.setFontType('bold');
|
doc.setFontType('bold');
|
||||||
} else {
|
} else {
|
||||||
doc.setFontType('normal');
|
doc.setFontType('normal');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
doc.setFontType('normal');
|
||||||
|
|
||||||
key = invoiceLabels[key];
|
key = invoiceLabels[key];
|
||||||
if (rightAlignTitleX) {
|
if (rightAlignTitleX) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user