1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Bug fixes

This commit is contained in:
Hillel Coren 2014-03-31 13:52:03 +03:00
parent 2e299aa83f
commit 6377d2a91b

View File

@ -171,26 +171,22 @@ class AccountController extends \BaseController {
header("Content-Type:application/csv"); header("Content-Type:application/csv");
header("Content-Disposition:attachment;filename=export.csv"); header("Content-Disposition:attachment;filename=export.csv");
$clients = Client::where('account_id','=',Auth::user()->account_id)->get(); $clients = Client::scope()->get();
AccountController::exportData($output, $clients->toArray()); AccountController::exportData($output, $clients->toArray());
$contacts = DB::table('contacts')->whereIn('client_id', function($query){ $contacts = Contact::scope()->get();
$query->select('client_id')->from('clients')->where('account_id','=',Auth::user()->account_id); AccountController::exportData($output, $contacts->toArray());
})->get();
AccountController::exportData($output, Utils::toArray($contacts));
$invoices = Invoice::where('account_id','=',Auth::user()->account_id)->get();
AccountController::exportData($output, $invoices->toArray());
$invoiceItems = DB::table('invoice_items')->whereIn('invoice_id', function($query){ $invoices = Invoice::scope()->get();
$query->select('invoice_id')->from('invoices')->where('account_id','=',Auth::user()->account_id); AccountController::exportData($output, $invoices->toArray());
})->get();
AccountController::exportData($output, Utils::toArray($invoiceItems));
$payments = Payment::where('account_id','=',Auth::user()->account_id)->get(); $invoiceItems = InvoiceItem::scope()->get();
AccountController::exportData($output, $invoiceItems->toArray());
$payments = Payment::scope()->get();
AccountController::exportData($output, $payments->toArray()); AccountController::exportData($output, $payments->toArray());
$credits = Credit::where('account_id','=',Auth::user()->account_id)->get(); $credits = Credit::scope()->get();
AccountController::exportData($output, $credits->toArray()); AccountController::exportData($output, $credits->toArray());
fclose($output); fclose($output);