mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
0744503b90
@ -85,6 +85,10 @@ class StoreClientRequest extends Request
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
//is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!!
|
||||
if (!property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) {
|
||||
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
|
||||
|
@ -92,6 +92,10 @@ class UpdateClientRequest extends Request
|
||||
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
if (isset($input['contacts'])) {
|
||||
foreach ($input['contacts'] as $key => $contact) {
|
||||
if (array_key_exists('id', $contact) && is_numeric($contact['id'])) {
|
||||
|
@ -58,6 +58,10 @@ class StoreCreditRequest extends FormRequest
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
if (isset($input['client_contacts'])) {
|
||||
foreach ($input['client_contacts'] as $key => $contact) {
|
||||
if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) {
|
||||
|
@ -58,6 +58,10 @@ class UpdateCreditRequest extends FormRequest
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
if (isset($input['invitations'])) {
|
||||
foreach ($input['invitations'] as $key => $value) {
|
||||
if (is_numeric($input['invitations'][$key]['id'])) {
|
||||
|
@ -46,6 +46,10 @@ class StorePaymentRequest extends Request
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
if (isset($input['invoices']) && is_array($input['invoices']) !== false) {
|
||||
foreach ($input['invoices'] as $key => $value) {
|
||||
$input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($value['invoice_id']);
|
||||
|
@ -60,6 +60,10 @@ class UpdatePaymentRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
if (isset($input['client_id'])) {
|
||||
unset($input['client_id']);
|
||||
}
|
||||
|
@ -56,6 +56,10 @@ class StoreProductRequest extends Request
|
||||
$input['quantity'] = 1;
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,10 @@ class UpdateProductRequest extends Request
|
||||
$input['quantity'] = 1;
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ class StoreQuoteRequest extends Request
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
if (isset($input['client_contacts'])) {
|
||||
foreach ($input['client_contacts'] as $key => $contact) {
|
||||
if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) {
|
||||
|
@ -69,6 +69,10 @@ class UpdateQuoteRequest extends Request
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,11 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
//$input['line_items'] = json_encode($input['line_items']);
|
||||
$this->replace($input);
|
||||
|
@ -45,6 +45,10 @@ class UpdateRecurringInvoiceRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
//$input['line_items'] = json_encode($input['line_items']);
|
||||
$this->replace($input);
|
||||
|
@ -48,6 +48,10 @@ class StoreRecurringQuoteRequest extends Request
|
||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||
}
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
//$input['line_items'] = json_encode($input['line_items']);
|
||||
$this->replace($input);
|
||||
|
@ -45,7 +45,13 @@ class UpdateRecurringQuoteRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ class Payment extends BaseModel
|
||||
const TYPE_TOKEN = 'token';
|
||||
|
||||
protected $fillable = [
|
||||
'assigned_user_id',
|
||||
'client_id',
|
||||
'type_id',
|
||||
'amount',
|
||||
|
@ -3,8 +3,6 @@
|
||||
* Signup Routes
|
||||
*/
|
||||
|
||||
use Omnipay\Omnipay;
|
||||
|
||||
Route::get('/', 'BaseController@flutterRoute')->middleware('guest');
|
||||
Route::get('setup', 'SetupController@index')->middleware('guest');
|
||||
Route::post('setup/check_db', 'SetupController@checkDB')->middleware('guest');
|
||||
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Jobs\Account\CreateAccount;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\User;
|
||||
use App\Utils\Traits\UserSessionAttributes;
|
||||
use Faker\Factory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers App\Http\Controllers\AccountController
|
||||
*/
|
||||
|
||||
class AccountTest extends TestCase
|
||||
{
|
||||
//use DatabaseTransactions;
|
||||
|
||||
public function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Session::start();
|
||||
|
||||
$this->faker = \Faker\Factory::create();
|
||||
|
||||
Model::reguard();
|
||||
|
||||
if (config('ninja.testvars.travis') !== false) {
|
||||
$this->markTestSkipped('Skip test for CI Testing');
|
||||
}
|
||||
}
|
||||
|
||||
public function testApiAccountCreation()
|
||||
{
|
||||
|
||||
Account::all()->each(function($account) {
|
||||
$account->delete();
|
||||
});
|
||||
|
||||
|
||||
$data = [
|
||||
'first_name' => $this->faker->firstName,
|
||||
'last_name' => $this->faker->lastName,
|
||||
'name' => $this->faker->company,
|
||||
'email' => $this->faker->unique()->safeEmail,
|
||||
'password' => 'ALongAndBrilliantPassword123',
|
||||
'privacy_policy' => 1,
|
||||
'terms_of_service' => 1
|
||||
];
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
])->post('/api/v1/signup?include=account', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
@ -33,7 +33,8 @@ use Tests\TestCase;
|
||||
class InvitationTest extends TestCase
|
||||
{
|
||||
use MakesHash;
|
||||
use DatabaseTransactions;
|
||||
//use DatabaseTransactions;
|
||||
//use RefreshDatabase;
|
||||
|
||||
public function setUp() :void
|
||||
{
|
||||
@ -56,11 +57,15 @@ class InvitationTest extends TestCase
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default'))
|
||||
]);
|
||||
$user = User::where('email', 'user@example.com')->first();
|
||||
|
||||
if(!$user)
|
||||
{
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default'))
|
||||
]);
|
||||
}
|
||||
|
||||
$userPermissions = collect([
|
||||
'view_invoice',
|
||||
|
@ -32,11 +32,13 @@ class RecurringInvoicesCronTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
RecurringInvoice::truncate();
|
||||
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
public function testCountCorrectNumberOfRecurringInvoicesDue()
|
||||
{
|
||||
{
|
||||
//spin up 5 valid and 1 invalid recurring invoices
|
||||
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', Carbon::now()->addMinutes(30))->get();
|
||||
|
||||
|
@ -18,6 +18,8 @@ use Tests\TestCase;
|
||||
*/
|
||||
class UniqueEmailTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected $rule;
|
||||
|
||||
public function setUp() :void
|
||||
@ -73,8 +75,15 @@ class UniqueEmailTest extends TestCase
|
||||
'account_id' => $account2->id,
|
||||
];
|
||||
|
||||
User::on('db-ninja-01')->create($user);
|
||||
User::on('db-ninja-02')->create($user2);
|
||||
$user_find = User::on('db-ninja-01')->where('email', 'user@example.com')->first();
|
||||
|
||||
if(!$user_find)
|
||||
User::on('db-ninja-01')->create($user);
|
||||
|
||||
$user_find = User::on('db-ninja-02')->where('email', 'user@example.com')->first();
|
||||
|
||||
if(!$user_find)
|
||||
User::on('db-ninja-02')->create($user2);
|
||||
}
|
||||
|
||||
public function test_unique_emails_detected_on_database()
|
||||
|
Loading…
x
Reference in New Issue
Block a user