From c51b93072a688494e70f736cff7684169c2c3330 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 19 Oct 2014 13:13:55 +0300 Subject: [PATCH] Fixed bug where the incorrect credit balance was updated --- app/ninja/repositories/PaymentRepository.php | 6 ++++-- app/views/header.blade.php | 2 +- app/views/master.blade.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/ninja/repositories/PaymentRepository.php b/app/ninja/repositories/PaymentRepository.php index f19b2ffb58..31126b13c8 100755 --- a/app/ninja/repositories/PaymentRepository.php +++ b/app/ninja/repositories/PaymentRepository.php @@ -76,11 +76,13 @@ class PaymentRepository } $paymentTypeId = $input['payment_type_id'] ? $input['payment_type_id'] : null; + $clientId = Client::getPrivateId($input['client']); $amount = Utils::parseFloat($input['amount']); if ($paymentTypeId == PAYMENT_TYPE_CREDIT) { - $credits = Credit::scope()->where('balance', '>', 0)->orderBy('created_at')->get(); + $credits = Credit::scope()->where('client_id', '=', $clientId) + ->where('balance', '>', 0)->orderBy('created_at')->get(); $applied = 0; foreach ($credits as $credit) @@ -94,7 +96,7 @@ class PaymentRepository } } - $payment->client_id = Client::getPrivateId($input['client']); + $payment->client_id = $clientId; $payment->invoice_id = isset($input['invoice']) && $input['invoice'] != "-1" ? Invoice::getPrivateId($input['invoice']) : null; $payment->payment_type_id = $paymentTypeId; $payment->payment_date = Utils::toSqlDate($input['payment_date']); diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 343a803aa5..04ddb6b0c8 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -15,7 +15,7 @@ /* Fix for header covering stuff when the screen is narrower */ @media screen and (min-width: 1200px) { body { - padding-top: 50px; + padding-top: 56px; } } diff --git a/app/views/master.blade.php b/app/views/master.blade.php index e80fd0295d..feb91b4e63 100755 --- a/app/views/master.blade.php +++ b/app/views/master.blade.php @@ -1,8 +1,8 @@ - Invoice Ninja | {{ isset($title) ? $title : ' Free Online Invoice Templates & Generator' }} - + Invoice Ninja | {{ isset($title) ? $title : ' Free Open-Source Online Invoicing' }} +