1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Cast to string - default_gateway_type_id (#3105)

* fixes for template controller

* Default gateway as string
This commit is contained in:
David Bomba 2019-11-29 22:15:50 +11:00 committed by GitHub
parent 4391ad087c
commit bf41c634c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 6 deletions

View File

@ -70,7 +70,7 @@ class TemplateController extends BaseController
public function create($entity)
{
return response()->json(request()->all(), 200);
return response()->json(request()->all(), 200);
}
/**
@ -157,12 +157,12 @@ class TemplateController extends BaseController
$entity_obj = $class::find($entity_id)->company();
$subject = request()->input('subject');
$body = ;
$body = request()->input('body');
$body = Parsedown::instance()->text(request()->input('body'));
$subject = Parsedown::instance()->text(request()->input('subject'));
return response()->json($body, 200);
return response()->json($body, 200);
}

View File

@ -50,7 +50,7 @@ class QueryLogging
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
// if($count > 50)
Log::info($queries);
// Log::info($queries);
}
}

View File

@ -29,6 +29,7 @@ class CompanyUser extends Pivot
'updated_at' => 'timestamp',
'created_at' => 'timestamp',
'deleted_at' => 'timestamp',
'settings' => 'object',
];
protected $fillable = [

View File

@ -29,7 +29,7 @@ class ActivityTransformer extends EntityTransformer
'activity_type_id' => (string) $activity->activity_type_id,
'client_id' => $activity->client ? (string) $this->encodePrimaryKey($activity->client->id) : '',
'company_id' => $activity->company ? (string) $this->encodePrimaryKey($activity->company->id) : '',
'user_id' => (string) $activity->user_id,
'user_id' => (string) $this->encodePrimaryKey($activity->user_id),
'invoice_id' => $activity->invoice ? (string) $this->encodePrimaryKey($activity->invoice->id) : '',
'payment_id' => $activity->payment ? (string) $this->encodePrimaryKey($activity->payment->id) : '',
'credit_id' => $activity->credit ? (string) $this->encodePrimaryKey($activity->credit->id) : '',

View File

@ -45,7 +45,7 @@ class GatewayTransformer extends EntityTransformer
'provider' => (string)$gateway->provider ?: '',
'visible' => (bool)$gateway->visible,
'sort_order' => (int)$gateway->sort_order,
'default_gateway_type_id' => (int)$gateway->default_gateway_type_id,
'default_gateway_type_id' => (string)$gateway->default_gateway_type_id,
'site_url' => (string)$gateway->site_url ?: '',
'is_offsite' => (bool)$gateway->is_offsite,
'is_secure' => (bool)$gateway->is_secure,

View File

@ -3,6 +3,7 @@
namespace Tests\Feature;
use App\Factory\UserFactory;
use App\Models\Account;
use App\Models\Activity;
use App\Models\Company;
@ -77,4 +78,21 @@ class UserTest extends TestCase
}
public function testUserAttachAndDetach()
{
$user = UserFactory::create();
$user->first_name = 'Test';
$user->last_name = 'Palloni';
$user->save();
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/users/'.$this->encodePrimaryKey($user->id).'/attachToCompany?include=company_user');
$response->assertStatus(200);
$this->assertNotNull($user->company_user);
$this->assertEquals($user->company_user->company_id, $this->company->id)
}
}