mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Restrict client list
This commit is contained in:
parent
d9a20ca445
commit
f67990d636
@ -64,7 +64,7 @@ class CreditController extends BaseController
|
|||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'credits',
|
'url' => 'credits',
|
||||||
'title' => trans('texts.new_credit'),
|
'title' => trans('texts.new_credit'),
|
||||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(),
|
||||||
);
|
);
|
||||||
|
|
||||||
return View::make('credits.edit', $data);
|
return View::make('credits.edit', $data);
|
||||||
@ -74,9 +74,9 @@ class CreditController extends BaseController
|
|||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$credit = Credit::scope($publicId)->firstOrFail();
|
$credit = Credit::scope($publicId)->firstOrFail();
|
||||||
|
|
||||||
$this->authorize('edit', $credit);
|
$this->authorize('edit', $credit);
|
||||||
|
|
||||||
$credit->credit_date = Utils::fromSqlDate($credit->credit_date);
|
$credit->credit_date = Utils::fromSqlDate($credit->credit_date);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
@ -90,7 +90,7 @@ class CreditController extends BaseController
|
|||||||
return View::make('credit.edit', $data);
|
return View::make('credit.edit', $data);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function store(CreateCreditRequest $request)
|
public function store(CreateCreditRequest $request)
|
||||||
{
|
{
|
||||||
$credit = $this->creditRepo->save($request->input());
|
$credit = $this->creditRepo->save($request->input());
|
||||||
|
@ -35,7 +35,7 @@ use App\Http\Requests\UpdatePaymentRequest;
|
|||||||
class PaymentController extends BaseController
|
class PaymentController extends BaseController
|
||||||
{
|
{
|
||||||
protected $entityType = ENTITY_PAYMENT;
|
protected $entityType = ENTITY_PAYMENT;
|
||||||
|
|
||||||
public function __construct(PaymentRepository $paymentRepo, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo, ContactMailer $contactMailer, PaymentService $paymentService, UserMailer $userMailer)
|
public function __construct(PaymentRepository $paymentRepo, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo, ContactMailer $contactMailer, PaymentService $paymentService, UserMailer $userMailer)
|
||||||
{
|
{
|
||||||
// parent::__construct();
|
// parent::__construct();
|
||||||
@ -77,6 +77,7 @@ class PaymentController extends BaseController
|
|||||||
public function create(PaymentRequest $request)
|
public function create(PaymentRequest $request)
|
||||||
{
|
{
|
||||||
$invoices = Invoice::scope()
|
$invoices = Invoice::scope()
|
||||||
|
->viewable()
|
||||||
->invoiceType(INVOICE_TYPE_STANDARD)
|
->invoiceType(INVOICE_TYPE_STANDARD)
|
||||||
->where('is_recurring', '=', false)
|
->where('is_recurring', '=', false)
|
||||||
->where('invoices.balance', '>', 0)
|
->where('invoices.balance', '>', 0)
|
||||||
@ -94,7 +95,7 @@ class PaymentController extends BaseController
|
|||||||
'title' => trans('texts.new_payment'),
|
'title' => trans('texts.new_payment'),
|
||||||
'paymentTypes' => Cache::get('paymentTypes'),
|
'paymentTypes' => Cache::get('paymentTypes'),
|
||||||
'paymentTypeId' => Input::get('paymentTypeId'),
|
'paymentTypeId' => Input::get('paymentTypeId'),
|
||||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), );
|
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(), );
|
||||||
|
|
||||||
return View::make('payments.edit', $data);
|
return View::make('payments.edit', $data);
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ class PaymentController extends BaseController
|
|||||||
public function edit(PaymentRequest $request)
|
public function edit(PaymentRequest $request)
|
||||||
{
|
{
|
||||||
$payment = $request->entity();
|
$payment = $request->entity();
|
||||||
|
|
||||||
$payment->payment_date = Utils::fromSqlDate($payment->payment_date);
|
$payment->payment_date = Utils::fromSqlDate($payment->payment_date);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
@ -691,7 +692,7 @@ class PaymentController extends BaseController
|
|||||||
Session::flash('error', $message);
|
Session::flash('error', $message);
|
||||||
}
|
}
|
||||||
return Redirect::to($invitation->getLink());
|
return Redirect::to($invitation->getLink());
|
||||||
} elseif (method_exists($gateway, 'completePurchase')
|
} elseif (method_exists($gateway, 'completePurchase')
|
||||||
&& !$accountGateway->isGateway(GATEWAY_TWO_CHECKOUT)
|
&& !$accountGateway->isGateway(GATEWAY_TWO_CHECKOUT)
|
||||||
&& !$accountGateway->isGateway(GATEWAY_CHECKOUT_COM)) {
|
&& !$accountGateway->isGateway(GATEWAY_CHECKOUT_COM)) {
|
||||||
$details = $this->paymentService->getPaymentDetails($invitation, $accountGateway, array());
|
$details = $this->paymentService->getPaymentDetails($invitation, $accountGateway, array());
|
||||||
@ -723,7 +724,7 @@ class PaymentController extends BaseController
|
|||||||
public function store(CreatePaymentRequest $request)
|
public function store(CreatePaymentRequest $request)
|
||||||
{
|
{
|
||||||
$input = $request->input();
|
$input = $request->input();
|
||||||
|
|
||||||
$input['invoice_id'] = Invoice::getPrivateId($input['invoice']);
|
$input['invoice_id'] = Invoice::getPrivateId($input['invoice']);
|
||||||
$input['client_id'] = Client::getPrivateId($input['client']);
|
$input['client_id'] = Client::getPrivateId($input['client']);
|
||||||
$payment = $this->paymentRepo->save($input);
|
$payment = $this->paymentRepo->save($input);
|
||||||
@ -790,7 +791,7 @@ class PaymentController extends BaseController
|
|||||||
} elseif (!empty($data)) {
|
} elseif (!empty($data)) {
|
||||||
return response()->json($data);
|
return response()->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Bank not found',
|
'message' => 'Bank not found',
|
||||||
], 404);
|
], 404);
|
||||||
|
@ -40,11 +40,11 @@ class TaskApiController extends BaseAPIController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$payments = Task::scope()
|
$tasks = Task::scope()
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->orderBy('created_at', 'desc');
|
->orderBy('created_at', 'desc');
|
||||||
|
|
||||||
return $this->listResponse($payments);
|
return $this->listResponse($tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +117,7 @@ class TaskController extends BaseController
|
|||||||
$this->checkTimezone();
|
$this->checkTimezone();
|
||||||
|
|
||||||
$task = $request->entity();
|
$task = $request->entity();
|
||||||
|
|
||||||
$actions = [];
|
$actions = [];
|
||||||
if ($task->invoice) {
|
if ($task->invoice) {
|
||||||
$actions[] = ['url' => URL::to("invoices/{$task->invoice->public_id}/edit"), 'label' => trans("texts.view_invoice")];
|
$actions[] = ['url' => URL::to("invoices/{$task->invoice->public_id}/edit"), 'label' => trans("texts.view_invoice")];
|
||||||
@ -167,14 +167,14 @@ class TaskController extends BaseController
|
|||||||
public function update(UpdateTaskRequest $request)
|
public function update(UpdateTaskRequest $request)
|
||||||
{
|
{
|
||||||
$task = $request->entity();
|
$task = $request->entity();
|
||||||
|
|
||||||
return $this->save($task->public_id);
|
return $this->save($task->public_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getViewModel()
|
private static function getViewModel()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->viewable()->with('contacts')->orderBy('name')->get(),
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ class TaskController extends BaseController
|
|||||||
private function save($publicId = null)
|
private function save($publicId = null)
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = Input::get('action');
|
||||||
|
|
||||||
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ class TaskController extends BaseController
|
|||||||
$tasks = Task::scope($ids)->with('client')->get();
|
$tasks = Task::scope($ids)->with('client')->get();
|
||||||
$clientPublicId = false;
|
$clientPublicId = false;
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
foreach ($tasks as $task) {
|
foreach ($tasks as $task) {
|
||||||
if ($task->client) {
|
if ($task->client) {
|
||||||
if (!$clientPublicId) {
|
if (!$clientPublicId) {
|
||||||
@ -228,7 +228,7 @@ class TaskController extends BaseController
|
|||||||
Session::flash('error', trans('texts.task_error_invoiced'));
|
Session::flash('error', trans('texts.task_error_invoiced'));
|
||||||
return Redirect::to('tasks');
|
return Redirect::to('tasks');
|
||||||
}
|
}
|
||||||
|
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'publicId' => $task->public_id,
|
'publicId' => $task->public_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user