mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Cast to string - default_gateway_type_id (#3105)
* fixes for template controller * Default gateway as string
This commit is contained in:
parent
4391ad087c
commit
bf41c634c0
@ -70,7 +70,7 @@ class TemplateController extends BaseController
|
|||||||
public function create($entity)
|
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();
|
$entity_obj = $class::find($entity_id)->company();
|
||||||
|
|
||||||
$subject = request()->input('subject');
|
$subject = request()->input('subject');
|
||||||
$body = ;
|
$body = request()->input('body');
|
||||||
|
|
||||||
$body = Parsedown::instance()->text(request()->input('body'));
|
$body = Parsedown::instance()->text(request()->input('body'));
|
||||||
$subject = Parsedown::instance()->text(request()->input('subject'));
|
$subject = Parsedown::instance()->text(request()->input('subject'));
|
||||||
|
|
||||||
return response()->json($body, 200);
|
return response()->json($body, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class QueryLogging
|
|||||||
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
||||||
|
|
||||||
// if($count > 50)
|
// if($count > 50)
|
||||||
Log::info($queries);
|
// Log::info($queries);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ class CompanyUser extends Pivot
|
|||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
'created_at' => 'timestamp',
|
'created_at' => 'timestamp',
|
||||||
'deleted_at' => 'timestamp',
|
'deleted_at' => 'timestamp',
|
||||||
|
'settings' => 'object',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
@ -29,7 +29,7 @@ class ActivityTransformer extends EntityTransformer
|
|||||||
'activity_type_id' => (string) $activity->activity_type_id,
|
'activity_type_id' => (string) $activity->activity_type_id,
|
||||||
'client_id' => $activity->client ? (string) $this->encodePrimaryKey($activity->client->id) : '',
|
'client_id' => $activity->client ? (string) $this->encodePrimaryKey($activity->client->id) : '',
|
||||||
'company_id' => $activity->company ? (string) $this->encodePrimaryKey($activity->company->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) : '',
|
'invoice_id' => $activity->invoice ? (string) $this->encodePrimaryKey($activity->invoice->id) : '',
|
||||||
'payment_id' => $activity->payment ? (string) $this->encodePrimaryKey($activity->payment->id) : '',
|
'payment_id' => $activity->payment ? (string) $this->encodePrimaryKey($activity->payment->id) : '',
|
||||||
'credit_id' => $activity->credit ? (string) $this->encodePrimaryKey($activity->credit->id) : '',
|
'credit_id' => $activity->credit ? (string) $this->encodePrimaryKey($activity->credit->id) : '',
|
||||||
|
@ -45,7 +45,7 @@ class GatewayTransformer extends EntityTransformer
|
|||||||
'provider' => (string)$gateway->provider ?: '',
|
'provider' => (string)$gateway->provider ?: '',
|
||||||
'visible' => (bool)$gateway->visible,
|
'visible' => (bool)$gateway->visible,
|
||||||
'sort_order' => (int)$gateway->sort_order,
|
'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 ?: '',
|
'site_url' => (string)$gateway->site_url ?: '',
|
||||||
'is_offsite' => (bool)$gateway->is_offsite,
|
'is_offsite' => (bool)$gateway->is_offsite,
|
||||||
'is_secure' => (bool)$gateway->is_secure,
|
'is_secure' => (bool)$gateway->is_secure,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace Tests\Feature;
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Factory\UserFactory;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
use App\Models\Company;
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user