diff --git a/app/controllers/ClientController.php b/app/controllers/ClientController.php index 0c08c2a4a304..501283f03aae 100755 --- a/app/controllers/ClientController.php +++ b/app/controllers/ClientController.php @@ -15,7 +15,7 @@ class ClientController extends \BaseController { return View::make('list', array( 'entityType'=>ENTITY_CLIENT, 'title' => '- Clients', - 'columns'=>['checkbox', 'Client', 'Contact', 'Email', 'Date Created', 'Phone', 'Last Login', 'Balance', 'Action'] + 'columns'=>['checkbox', 'Client', 'Contact', 'Email', 'Date Created', 'Last Login', 'Balance', 'Action'] )); } @@ -49,7 +49,6 @@ class ClientController extends \BaseController { ->addColumn('first_name', function($model) { return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name); }) ->addColumn('email', function($model) { return link_to('clients/' . $model->public_id, $model->email); }) ->addColumn('created_at', function($model) { return Utils::timestampToDateString(strtotime($model->created_at)); }) - ->addColumn('work_phone', function($model) { return Utils::formatPhoneNumber($model->work_phone); }) ->addColumn('last_login', function($model) { return Utils::timestampToDateString($model->last_login); }) ->addColumn('balance', function($model) { return Utils::formatMoney($model->balance, $model->currency_id); }) ->addColumn('dropdown', function($model) diff --git a/app/database/seeds/ConstantsSeeder.php b/app/database/seeds/ConstantsSeeder.php index 2fcbf56802a0..d8b91e765d18 100755 --- a/app/database/seeds/ConstantsSeeder.php +++ b/app/database/seeds/ConstantsSeeder.php @@ -79,9 +79,19 @@ class ConstantsSeeder extends Seeder Currency::create(array('name' => 'US Dollar', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Pound Sterling', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); - DatetimeFormat::create(array('format' => 'F j, Y, g:i a', 'label' => 'March 10, 2013, 6:15 pm')); - DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013, 6:15 pm')); + DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013')); + DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013')); + DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013')); + DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013')); + DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm')); + DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm')); + DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm')); + DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013')); + DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013')); + DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013')); + DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013')); + DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013')); DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013')); DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013')); diff --git a/app/models/Activity.php b/app/models/Activity.php index eb44c23cee34..10be81338ad2 100755 --- a/app/models/Activity.php +++ b/app/models/Activity.php @@ -119,7 +119,7 @@ class Activity extends Eloquent $activity->invoice_id = $invitation->invoice_id; $activity->contact_id = $invitation->contact_id; $activity->activity_type_id = ACTIVITY_TYPE_EMAIL_INVOICE; - $activity->message = $userName . ' emailed invoice ' . link_to('invoices/'.$invitation->invoice->public_id, $invitation->invoice->invoice_number) . ' to ' . $invitation->contact->getFullName() . ' - ' . $invitation->contact->email; + $activity->message = $userName . ' emailed invoice ' . link_to('invoices/'.$invitation->invoice->public_id, $invitation->invoice->invoice_number) . ' to ' . $invitation->contact->getDisplayName(); $activity->balance = $client->balance; $activity->adjustment = $adjustment; $activity->save(); diff --git a/app/models/Client.php b/app/models/Client.php index ec0235ec73e9..e232f4226e85 100755 --- a/app/models/Client.php +++ b/app/models/Client.php @@ -148,7 +148,7 @@ class Client extends EntityModel return ''; } - return link_to($this->website, $this->website); + return link_to($this->website, $this->website, array('target'=>'_blank')); } public function getDateCreated() diff --git a/app/models/Contact.php b/app/models/Contact.php index 0904a3bf232f..b6179ce8cfc5 100755 --- a/app/models/Contact.php +++ b/app/models/Contact.php @@ -31,13 +31,21 @@ class Contact extends EntityModel } */ - public function getFullName() + public function getDisplayName() { if (!$this->first_name && !$this->last_name) { return $this->email; } + else + { + return $this->getFullName(); + } + } + + public function getFullName() + { $fullName = $this->first_name . ' ' . $this->last_name; if ($fullName == ' ') diff --git a/app/models/Invoice.php b/app/models/Invoice.php index 5d82be47b524..24abf3127e15 100755 --- a/app/models/Invoice.php +++ b/app/models/Invoice.php @@ -100,11 +100,11 @@ class Invoice extends EntityModel case FREQUENCY_MONTHLY: return $dayOfMonthStart == $dayOfMonthToday || $daysSinceLastSent > 31; case FREQUENCY_THREE_MONTHS: - return ($dayOfMonthStart == $dayOfMonthToday && (!$daysSinceLastSent || $monthsSinceLastSent == 3)) || $daysSinceLastSent > (3 * 31); + return ($dayOfMonthStart == $dayOfMonthToday && (!$daysSinceLastSent || $monthsSinceLastSent == 3)) || $daysSinceLastSent > 92; case FREQUENCY_SIX_MONTHS: - return ($dayOfMonthStart == $dayOfMonthToday && (!$daysSinceLastSent || $monthsSinceLastSent == 6)) || $daysSinceLastSent > (6 * 31); + return ($dayOfMonthStart == $dayOfMonthToday && (!$daysSinceLastSent || $monthsSinceLastSent == 6)) || $daysSinceLastSent > 183; case FREQUENCY_ANNUALLY: - return ($dayOfMonthStart == $dayOfMonthToday && (!$daysSinceLastSent || $monthsSinceLastSent == 12)) || $daysSinceLastSent > (12 *31); + return ($dayOfMonthStart == $dayOfMonthToday && (!$daysSinceLastSent || $monthsSinceLastSent == 12)) || $daysSinceLastSent > 365; default: Utils::fatalError("Invalid frequency supplied: " . $this->frequency_id); break; diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php index 9566c925f5ea..24cec92e7784 100755 --- a/app/ninja/repositories/InvoiceRepository.php +++ b/app/ninja/repositories/InvoiceRepository.php @@ -80,7 +80,8 @@ class InvoiceRepository } $invoice = (array) $input; - $rules = ['invoice_number' => 'unique:invoices,invoice_number,' . $invoice['invoice_number'] . ',id,account_id,' . \Auth::user()->account_id]; + $invoiceId = isset($invoice['public_id']) && $invoice['public_id'] ? Invoice::getPrivateId($invoice['public_id']) : null; + $rules = ['invoice_number' => 'unique:invoices,invoice_number,' . $invoiceId . ',id,account_id,' . \Auth::user()->account_id]; $validator = \Validator::make($invoice, $rules); if ($validator->fails()) diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php index 3efda2841cb1..1494507c7632 100755 --- a/app/views/accounts/details.blade.php +++ b/app/views/accounts/details.blade.php @@ -37,9 +37,9 @@ {{ Former::legend('Address') }} {{ Former::text('address1')->label('Street') }} - {{ Former::text('address2')->label('Apt/Floor') }} + {{ Former::text('address2')->label('Apt/Suite') }} {{ Former::text('city') }} - {{ Former::text('state') }} + {{ Former::text('state')->label('State/Province') }} {{ Former::text('postal_code') }} {{ Former::select('country_id')->addOption('','')->label('Country') ->fromQuery($countries, 'name', 'id')->select($account ? $account->country_id : '') }} diff --git a/app/views/clients/edit.blade.php b/app/views/clients/edit.blade.php index b7fb500b45d3..1e82b34d16ae 100755 --- a/app/views/clients/edit.blade.php +++ b/app/views/clients/edit.blade.php @@ -30,9 +30,9 @@ {{ Former::legend('Address') }} {{ Former::text('address1')->label('Street') }} - {{ Former::text('address2')->label('Apt/Floor') }} + {{ Former::text('address2')->label('Apt/Suite') }} {{ Former::text('city') }} - {{ Former::text('state') }} + {{ Former::text('state')->label('State/Province') }} {{ Former::text('postal_code') }} {{ Former::select('country_id')->addOption('','')->label('Country') ->fromQuery($countries, 'name', 'id')->select($client ? $client->country_id : '') }} diff --git a/app/views/header.blade.php b/app/views/header.blade.php index f855a0969ca3..bb908b016164 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -6,10 +6,12 @@ + @if (Auth::check() && Auth::user()->theme_id) @else + @endif @@ -37,7 +39,6 @@ -