diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index dd436cc1687a..75d87ad1ba93 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -170,6 +170,9 @@ class AccountController extends \BaseController { $payments = Payment::where('account_id','=',Auth::user()->account_id)->get(); AccountController::exportData($output, $payments->toArray()); + $credits = Credit::where('account_id','=',Auth::user()->account_id)->get(); + AccountController::exportData($output, $credits->toArray()); + fclose($output); exit; } diff --git a/app/libraries/utils.php b/app/libraries/utils.php index feb12d2eb61f..9bae76a19166 100755 --- a/app/libraries/utils.php +++ b/app/libraries/utils.php @@ -41,7 +41,7 @@ class Utils public static function formatPhoneNumber($phoneNumber) { - $phoneNumber = preg_replace('/[^0-9]/','',$phoneNumber); + $phoneNumber = preg_replace('/[^0-9a-zA-Z]/','',$phoneNumber); if (!$phoneNumber) { return ''; diff --git a/app/models/Client.php b/app/models/Client.php index 54d2f3fe5cf3..ac56c095c300 100755 --- a/app/models/Client.php +++ b/app/models/Client.php @@ -117,9 +117,9 @@ class Client extends EntityModel { $str = ''; - if ($this->notes) + if ($this->private_notes) { - $str .= '' . $this->notes . ''; + $str .= '' . $this->private_notes . ''; } return $str; diff --git a/app/ninja/repositories/AccountRepository.php b/app/ninja/repositories/AccountRepository.php index fd22d39bf971..23bef9c54178 100755 --- a/app/ninja/repositories/AccountRepository.php +++ b/app/ninja/repositories/AccountRepository.php @@ -9,17 +9,20 @@ class AccountRepository { $clients = \DB::table('clients') ->where('clients.deleted_at', '=', null) + ->where('clients.account_id', '=', \Auth::user()->account_id) ->whereRaw("clients.name <> ''") ->select(\DB::raw("'Clients' as type, clients.public_id, clients.name, '' as token")); $contacts = \DB::table('clients') ->join('contacts', 'contacts.client_id', '=', 'clients.id') ->where('clients.deleted_at', '=', null) + ->where('clients.account_id', '=', \Auth::user()->account_id) ->whereRaw("CONCAT(contacts.first_name, contacts.last_name, contacts.email) <> ''") ->select(\DB::raw("'Contacts' as type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token")); $invoices = \DB::table('clients') ->join('invoices', 'invoices.client_id', '=', 'clients.id') + ->where('clients.account_id', '=', \Auth::user()->account_id) ->where('clients.deleted_at', '=', null) ->where('invoices.deleted_at', '=', null) ->select(\DB::raw("'Invoices' as type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token")); diff --git a/app/views/header.blade.php b/app/views/header.blade.php index e93b31dad10b..bc875286294c 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -343,6 +343,9 @@ local: data[type] }); } + if (datasets.length == 0) { + return; + } $('#search').typeahead(datasets).on('typeahead:selected', function(element, datum, name) { var type = name == 'Contacts' ? 'clients' : name.toLowerCase(); window.location = '{{ URL::to('/') }}' + '/' + type + '/' + datum.public_id; diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index e7506af84025..cfbe446716e6 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -149,7 +149,7 @@ {{ Former::textarea('terms')->data_bind("value: wrapped_terms, valueUpdate: 'afterkeydown'") ->label(false)->placeholder('Invoice terms')->style('width: 520px; resize: none') ->addGroupClass('less-space-bottom') }} -