diff --git a/app/Http/Controllers/ImportExportController.php b/app/Http/Controllers/ImportExportController.php index 490106ca6ea0..fdab81f4d9ef 100644 --- a/app/Http/Controllers/ImportExportController.php +++ b/app/Http/Controllers/ImportExportController.php @@ -107,10 +107,13 @@ class ImportExportController extends BaseController if ($request->input(ENTITY_CLIENT)) { $data['clients'] = Client::scope() ->with('user', 'contacts', 'country') + ->withTrashed() + ->where('is_deleted', '=', false) ->get(); $data['contacts'] = Contact::scope() ->with('user', 'client.contacts') + ->withTrashed() ->get(); $data['credits'] = Credit::scope() @@ -121,18 +124,24 @@ class ImportExportController extends BaseController if ($request->input(ENTITY_TASK)) { $data['tasks'] = Task::scope() ->with('user', 'client.contacts') + ->withTrashed() + ->where('is_deleted', '=', false) ->get(); } if ($request->input(ENTITY_INVOICE)) { $data['invoices'] = Invoice::scope() ->with('user', 'client.contacts', 'invoice_status') + ->withTrashed() + ->where('is_deleted', '=', false) ->where('is_quote', '=', false) ->where('is_recurring', '=', false) ->get(); $data['quotes'] = Invoice::scope() ->with('user', 'client.contacts', 'invoice_status') + ->withTrashed() + ->where('is_deleted', '=', false) ->where('is_quote', '=', true) ->where('is_recurring', '=', false) ->get(); @@ -140,6 +149,8 @@ class ImportExportController extends BaseController if ($request->input(ENTITY_PAYMENT)) { $data['payments'] = Payment::scope() + ->withTrashed() + ->where('is_deleted', '=', false) ->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway') ->get(); } diff --git a/app/Http/Controllers/PublicClientController.php b/app/Http/Controllers/PublicClientController.php index a62b2f2d8594..35271aaf66f8 100644 --- a/app/Http/Controllers/PublicClientController.php +++ b/app/Http/Controllers/PublicClientController.php @@ -49,7 +49,7 @@ class PublicClientController extends BaseController } $invoice = $invitation->invoice; - $query = $this->activityRepo->findByClientId($invoice->client_id); + $query = $this->activityRepo->findByClientPublicId($invoice->client->public_id); $query->where('activities.adjustment', '!=', 0); return Datatable::query($query) diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 90203d522e33..23faf964315e 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -34,7 +34,7 @@ class Contact extends EntityModel public function client() { - return $this->belongsTo('App\Models\Client'); + return $this->belongsTo('App\Models\Client')->withTrashed(); } public function getPersonType() diff --git a/database/seeds/PaymentLibrariesSeeder.php b/database/seeds/PaymentLibrariesSeeder.php index 8d4fa7089a6a..7bc1ca878e58 100644 --- a/database/seeds/PaymentLibrariesSeeder.php +++ b/database/seeds/PaymentLibrariesSeeder.php @@ -115,6 +115,7 @@ class PaymentLibrariesSeeder extends Seeder ['name' => 'Mexican Peso', 'code' => 'MXN', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Egyptian Pound', 'code' => 'EGP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Colombian Peso', 'code' => 'COP', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], + ['name' => 'West African Franc', 'code' => 'XOF', 'symbol' => 'CFA ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ]; foreach ($currencies as $currency) { diff --git a/resources/views/export/contacts.blade.php b/resources/views/export/contacts.blade.php index 30c7305cc1b2..b35f59045a26 100644 --- a/resources/views/export/contacts.blade.php +++ b/resources/views/export/contacts.blade.php @@ -10,16 +10,18 @@ @foreach ($contacts as $contact) - - {{ $contact->client->getDisplayName() }} - @if ($multiUser) - {{ $contact->user->getDisplayName() }} - @endif - {{ $contact->first_name }} - {{ $contact->last_name }} - {{ $contact->email }} - {{ $contact->phone }} - + @if (!$contact->client->is_deleted) + + {{ $contact->client->getDisplayName() }} + @if ($multiUser) + {{ $contact->user->getDisplayName() }} + @endif + {{ $contact->first_name }} + {{ $contact->last_name }} + {{ $contact->email }} + {{ $contact->phone }} + + @endif @endforeach \ No newline at end of file diff --git a/resources/views/export/credits.blade.php b/resources/views/export/credits.blade.php index 85fa24ba7947..28d53a5e7fc8 100644 --- a/resources/views/export/credits.blade.php +++ b/resources/views/export/credits.blade.php @@ -9,15 +9,17 @@ @foreach ($credits as $credit) - - {{ $credit->client->getDisplayName() }} - @if ($multiUser) - {{ $credit->user->getDisplayName() }} - @endif - {{ $credit->present()->amount }} - {{ $credit->present()->balance }} - {{ $credit->present()->credit_date }} - + @if (!$credit->client->is_deleted) + + {{ $credit->client->getDisplayName() }} + @if ($multiUser) + {{ $credit->user->getDisplayName() }} + @endif + {{ $credit->present()->amount }} + {{ $credit->present()->balance }} + {{ $credit->present()->credit_date }} + + @endif @endforeach \ No newline at end of file