bug fixes

This commit is contained in:
Hillel Coren 2014-01-06 08:48:11 +02:00
parent c517dc07fc
commit 94a9c42369
12 changed files with 40 additions and 17 deletions

0
app/config/gae-development/database.php Executable file → Normal file
View File

0
app/config/gae-production/cache.php Executable file → Normal file
View File

0
app/config/gae-production/database.php Executable file → Normal file
View File

0
app/config/gae-production/session.php Executable file → Normal file
View File

View File

@ -150,7 +150,7 @@ class InvoiceController extends \BaseController {
$client->save(); $client->save();
Activity::viewInvoice($invitation); Activity::viewInvoice($invitation);
$data = array( $data = array(
'invoice' => $invoice->hidePrivateFields(), 'invoice' => $invoice->hidePrivateFields(),
'invitation' => $invitation 'invitation' => $invitation
@ -300,12 +300,7 @@ class InvoiceController extends \BaseController {
{ {
$invoice = Invoice::scope($publicId)->with('account.country', 'client.contacts', 'invoice_items')->firstOrFail(); $invoice = Invoice::scope($publicId)->with('account.country', 'client.contacts', 'invoice_items')->firstOrFail();
Utils::trackViewed($invoice->invoice_number . ' - ' . $invoice->client->getDisplayName(), ENTITY_INVOICE); Utils::trackViewed($invoice->invoice_number . ' - ' . $invoice->client->getDisplayName(), ENTITY_INVOICE);
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
$invoice->start_date = Utils::fromSqlDate($invoice->start_date);
$invoice->end_date = Utils::fromSqlDate($invoice->end_date);
$contactIds = DB::table('invitations') $contactIds = DB::table('invitations')
->join('contacts', 'contacts.id', '=','invitations.contact_id') ->join('contacts', 'contacts.id', '=','invitations.contact_id')
->where('invitations.invoice_id', '=', $invoice->id) ->where('invitations.invoice_id', '=', $invoice->id)
@ -453,6 +448,7 @@ class InvoiceController extends \BaseController {
{ {
$message = ' and created client'; $message = ' and created client';
$url = URL::to('clients/' . $client->public_id); $url = URL::to('clients/' . $client->public_id);
Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT, $url); Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT, $url);
} }

View File

@ -60,8 +60,8 @@ class Client extends EntityModel
} }
$contact = $this->contacts()->first(); $contact = $this->contacts()->first();
return $contact->getFullName(); return $contact->getDisplayName();
} }
public function getEntityType() public function getEntityType()

View File

@ -37,6 +37,26 @@ class Invoice extends EntityModel
return ENTITY_INVOICE; return ENTITY_INVOICE;
} }
public function getInvoiceDateAttribute($value)
{
return Utils::fromSqlDate($value);
}
public function getDueDateAttribute($value)
{
return Utils::fromSqlDate($value);
}
public function getStartDateAttribute($value)
{
return Utils::fromSqlDate($value);
}
public function getEndDateAttribute($value)
{
return Utils::fromSqlDate($value);
}
public function isSent() public function isSent()
{ {
return $this->invoice_status_id >= INVOICE_STATUS_SENT; return $this->invoice_status_id >= INVOICE_STATUS_SENT;

View File

@ -12,13 +12,14 @@ class ContactMailer extends Mailer {
public function sendInvoice(Invoice $invoice) public function sendInvoice(Invoice $invoice)
{ {
$view = 'invoice'; $view = 'invoice';
$data = array('link' => URL::to('view') . '/' . $invoice->invoice_key);
$subject = ''; $subject = '';
foreach ($invoice->invitations as $invitation) foreach ($invoice->invitations as $invitation)
{ {
//$invitation->date_sent = $invitation->sent_date = Carbon::now()->toDateTimeString();
$invitation->save(); $invitation->save();
$data = array('link' => URL::to('view') . '/' . $invitation->invitation_key);
$this->sendTo($invitation->contact->email, $subject, $view, $data); $this->sendTo($invitation->contact->email, $subject, $view, $data);

View File

@ -2,7 +2,7 @@
@section('onReady') @section('onReady')
$('input#first_name').focus(); $('input#name').focus();
@stop @stop
@section('content') @section('content')

View File

@ -383,7 +383,7 @@
@if (Session::has('message')) @if (Session::has('message'))
setTimeout(function() { setTimeout(function() {
$('.alert-info').fadeOut(); $('.alert-info').fadeOut();
}, 5000); }, 3000);
@endif @endif
@yield('onReady') @yield('onReady')

View File

@ -86,7 +86,7 @@
<div class="form-group" style="margin-bottom: 8px"> <div class="form-group" style="margin-bottom: 8px">
<label for="recurring" class="control-label col-lg-4 col-sm-4">Taxes</label> <label for="recurring" class="control-label col-lg-4 col-sm-4">Taxes</label>
<div class="col-lg-8 col-sm-8" style="padding-top: 7px"> <div class="col-lg-8 col-sm-8" style="padding-top: 7px">
<a href="#" data-bind="click: $root.showTaxesForm">Manage tax rates</a> <a href="#" data-bind="click: $root.showTaxesForm">Manage rates</a>
</div> </div>
</div> </div>
@ -347,9 +347,11 @@
{{ Former::checkbox('invoice_taxes')->text('Enable specifying an <b>invoice tax</b>') {{ Former::checkbox('invoice_taxes')->text('Enable specifying an <b>invoice tax</b>')
->label('Settings')->data_bind('checked: $root.invoice_taxes, enable: $root.tax_rates().length > 1') }} ->label('Settings')->data_bind('checked: $root.invoice_taxes, enable: $root.tax_rates().length > 1') }}
{{ Former::checkbox('invoice_item_taxes')->text('Enable specifying <b>line item taxes</b>') {{ Former::checkbox('invoice_item_taxes')->text('Enable specifying <b>line item taxes</b>')->addOnGroupClass('no-space-bottom')
->label('&nbsp;')->data_bind('checked: $root.invoice_item_taxes, enable: $root.tax_rates().length > 1') }} ->label('&nbsp;')->data_bind('checked: $root.invoice_item_taxes, enable: $root.tax_rates().length > 1') }}
<br/>
</div> </div>
<div class="modal-footer" style="margin-top: 0px"> <div class="modal-footer" style="margin-top: 0px">
@ -408,7 +410,7 @@
@endif @endif
$('#clientModal').on('shown.bs.modal', function () { $('#clientModal').on('shown.bs.modal', function () {
$('#email').focus(); $('#name').focus();
}).on('hidden.bs.modal', function () { }).on('hidden.bs.modal', function () {
if (model.clientBackup) { if (model.clientBackup) {
model.loadClient(model.clientBackup); model.loadClient(model.clientBackup);
@ -765,7 +767,6 @@
self.enable = {}; self.enable = {};
self.enable.save = ko.computed(function() { self.enable.save = ko.computed(function() {
var isValid = false; var isValid = false;
for (var i=0; i<self.invoice().client().contacts().length; i++) { for (var i=0; i<self.invoice().client().contacts().length; i++) {
var contact = self.invoice().client().contacts()[i]; var contact = self.invoice().client().contacts()[i];
if (isValidEmailAddress(contact.email())) { if (isValidEmailAddress(contact.email())) {
@ -775,6 +776,7 @@
break; break;
} }
} }
return isValid ? "enabled" : "disabled"; return isValid ? "enabled" : "disabled";
}); });

View File

@ -21,6 +21,10 @@ div.panel {
text-align: center; text-align: center;
} }
.no-space-bottom {
padding-bottom: 0px !important;
margin-bottom: 0px !important;
}
/* DataTables and BootStrap */ /* DataTables and BootStrap */
.dataTables_wrapper { .dataTables_wrapper {