1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00

Merge pull request #6613 from turbo124/v5-develop

v5.3.9
This commit is contained in:
David Bomba 2021-09-10 17:45:23 +10:00 committed by GitHub
commit 75f7455192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 13 deletions

View File

@ -1 +1 @@
5.3.8 5.3.9

View File

@ -2,6 +2,7 @@
namespace App\Http\Requests\Gateways\Checkout3ds; namespace App\Http\Requests\Gateways\Checkout3ds;
use App\Libraries\MultiDB;
use App\Models\Client; use App\Models\Client;
use App\Models\Company; use App\Models\Company;
use App\Models\CompanyGateway; use App\Models\CompanyGateway;
@ -37,6 +38,7 @@ class Checkout3dsRequest extends FormRequest
public function getCompany() public function getCompany()
{ {
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return Company::where('company_key', $this->company_key)->first(); return Company::where('company_key', $this->company_key)->first();
} }

View File

@ -67,7 +67,7 @@ class InvoiceTransformer extends BaseTransformer {
if ( $transformed['balance'] < $transformed['amount'] ) { if ( $transformed['balance'] < $transformed['amount'] ) {
$transformed['payments'] = [[ $transformed['payments'] = [[
'date' => date( 'Y-m-d' ), 'date' => isset( $invoice_data['Last Payment Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Invoice Date'] ) ) : date( 'Y-m-d' ),
'amount' => $transformed['amount'] - $transformed['balance'], 'amount' => $transformed['amount'] - $transformed['balance'],
]]; ]];
} }
@ -75,3 +75,4 @@ class InvoiceTransformer extends BaseTransformer {
return $transformed; return $transformed;
} }
} }

View File

@ -640,7 +640,8 @@ class Import implements ShouldQueue
$client->updated_at = Carbon::parse($modified['updated_at']); $client->updated_at = Carbon::parse($modified['updated_at']);
$client->save(['timestamps' => false]); $client->save(['timestamps' => false]);
$client->fresh();
$client->contacts()->forceDelete(); $client->contacts()->forceDelete();
if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json
@ -650,7 +651,7 @@ class Import implements ShouldQueue
$modified_contacts[$key]['company_id'] = $this->company->id; $modified_contacts[$key]['company_id'] = $this->company->id;
$modified_contacts[$key]['user_id'] = $this->processUserId($resource); $modified_contacts[$key]['user_id'] = $this->processUserId($resource);
$modified_contacts[$key]['client_id'] = $client->id; $modified_contacts[$key]['client_id'] = $client->id;
$modified_contacts[$key]['password'] = 'mysuperpassword'; // @todo, and clean up the code.. $modified_contacts[$key]['password'] = Str::random(8);
unset($modified_contacts[$key]['id']); unset($modified_contacts[$key]['id']);
} }
@ -685,6 +686,8 @@ class Import implements ShouldQueue
'old' => $resource['id'], 'old' => $resource['id'],
'new' => $client->id, 'new' => $client->id,
]; ];
$client = null;
} }
Client::reguard(); Client::reguard();

View File

@ -62,9 +62,10 @@ class SupportMessageSent extends Mailable
$company = auth()->user()->company(); $company = auth()->user()->company();
$user = auth()->user(); $user = auth()->user();
$db = str_replace("db-ninja-", "", $company->db); $db = str_replace("db-ninja-", "", $company->db);
$is_large = $company->is_large ? "L" : "";
if(Ninja::isHosted()) if(Ninja::isHosted())
$subject = "{$priority}Hosted-{$db}-[{$company->is_large}] :: {$plan} :: ".date('M jS, g:ia'); $subject = "{$priority}Hosted-{$db}{$is_large} :: {$plan} :: ".date('M jS, g:ia');
else else
$subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia'); $subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia');

View File

@ -92,7 +92,7 @@ class ClientContact extends Authenticatable implements HasLocalePreference
'custom_value4', 'custom_value4',
'email', 'email',
'is_primary', 'is_primary',
'client_id', // 'client_id',
]; ];
/** /**

View File

@ -362,9 +362,14 @@ class StripePaymentDriver extends BaseDriver
$response = null; $response = null;
try { try {
$response = $this->stripe // $response = $this->stripe
->refunds // ->refunds
->create(['charge' => $payment->transaction_reference, 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision, $this->client->currency())], $meta); // ->create(['charge' => $payment->transaction_reference, 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision, $this->client->currency())], $meta);
$response = \Stripe\Refund::create([
'charge' => $payment->transaction_reference,
'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision, $this->client->currency())
], $meta);
if ($response->status == $response::STATUS_SUCCEEDED) { if ($response->status == $response::STATUS_SUCCEEDED) {
SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client, $this->client->company); SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client, $this->client->company);

View File

@ -56,8 +56,10 @@ class ClientContactRepository extends BaseRepository
if (! $update_contact) { if (! $update_contact) {
$update_contact = ClientContactFactory::create($client->company_id, $client->user_id); $update_contact = ClientContactFactory::create($client->company_id, $client->user_id);
$update_contact->client_id = $client->id;
} }
//10-09-2021 - enforce the client->id and remove client_id from fillables
$update_contact->client_id = $client->id;
/* We need to set NULL email addresses to blank strings to pass authentication*/ /* We need to set NULL email addresses to blank strings to pass authentication*/
if(array_key_exists('email', $contact) && is_null($contact['email'])) if(array_key_exists('email', $contact) && is_null($contact['email']))
@ -88,5 +90,7 @@ class ClientContactRepository extends BaseRepository
$new_contact->email = ' '; $new_contact->email = ' ';
$new_contact->save(); $new_contact->save();
} }
$client = null;
} }
} }

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.3.8', 'app_version' => '5.3.9',
'app_tag' => '5.3.8', 'app_tag' => '5.3.9',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''), 'api_secret' => env('API_SECRET', ''),