From 1ee1beb070b33605cfbe5ab18539a831c53a8204 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 19 Dec 2016 20:52:16 +0200 Subject: [PATCH] Don't show payment options if invoice isn't sent --- app/Ninja/Datatables/InvoiceDatatable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Ninja/Datatables/InvoiceDatatable.php b/app/Ninja/Datatables/InvoiceDatatable.php index 2bdb6e1c3b..66b02bd8a6 100644 --- a/app/Ninja/Datatables/InvoiceDatatable.php +++ b/app/Ninja/Datatables/InvoiceDatatable.php @@ -123,7 +123,7 @@ class InvoiceDatatable extends EntityDatatable return "javascript:submitForm_{$entityType}('markPaid', {$model->public_id})"; }, function ($model) { - return $model->balance > 0 && Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]); + return $model->is_public && $model->balance > 0 && Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]); } ], [ @@ -132,7 +132,7 @@ class InvoiceDatatable extends EntityDatatable return URL::to("payments/create/{$model->client_public_id}/{$model->public_id}"); }, function ($model) use ($entityType) { - return $entityType == ENTITY_INVOICE && $model->balance > 0 && Auth::user()->can('create', ENTITY_PAYMENT); + return $model->is_public && $entityType == ENTITY_INVOICE && $model->balance > 0 && Auth::user()->can('create', ENTITY_PAYMENT); } ], [