1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

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) {
$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');

View File

@ -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);

View File

@ -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)) {

View File

@ -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');

View File

@ -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) {

View File

@ -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];

View File

@ -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)

View File

@ -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 @@
<form class="navbar-form navbar-right" role="search">
<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') }}">
</div>
</form>

View File

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

View File

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

View File

@ -75,7 +75,7 @@
// remove quotes and recurring invoices
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'));

View File

@ -4,10 +4,9 @@
<style type="text/css">
.time-input input,
.time-input select {
float: left;
input.time-input {
width: 110px;
font-size: 14px !important;
}
</style>
@ -79,13 +78,13 @@
<td style="padding: 0px 12px 12px 0 !important">
<div data-bind="css: { 'has-error': !isStartValid() }">
<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>
</td>
<td style="padding: 0px 12px 12px 0 !important">
<div data-bind="css: { 'has-error': !isEndValid() }">
<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>
</td>
<td style="width:100px">
@ -202,9 +201,6 @@
}
function TimeModel(data) {
console.log('== TimeModel ==');
console.log(data);
var self = this;
self.startTime = ko.observable(0);
self.endTime = ko.observable(0);