mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
minor fixes for recurring expenses
This commit is contained in:
parent
be45998ebe
commit
b0cfa6a699
@ -51,9 +51,9 @@ class RecurringExpenseToExpenseFactory
|
||||
$expense->payment_type_id = $recurring_expense->payment_type_id;
|
||||
$expense->project_id = $recurring_expense->project_id;
|
||||
$expense->invoice_documents = $recurring_expense->invoice_documents;
|
||||
$expense->tax_amount1 = $recurring_expense->tax_amount1;
|
||||
$expense->tax_amount2 = $recurring_expense->tax_amount2;
|
||||
$expense->tax_amount3 = $recurring_expense->tax_amount3;
|
||||
$expense->tax_amount1 = $recurring_expense->tax_amount1 ?: 0;
|
||||
$expense->tax_amount2 = $recurring_expense->tax_amount2 ?: 0;
|
||||
$expense->tax_amount3 = $recurring_expense->tax_amount3 ?: 0;
|
||||
$expense->uses_inclusive_taxes = $recurring_expense->uses_inclusive_taxes;
|
||||
$expense->calculate_tax_by_amount = $recurring_expense->calculate_tax_by_amount;
|
||||
|
||||
|
@ -13,8 +13,12 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Jobs\Account\CreateAccount;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyToken;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class HostedMigrationController extends Controller
|
||||
{
|
||||
@ -54,7 +58,34 @@ class HostedMigrationController extends Controller
|
||||
if($request->header('X-API-HOSTED-SECRET') != config('ninja.ninja_hosted_secret'))
|
||||
return;
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
MultiDB::findAndSetDbByCompanyKey($input['account_key']);
|
||||
|
||||
$company = Company::with('account')->where('company_key', $input['account_key'])->first();
|
||||
$account = $company->account;
|
||||
$client_id = false;
|
||||
|
||||
if($contact = ClientContact::on('db-ninja-01')->where(['email' => $input['email'], 'company_id' => config('ninja.ninja_default_company_id')])->first()){
|
||||
$client_id = $contact->client_id;
|
||||
}
|
||||
else if($client = Client::on('db-ninja-01')->where(['custom_value2' => $account->key, 'company_id' => config('ninja.ninja_default_company_id')])->first()){
|
||||
$client_id = $client->id;
|
||||
}
|
||||
|
||||
//get ninja client_id;
|
||||
|
||||
if(strlen($input['gateway_reference']) >1 && $client_id){
|
||||
|
||||
Artisan::call('ninja:add-token', [
|
||||
'--customer' => $input['gateway_reference'], '--client_id' => 1
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$forward_url = $company->domain();
|
||||
|
||||
return response()->json(['forward_url' => $forward_url], 200);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user