From debc22d7d2465c02197b0fee6248ee0b8576f78f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 31 Dec 2015 13:31:50 +0200 Subject: [PATCH] Bug fixes --- app/Http/Controllers/PublicClientController.php | 2 +- app/Http/Requests/CreatePaymentRequest.php | 9 +++------ app/Libraries/Utils.php | 1 + app/Models/Invoice.php | 1 + resources/views/error.blade.php | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/PublicClientController.php b/app/Http/Controllers/PublicClientController.php index 95c719c04e..e56d5190ac 100644 --- a/app/Http/Controllers/PublicClientController.php +++ b/app/Http/Controllers/PublicClientController.php @@ -54,7 +54,7 @@ class PublicClientController extends BaseController return Datatable::query($query) ->addColumn('activities.id', function ($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); }) - ->addColumn('message', function ($model) { + ->addColumn('activity_type_id', function ($model) { $data = [ 'client' => Utils::getClientDisplayName($model), 'user' => $model->is_system ? ('' . trans('texts.system') . '') : ($model->user_first_name . ' ' . $model->user_last_name), diff --git a/app/Http/Requests/CreatePaymentRequest.php b/app/Http/Requests/CreatePaymentRequest.php index d0c8146872..f836f0a5a3 100644 --- a/app/Http/Requests/CreatePaymentRequest.php +++ b/app/Http/Requests/CreatePaymentRequest.php @@ -24,21 +24,18 @@ class CreatePaymentRequest extends Request public function rules() { $input = $this->input(); + $invoice = Invoice::scope($input['invoice'])->firstOrFail(); + $rules = array( 'client' => 'required', 'invoice' => 'required', - 'amount' => 'required', + 'amount' => 'required|less_than:{$invoice->balance}|positive', ); if ($input['payment_type_id'] == PAYMENT_TYPE_CREDIT) { $rules['payment_type_id'] = 'has_credit:'.$input['client'].','.$input['amount']; } - if (isset($input['invoice']) && $input['invoice']) { - $invoice = Invoice::scope($input['invoice'])->firstOrFail(); - $rules['amount'] .= "|less_than:{$invoice->balance}"; - } - return $rules; } } diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 8893cdfcb1..74ac561699 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -214,6 +214,7 @@ class Utils 'user_id' => Auth::check() ? Auth::user()->id : 0, 'account_id' => Auth::check() ? Auth::user()->account_id : 0, 'user_name' => Auth::check() ? Auth::user()->getDisplayName() : '', + 'method' => Request::method(), 'url' => Input::get('url', Request::url()), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', 'ip' => Request::getClientIp(), diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 6b4c9a0b60..a80c7cfd2a 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -380,6 +380,7 @@ class Invoice extends EntityModel implements BalanceAffecting $this->account->setVisible([ 'name', + 'website', 'id_number', 'vat_number', 'address1', diff --git a/resources/views/error.blade.php b/resources/views/error.blade.php index c82d792f59..149472fd50 100644 --- a/resources/views/error.blade.php +++ b/resources/views/error.blade.php @@ -9,7 +9,7 @@

Something went wrong...

{{ $error }}

-

If you'd like help please email us at contact@invoiceninja.com.

+

If you'd like help please email us at {{ env('MAIL_USERNAME') }}.