1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 17:01:33 +02:00

Merge pull request #3844 from turbo124/v2

V2
This commit is contained in:
David Bomba 2020-06-26 19:55:01 +10:00 committed by GitHub
commit 0103251534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -119,10 +119,14 @@ class RefundPayment
private function calculateTotalRefund() private function calculateTotalRefund()
{ {
if (isset($this->refund_data['invoices']) && count($this->refund_data['invoices']) > 0) if (array_key_exists('invoices', $this->refund_data) && count($this->refund_data['invoices']) > 0){
info("array of invoice to refund");
$this->total_refund = collect($this->refund_data['invoices'])->sum('amount'); $this->total_refund = collect($this->refund_data['invoices'])->sum('amount');
else }
else{
info("no invoices found - refunding total.");
$this->total_refund = $this->refund_data['amount']; $this->total_refund = $this->refund_data['amount'];
}
return $this; return $this;
} }
@ -145,8 +149,8 @@ class RefundPayment
$this->credit_note->date = $this->refund_data['date']; $this->credit_note->date = $this->refund_data['date'];
$this->credit_note->status_id = Credit::STATUS_SENT; $this->credit_note->status_id = Credit::STATUS_SENT;
$this->credit_note->client_id = $this->payment->client->id; $this->credit_note->client_id = $this->payment->client->id;
$this->credit_note->amount = $this->refund_data['amount']; $this->credit_note->amount = $this->total_refund;
$this->credit_note->balance = $this->refund_data['amount']; $this->credit_note->balance = $this->total_refund;
$this->credit_note->save(); $this->credit_note->save();
$this->credit_note->number = $this->payment->client->getNextCreditNumber($this->payment->client); $this->credit_note->number = $this->payment->client->getNextCreditNumber($this->payment->client);

View File

@ -12,8 +12,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => env('APP_URL', ''), 'app_url' => env('APP_URL', ''),
'app_domain' => env('APP_DOMAIN', ''), 'app_domain' => env('APP_DOMAIN', ''),
'app_version' => '5.0.4', 'app_version' => '5.0.5',
'minimum_client_version' => '5.0.4', 'minimum_client_version' => '5.0.11',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''), 'api_secret' => env('API_SECRET', ''),
'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'), 'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'),