mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Export company_user with users (#3597)
This commit is contained in:
parent
602a15f648
commit
0b8b4a7505
@ -1,9 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace App\Traits;
|
namespace App\Traits;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\AccountGateway;
|
use App\Models\AccountGateway;
|
||||||
use App\Models\AccountGatewaySettings;
|
use App\Models\AccountGatewaySettings;
|
||||||
use App\Models\AccountGatewayToken;
|
use App\Models\AccountGatewayToken;
|
||||||
@ -195,11 +193,12 @@ trait GenerateMigrationResources
|
|||||||
|
|
||||||
private function getClientSettings($client)
|
private function getClientSettings($client)
|
||||||
{
|
{
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = $client->currency_id ? (string) $client->currency_id : (string) $client->account->currency_id;
|
$settings->currency_id = $client->currency_id ? (string) $client->currency_id : (string) $client->account->currency_id;
|
||||||
|
|
||||||
if($client->language_id)
|
if ($client->language_id) {
|
||||||
$settings->language_id = $client->language_id;
|
$settings->language_id = $client->language_id;
|
||||||
|
}
|
||||||
|
|
||||||
return $settings;
|
return $settings;
|
||||||
}
|
}
|
||||||
@ -291,6 +290,7 @@ trait GenerateMigrationResources
|
|||||||
'created_at' => $user->created_at ? $user->created_at->toDateString() : null,
|
'created_at' => $user->created_at ? $user->created_at->toDateString() : null,
|
||||||
'updated_at' => $user->updated_at ? $user->updated_at->toDateString() : null,
|
'updated_at' => $user->updated_at ? $user->updated_at->toDateString() : null,
|
||||||
'deleted_at' => $user->deleted_at ? $user->deleted_at->toDateString() : null,
|
'deleted_at' => $user->deleted_at ? $user->deleted_at->toDateString() : null,
|
||||||
|
'company_user' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +431,6 @@ trait GenerateMigrationResources
|
|||||||
return $transformed;
|
return $transformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getInvoiceItems($items)
|
public function getInvoiceItems($items)
|
||||||
{
|
{
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
@ -614,11 +613,9 @@ trait GenerateMigrationResources
|
|||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($account_gateways as $account_gateway) {
|
foreach ($account_gateways as $account_gateway) {
|
||||||
|
|
||||||
$gateway_types = $account_gateway->paymentDriver()->gatewayTypes();
|
$gateway_types = $account_gateway->paymentDriver()->gatewayTypes();
|
||||||
|
|
||||||
foreach ($gateway_types as $gateway_type_id) {
|
foreach ($gateway_types as $gateway_type_id) {
|
||||||
|
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $account_gateway->id,
|
'id' => $account_gateway->id,
|
||||||
'user_id' => $account_gateway->user_id,
|
'user_id' => $account_gateway->user_id,
|
||||||
@ -639,7 +636,6 @@ trait GenerateMigrationResources
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $transformed;
|
return $transformed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getClientGatewayTokens()
|
private function getClientGatewayTokens()
|
||||||
@ -651,7 +647,6 @@ trait GenerateMigrationResources
|
|||||||
$is_default = true;
|
$is_default = true;
|
||||||
|
|
||||||
foreach ($payment_methods as $payment_method) {
|
foreach ($payment_methods as $payment_method) {
|
||||||
|
|
||||||
$contact = Contact::find($payment_method->contact_id)->first();
|
$contact = Contact::find($payment_method->contact_id)->first();
|
||||||
$agt = AccountGatewayToken::find($payment_method->account_gateway_token_id)->first();
|
$agt = AccountGatewayToken::find($payment_method->account_gateway_token_id)->first();
|
||||||
|
|
||||||
@ -675,22 +670,21 @@ trait GenerateMigrationResources
|
|||||||
|
|
||||||
private function convertMeta($payment_method)
|
private function convertMeta($payment_method)
|
||||||
{
|
{
|
||||||
$expiry = explode("-", $payment_method->expiration);
|
$expiry = explode('-', $payment_method->expiration);
|
||||||
|
|
||||||
if (is_array($expiry)) {
|
if (is_array($expiry)) {
|
||||||
$exp_month = $expiry[1];
|
$exp_month = $expiry[1];
|
||||||
$exp_year = $expiry[0];
|
$exp_year = $expiry[0];
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$exp_month = '';
|
$exp_month = '';
|
||||||
$exp_year = '';
|
$exp_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$meta = new \stdClass;
|
$meta = new \stdClass();
|
||||||
$meta->exp_month = $exp_month;
|
$meta->exp_month = $exp_month;
|
||||||
$meta->exp_year = $exp_year;
|
$meta->exp_year = $exp_year;
|
||||||
$meta->brand = $payment_method->payment_type->name;
|
$meta->brand = $payment_method->payment_type->name;
|
||||||
$meta->last4 = str_replace(",","", ($payment_method->expiration));
|
$meta->last4 = str_replace(',', '', ($payment_method->expiration));
|
||||||
$meta->type = $payment_method->payment_type->gateway_type_id;
|
$meta->type = $payment_method->payment_type->gateway_type_id;
|
||||||
|
|
||||||
return $meta;
|
return $meta;
|
||||||
@ -702,10 +696,11 @@ trait GenerateMigrationResources
|
|||||||
->where('gateway_type_id', $gateway_type_id)
|
->where('gateway_type_id', $gateway_type_id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$ags)
|
if (! $ags) {
|
||||||
return new \stdClass;
|
return new \stdClass();
|
||||||
|
}
|
||||||
|
|
||||||
$fees_and_limits = new \stdClass;
|
$fees_and_limits = new \stdClass();
|
||||||
$fees_and_limits->min_limit = $ags->min_limit;
|
$fees_and_limits->min_limit = $ags->min_limit;
|
||||||
$fees_and_limits->max_limit = $ags->max_limit;
|
$fees_and_limits->max_limit = $ags->max_limit;
|
||||||
$fees_and_limits->fee_amount = $ags->fee_amount;
|
$fees_and_limits->fee_amount = $ags->fee_amount;
|
||||||
@ -717,7 +712,6 @@ trait GenerateMigrationResources
|
|||||||
$fees_and_limits->tax_name3 = '';
|
$fees_and_limits->tax_name3 = '';
|
||||||
$fees_and_limits->tax_rate3 = 0;
|
$fees_and_limits->tax_rate3 = 0;
|
||||||
|
|
||||||
|
|
||||||
return $fees_and_limits;
|
return $fees_and_limits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user