Fixes for invitation resolution

This commit is contained in:
David Bomba 2023-08-17 10:57:06 +10:00
parent 5e955567b1
commit 820ca43020
4 changed files with 17 additions and 7 deletions

View File

@ -122,7 +122,7 @@ class TypeCheck extends Command
$client->save(); $client->save();
}); });
Company::cursor()->each(function ($company) { Company::query()->cursor()->each(function ($company) {
$this->logMessage("Checking company {$company->id}"); $this->logMessage("Checking company {$company->id}");
$company->saveSettings($company->settings, $company); $company->saveSettings($company->settings, $company);
}); });

View File

@ -53,7 +53,7 @@ class QuoteController extends Controller
{ {
/* If the quote is expired, convert the status here */ /* If the quote is expired, convert the status here */
$invitation = $quote->invitations()->where('client_contact_id', auth()->user()->id)->first(); $invitation = $quote->invitations()->where('client_contact_id', auth()->guard('contact')->user()->id)->first();
$data = [ $data = [
'quote' => $quote, 'quote' => $quote,

View File

@ -53,7 +53,7 @@ class SelfUpdateController extends BaseController
nlog('Test filesystem is writable'); nlog('Test filesystem is writable');
// $this->testWritable(); $this->testWritable();
nlog('Clear cache directory'); nlog('Clear cache directory');
@ -61,12 +61,22 @@ class SelfUpdateController extends BaseController
nlog('copying release file'); nlog('copying release file');
if (copy($this->getDownloadUrl(), storage_path("app/{$this->filename}"))) { $file_headers = @get_headers($this->getDownloadUrl());
nlog('Copied file from URL');
} else { if (stripos($file_headers[0], "404 Not Found") >0 || (stripos($file_headers[0], "302 Found") > 0 && stripos($file_headers[7], "404 Not Found") > 0)) {
return response()->json(['message' => 'Download not yet available. Please try again shortly.'], 410); return response()->json(['message' => 'Download not yet available. Please try again shortly.'], 410);
} }
try {
if (copy($this->getDownloadUrl(), storage_path("app/{$this->filename}"))) {
nlog('Copied file from URL');
}
}
catch(\Exception $e) {
nlog($e->getMessage());
return response()->json(['message' => 'File exists on the server, however there was a problem downloading and copying to the local filesystem'], 500);
}
nlog('Finished copying'); nlog('Finished copying');
$file = Storage::disk('local')->path($this->filename); $file = Storage::disk('local')->path($this->filename);

View File

@ -7,13 +7,13 @@ parameters:
- 'app/' - 'app/'
excludePaths: excludePaths:
- 'vendor/' - 'vendor/'
- 'resources/views/*'
- 'app/Jobs/Ninja/*' - 'app/Jobs/Ninja/*'
- 'app/Models/Presenters/*' - 'app/Models/Presenters/*'
- 'app/Console/Commands/*' - 'app/Console/Commands/*'
- 'app/DataMapper/Analytics/*' - 'app/DataMapper/Analytics/*'
- 'app/PaymentDrivers/Authorize/*' - 'app/PaymentDrivers/Authorize/*'
- 'app/Utils/Traits/*' - 'app/Utils/Traits/*'
- 'resources/views/*'
universalObjectCratesClasses: universalObjectCratesClasses:
- App\DataMapper\Tax\RuleInterface - App\DataMapper\Tax\RuleInterface
- App\DataMapper\FeesAndLimits - App\DataMapper\FeesAndLimits