Bug fixes

This commit is contained in:
Hillel Coren 2015-08-11 17:38:36 +03:00
parent 78bf49cd19
commit 0e15c12298
12 changed files with 53 additions and 26 deletions

View File

@ -39,8 +39,12 @@ class SendRecurringInvoices extends Command
foreach ($invoices as $recurInvoice) { foreach ($invoices as $recurInvoice) {
$this->info('Processing Invoice '.$recurInvoice->id.' - Should send '.($recurInvoice->shouldSendToday() ? 'YES' : 'NO')); $this->info('Processing Invoice '.$recurInvoice->id.' - Should send '.($recurInvoice->shouldSendToday() ? 'YES' : 'NO'));
$this->invoiceRepo->createRecurringInvoice($recurInvoice); $invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
$this->mailer->sendInvoice($invoice);
if ($invoice) {
$recurInvoice->account->loadLocalizationSettings();
$this->mailer->sendInvoice($invoice);
}
} }
$this->info('Done'); $this->info('Done');

View File

@ -214,6 +214,8 @@ class InvoiceController extends BaseController
if ($invoice->invoice_design_id == CUSTOM_DESIGN) { if ($invoice->invoice_design_id == CUSTOM_DESIGN) {
$invoice->invoice_design->javascript = $account->custom_design; $invoice->invoice_design->javascript = $account->custom_design;
} elseif ($account->utf8_invoices) {
$invoice->invoice_design->javascript = $invoice->invoice_design->pdfmake;
} }
$contact = $invitation->contact; $contact = $invitation->contact;
@ -253,7 +255,7 @@ class InvoiceController extends BaseController
'invoiceLabels' => $account->getInvoiceLabels(), 'invoiceLabels' => $account->getInvoiceLabels(),
'contact' => $contact, 'contact' => $contact,
'paymentTypes' => $paymentTypes, 'paymentTypes' => $paymentTypes,
'paymentURL' => $paymentURL 'paymentURL' => $paymentURL,
); );
return View::make('invoices.view', $data); return View::make('invoices.view', $data);

View File

@ -20,7 +20,9 @@ class ReportController extends BaseController
$fileName = storage_path() . '/dataviz_sample.txt'; $fileName = storage_path() . '/dataviz_sample.txt';
if (Auth::user()->account->isPro()) { 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(); $account = $account->hideFieldsForViz();
$clients = $account->clients->toJson(); $clients = $account->clients->toJson();
} elseif (file_exists($fileName)) { } elseif (file_exists($fileName)) {

View File

@ -326,6 +326,7 @@ define('SESSION_LAST_REQUEST_TIME', 'SESSION_LAST_REQUEST_TIME');
define('DEFAULT_TIMEZONE', 'US/Eastern'); define('DEFAULT_TIMEZONE', 'US/Eastern');
define('DEFAULT_CURRENCY', 1); // US Dollar define('DEFAULT_CURRENCY', 1); // US Dollar
define('DEFAULT_LANGUAGE', 1); // English
define('DEFAULT_DATE_FORMAT', 'M j, Y'); define('DEFAULT_DATE_FORMAT', 'M j, Y');
define('DEFAULT_DATE_PICKER_FORMAT', 'M d, yyyy'); define('DEFAULT_DATE_PICKER_FORMAT', 'M d, yyyy');
define('DEFAULT_DATETIME_FORMAT', 'F j, Y, g:i a'); define('DEFAULT_DATETIME_FORMAT', 'F j, Y, g:i a');

View File

@ -4,7 +4,7 @@ use Eloquent;
use Utils; use Utils;
use Session; use Session;
use DateTime; use DateTime;
use App;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
class Account extends Eloquent 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() public function getDisplayName()
{ {
if ($this->name) { 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_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);
Session::put(SESSION_LOCALE, $this->language_id ? $this->language->locale : DEFAULT_LOCALE); Session::put(SESSION_LOCALE, $this->language_id ? $this->language->locale : DEFAULT_LOCALE);
App::setLocale(session(SESSION_LOCALE));
} }
public function getInvoiceLabels() public function getInvoiceLabels()
@ -277,7 +284,7 @@ class Account extends Eloquent
if (isset($custom[$field]) && $custom[$field]) { if (isset($custom[$field]) && $custom[$field]) {
$data[$field] = $custom[$field]; $data[$field] = $custom[$field];
} else { } 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_status_id',
'invoice_items', 'invoice_items',
'created_at', 'created_at',
'is_recurring',
'is_quote',
]); ]);
foreach ($invoice->invoice_items as $invoiceItem) { foreach ($invoice->invoice_items as $invoiceItem) {

View File

@ -46,7 +46,7 @@ class TaskRepository
} }
public function save($publicId, $data) public function save($publicId, $data)
{ {
if ($publicId) { if ($publicId) {
$task = Task::scope($publicId)->firstOrFail(); $task = Task::scope($publicId)->firstOrFail();
} else { } else {
@ -60,8 +60,14 @@ class TaskRepository
$task->description = trim($data['description']); $task->description = trim($data['description']);
} }
//$timeLog = $task->time_log ? json_decode($task->time_log, true) : []; if (isset($data['time_log'])) {
$timeLog = isset($data['time_log']) ? json_decode($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') { if ($data['action'] == 'start') {
$task->is_running = true; $task->is_running = true;
$timeLog[] = [strtotime('now'), false]; $timeLog[] = [strtotime('now'), false];

View File

@ -108,7 +108,7 @@
} }
keys = ['footer', 'account', 'client', 'amount', 'link', 'contact']; 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 // Add any available payment method links
@foreach (\App\Models\Gateway::getPaymentTypeLinks() as $type) @foreach (\App\Models\Gateway::getPaymentTypeLinks() as $type)

View File

@ -253,12 +253,12 @@
}, 2000); }, 2000);
$('#search').blur(function(){ $('#search').blur(function(){
$('#search').css('width', '{{ Utils::isEnglish() ? 150 : 100 }}px'); $('#search').css('width', '{{ Utils::isEnglish() ? 150 : 110 }}px');
$('ul.navbar-right').show(); $('ul.navbar-right').show();
}); });
$('#search').focus(function(){ $('#search').focus(function(){
$('#search').css('width', '{{ Utils::isEnglish() ? 256 : 206 }}px'); $('#search').css('width', '{{ Utils::isEnglish() ? 256 : 216 }}px');
$('ul.navbar-right').hide(); $('ul.navbar-right').hide();
if (!window.hasOwnProperty('searchData')) { if (!window.hasOwnProperty('searchData')) {
$.get('{{ URL::route('getSearchData') }}', function(data) { $.get('{{ URL::route('getSearchData') }}', function(data) {
@ -460,7 +460,7 @@
<form class="navbar-form navbar-right" role="search"> <form class="navbar-form navbar-right" role="search">
<div class="form-group"> <div class="form-group">
<input type="text" id="search" style="width: {{ Utils::isEnglish() ? 150 : 100 }}px" <input type="text" id="search" style="width: {{ Utils::isEnglish() ? 150 : 110 }}px"
class="form-control" placeholder="{{ trans('texts.search') }}"> class="form-control" placeholder="{{ trans('texts.search') }}">
</div> </div>
</form> </form>

View File

@ -57,7 +57,7 @@
<div class="form-group" style="margin-bottom: 8px"> <div class="form-group" style="margin-bottom: 8px">
<div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4"> <div class="col-lg-8 col-sm-8 col-lg-offset-4 col-sm-offset-4">
<a id="createClientLink" class="pointer" data-bind="click: $root.showClientForm, text: $root.clientLinkText"></a> <a id="createClientLink" class="pointer" data-bind="click: $root.showClientForm, html: $root.clientLinkText"></a>
<span data-bind="visible: $root.invoice().client().public_id() > 0">| <span data-bind="visible: $root.invoice().client().public_id() > 0">|
<a data-bind="attr: {href: '{{ url('/clients') }}/' + $root.invoice().client().public_id()}" target="_blank">{{ trans('texts.view_client') }}</a> <a data-bind="attr: {href: '{{ url('/clients') }}/' + $root.invoice().client().public_id()}" target="_blank">{{ trans('texts.view_client') }}</a>
</span> </span>
@ -673,9 +673,15 @@
var product = products[i]; var product = products[i];
if (product.product_key == key) { if (product.product_key == key) {
var model = ko.dataFor(this); var model = ko.dataFor(this);
model.notes(product.notes); if (!model.notes()) {
model.cost(accounting.toFixed(product.cost,2)); model.notes(product.notes);
model.qty(1); }
if (!model.cost()) {
model.cost(accounting.toFixed(product.cost,2));
}
if (!model.qty()) {
model.qty(1);
}
break; break;
} }
} }

View File

@ -74,6 +74,7 @@
var NINJA = NINJA || {}; var NINJA = NINJA || {};
NINJA.primaryColor = "{{ $account->primary_color }}"; NINJA.primaryColor = "{{ $account->primary_color }}";
NINJA.secondaryColor = "{{ $account->secondary_color }}"; NINJA.secondaryColor = "{{ $account->secondary_color }}";
NINJA.fontSize = {{ $account->font_size }};
var invoiceLabels = {!! json_encode($account->getInvoiceLabels()) !!}; var invoiceLabels = {!! json_encode($account->getInvoiceLabels()) !!};

View File

@ -75,7 +75,7 @@
// remove quotes and recurring invoices // remove quotes and recurring invoices
invoices = _.filter(invoices, function(invoice) { invoices = _.filter(invoices, function(invoice) {
return !parseInt(invoice.is_quote) && !parseInt(invoice.is_recurring); return !parseInt(invoice.is_quote) && !invoice.is_recurring;
}); });
var products = _.flatten(_.pluck(invoices, 'invoice_items')); var products = _.flatten(_.pluck(invoices, 'invoice_items'));

View File

@ -4,10 +4,9 @@
<style type="text/css"> <style type="text/css">
.time-input input, input.time-input {
.time-input select {
float: left;
width: 110px; width: 110px;
font-size: 14px !important;
} }
</style> </style>
@ -79,13 +78,13 @@
<td style="padding: 0px 12px 12px 0 !important"> <td style="padding: 0px 12px 12px 0 !important">
<div data-bind="css: { 'has-error': !isStartValid() }"> <div data-bind="css: { 'has-error': !isStartValid() }">
<input type="text" data-bind="value: startTime.pretty, event:{ change: $root.refresh }" <input type="text" data-bind="value: startTime.pretty, event:{ change: $root.refresh }"
class="form-control" placeholder="{{ trans('texts.start_time') }}"/> class="form-control time-input" placeholder="{{ trans('texts.start_time') }}"/>
</div> </div>
</td> </td>
<td style="padding: 0px 12px 12px 0 !important"> <td style="padding: 0px 12px 12px 0 !important">
<div data-bind="css: { 'has-error': !isEndValid() }"> <div data-bind="css: { 'has-error': !isEndValid() }">
<input type="text" data-bind="value: endTime.pretty, event:{ change: $root.refresh }" <input type="text" data-bind="value: endTime.pretty, event:{ change: $root.refresh }"
class="form-control" placeholder="{{ trans('texts.end_time') }}"/> class="form-control time-input" placeholder="{{ trans('texts.end_time') }}"/>
</div> </div>
</td> </td>
<td style="width:100px"> <td style="width:100px">
@ -202,9 +201,6 @@
} }
function TimeModel(data) { function TimeModel(data) {
console.log('== TimeModel ==');
console.log(data);
var self = this; var self = this;
self.startTime = ko.observable(0); self.startTime = ko.observable(0);
self.endTime = ko.observable(0); self.endTime = ko.observable(0);