1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fixed bug where the incorrect credit balance was updated

This commit is contained in:
Hillel Coren 2014-10-19 13:13:55 +03:00
parent 62a6f8538a
commit c51b93072a
3 changed files with 7 additions and 5 deletions

View File

@ -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']);

View File

@ -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;
}
}

View File

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Invoice Ninja | {{ isset($title) ? $title : ' Free Online Invoice Templates & Generator' }}</title>
<meta name="description" content="{{ isset($description) ? $description : 'Create and generate custom invoices online for free using Invoice Ninja. Use our templates or customize your own today.' }}"></meta>
<title>Invoice Ninja | {{ isset($title) ? $title : ' Free Open-Source Online Invoicing' }}</title>
<meta name="description" content="{{ isset($description) ? $description : 'Invoice Ninja is a free, open-source solution for invoicing and billing customers. With Invoice Ninja, you can easily build and send beautiful invoices from any device that has access to the web. Your clients can print your invoices, download them as pdf files, and even pay you online from within the system.' }}"></meta>
<!-- Source: https://github.com/hillelcoren/invoice-ninja -->
<!-- Version: {{ NINJA_VERSION }} -->