diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 75f6457a404b..43af60b5c726 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -230,12 +230,9 @@ class CompanyController extends BaseController */ $company_token = CreateCompanyToken::dispatchNow($company, auth()->user()); - //todo Need to discuss this with Hillel which is the best representation to return - //when a company is created. Do we send the entire account? Do we only send back the created CompanyUser? $this->entity_transformer = CompanyUserTransformer::class; $this->entity_type = CompanyUser::class; - //return $this->itemResponse($company); $ct = CompanyUser::whereUserId(auth()->user()->id)->whereCompanyId($company->id); return $this->listResponse($ct); diff --git a/app/Http/Middleware/ContactSetDb.php b/app/Http/Middleware/ContactSetDb.php index 881510e60910..78641267938c 100644 --- a/app/Http/Middleware/ContactSetDb.php +++ b/app/Http/Middleware/ContactSetDb.php @@ -34,9 +34,6 @@ class ContactSetDb 'errors' => [] ]; - // we must have a token passed, that matched a token in the db, and multiDB is enabled. - // todo i don't think we can call the DB prior to setting it???? i think this if statement needs to be rethought - //if( $request->header('X-API-TOKEN') && (CompanyToken::whereRaw("BINARY `token`= ?",[$request->header('X-API-TOKEN')])->first()) && config('ninja.db.multi_db_enabled')) if( $request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled')) { diff --git a/app/Http/Middleware/SetDb.php b/app/Http/Middleware/SetDb.php index e96b4378eadd..5a017707294e 100644 --- a/app/Http/Middleware/SetDb.php +++ b/app/Http/Middleware/SetDb.php @@ -33,9 +33,6 @@ class SetDb 'errors' => [] ]; - // we must have a token passed, that matched a token in the db, and multiDB is enabled. - // todo i don't think we can call the DB prior to setting it???? i think this if statement needs to be rethought - //if( $request->header('X-API-TOKEN') && (CompanyToken::whereRaw("BINARY `token`= ?",[$request->header('X-API-TOKEN')])->first()) && config('ninja.db.multi_db_enabled')) if( $request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled')) { diff --git a/app/Jobs/Invoice/UpdateInvoicePayment.php b/app/Jobs/Invoice/UpdateInvoicePayment.php index a53f6d5a8991..fa10d3a22c37 100644 --- a/app/Jobs/Invoice/UpdateInvoicePayment.php +++ b/app/Jobs/Invoice/UpdateInvoicePayment.php @@ -89,7 +89,8 @@ class UpdateInvoicePayment implements ShouldQueue $invoice->updateBalance($invoice->partial*-1); $invoice->clearPartial(); $invoice->setDueDate(); - //todo do we need to mark it as a partial? + $invoice->setStatus(Invoice::STATUS_PARTIAL); + } else { diff --git a/app/Jobs/User/CreateUser.php b/app/Jobs/User/CreateUser.php index 1a636fa9daf5..b79f738370d0 100644 --- a/app/Jobs/User/CreateUser.php +++ b/app/Jobs/User/CreateUser.php @@ -54,12 +54,8 @@ class CreateUser */ public function handle() : ?User { - // $x = mt_rand(1,10000);//todo - - // $email = 'turbo124+'. $x .'@gmail.com'; //todo $user = new User(); - // $user->account_id = $this->account->id; $user->password = bcrypt($this->request['password']); $user->accepted_terms_version = config('ninja.terms_version'); $user->confirmation_code = $this->createDbHash(config('database.default')); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 00a5e4201328..37e41842e1d1 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -359,4 +359,10 @@ class Invoice extends BaseModel $this->due_date = Carbon::now()->addDays(PaymentTerm::find($this->company->settings->payment_terms_id)->num_days); $this->save(); } + + public function setStatus($status) + { + $this->status_id = $status; + $this->save(); + } } \ No newline at end of file