diff --git a/app/Console/Commands/SendRecurringInvoices.php b/app/Console/Commands/SendRecurringInvoices.php index 8f31473c9eca..6acd87aa0c6e 100644 --- a/app/Console/Commands/SendRecurringInvoices.php +++ b/app/Console/Commands/SendRecurringInvoices.php @@ -39,8 +39,12 @@ class SendRecurringInvoices extends Command foreach ($invoices as $recurInvoice) { $this->info('Processing Invoice '.$recurInvoice->id.' - Should send '.($recurInvoice->shouldSendToday() ? 'YES' : 'NO')); - $this->invoiceRepo->createRecurringInvoice($recurInvoice); - $this->mailer->sendInvoice($invoice); + $invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice); + + if ($invoice) { + $recurInvoice->account->loadLocalizationSettings(); + $this->mailer->sendInvoice($invoice); + } } $this->info('Done'); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index efed3effd150..6426333f1d5b 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -214,6 +214,8 @@ class InvoiceController extends BaseController if ($invoice->invoice_design_id == CUSTOM_DESIGN) { $invoice->invoice_design->javascript = $account->custom_design; + } elseif ($account->utf8_invoices) { + $invoice->invoice_design->javascript = $invoice->invoice_design->pdfmake; } $contact = $invitation->contact; @@ -253,7 +255,7 @@ class InvoiceController extends BaseController 'invoiceLabels' => $account->getInvoiceLabels(), 'contact' => $contact, 'paymentTypes' => $paymentTypes, - 'paymentURL' => $paymentURL + 'paymentURL' => $paymentURL, ); return View::make('invoices.view', $data); diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index da37c9eb9bec..dfd7a96470b3 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -20,7 +20,9 @@ class ReportController extends BaseController $fileName = storage_path() . '/dataviz_sample.txt'; if (Auth::user()->account->isPro()) { - $account = Account::where('id', '=', Auth::user()->account->id)->with(['clients.invoices.invoice_items', 'clients.contacts'])->first(); + $account = Account::where('id', '=', Auth::user()->account->id) + ->with(['clients.invoices.invoice_items', 'clients.contacts']) + ->first(); $account = $account->hideFieldsForViz(); $clients = $account->clients->toJson(); } elseif (file_exists($fileName)) { diff --git a/app/Http/routes.php b/app/Http/routes.php index 7c158a314490..f7c829070f3a 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -326,6 +326,7 @@ define('SESSION_LAST_REQUEST_TIME', 'SESSION_LAST_REQUEST_TIME'); define('DEFAULT_TIMEZONE', 'US/Eastern'); define('DEFAULT_CURRENCY', 1); // US Dollar +define('DEFAULT_LANGUAGE', 1); // English define('DEFAULT_DATE_FORMAT', 'M j, Y'); define('DEFAULT_DATE_PICKER_FORMAT', 'M d, yyyy'); define('DEFAULT_DATETIME_FORMAT', 'F j, Y, g:i a'); diff --git a/app/Models/Account.php b/app/Models/Account.php index ee88e2fd1fcb..243715ceaadd 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -4,7 +4,7 @@ use Eloquent; use Utils; use Session; use DateTime; - +use App; use Illuminate\Database\Eloquent\SoftDeletes; class Account extends Eloquent @@ -92,6 +92,11 @@ class Account extends Eloquent } } + public function isEnglish() + { + return !$this->language_id || $this->language_id == DEFAULT_LANGUAGE; + } + public function getDisplayName() { if ($this->name) { @@ -229,6 +234,8 @@ 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); Session::put(SESSION_LOCALE, $this->language_id ? $this->language->locale : DEFAULT_LOCALE); + + App::setLocale(session(SESSION_LOCALE)); } public function getInvoiceLabels() @@ -277,7 +284,7 @@ class Account extends Eloquent if (isset($custom[$field]) && $custom[$field]) { $data[$field] = $custom[$field]; } else { - $data[$field] = uctrans("texts.$field"); + $data[$field] = $this->isEnglish() ? uctrans("texts.$field") : trans("texts.$field"); } } @@ -348,6 +355,8 @@ class Account extends Eloquent 'invoice_status_id', 'invoice_items', 'created_at', + 'is_recurring', + 'is_quote', ]); foreach ($invoice->invoice_items as $invoiceItem) { diff --git a/app/Ninja/Repositories/TaskRepository.php b/app/Ninja/Repositories/TaskRepository.php index 4504e78fb7fa..47761900e1e6 100644 --- a/app/Ninja/Repositories/TaskRepository.php +++ b/app/Ninja/Repositories/TaskRepository.php @@ -46,7 +46,7 @@ class TaskRepository } public function save($publicId, $data) - { + { if ($publicId) { $task = Task::scope($publicId)->firstOrFail(); } else { @@ -60,8 +60,14 @@ class TaskRepository $task->description = trim($data['description']); } - //$timeLog = $task->time_log ? json_decode($task->time_log, true) : []; - $timeLog = isset($data['time_log']) ? json_decode($data['time_log']) : []; + if (isset($data['time_log'])) { + $timeLog = json_decode($data['time_log']); + } elseif ($task->time_log) { + $timeLog = json_decode($task->time_log); + } else { + $timeLog = []; + } + if ($data['action'] == 'start') { $task->is_running = true; $timeLog[] = [strtotime('now'), false]; diff --git a/resources/views/accounts/email_templates.blade.php b/resources/views/accounts/email_templates.blade.php index ab30b19016db..4e29172b6dc7 100644 --- a/resources/views/accounts/email_templates.blade.php +++ b/resources/views/accounts/email_templates.blade.php @@ -108,7 +108,7 @@ } keys = ['footer', 'account', 'client', 'amount', 'link', 'contact']; - vals = [{!! json_encode($emailFooter) !!}, '{!! Auth::user()->account->getDisplayName() !!}', 'Client Name', formatMoney(100), '{!! NINJA_WEB_URL !!}', 'Contact Name']; + vals = [{!! json_encode($emailFooter) !!}, '{!! Auth::user()->account->getDisplayName() !!}', 'Client Name', formatMoney(100), '{!! SITE_URL . '/view/...' !!}', 'Contact Name']; // Add any available payment method links @foreach (\App\Models\Gateway::getPaymentTypeLinks() as $type) diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 6925992c315f..14ba1419e094 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -253,12 +253,12 @@ }, 2000); $('#search').blur(function(){ - $('#search').css('width', '{{ Utils::isEnglish() ? 150 : 100 }}px'); + $('#search').css('width', '{{ Utils::isEnglish() ? 150 : 110 }}px'); $('ul.navbar-right').show(); }); $('#search').focus(function(){ - $('#search').css('width', '{{ Utils::isEnglish() ? 256 : 206 }}px'); + $('#search').css('width', '{{ Utils::isEnglish() ? 256 : 216 }}px'); $('ul.navbar-right').hide(); if (!window.hasOwnProperty('searchData')) { $.get('{{ URL::route('getSearchData') }}', function(data) { @@ -460,7 +460,7 @@
diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index 109085992d2a..35c889e7eddf 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -57,7 +57,7 @@