mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Checks for missing props
This commit is contained in:
parent
f5dfb69776
commit
4e77b1072c
@ -11,13 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Exceptions\FilePermissionsFailure;
|
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Utils\Traits\AppSetup;
|
use App\Utils\Traits\AppSetup;
|
||||||
use App\Utils\Traits\ClientGroupSettingsSaver;
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use App\Exceptions\FilePermissionsFailure;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use App\Utils\Traits\ClientGroupSettingsSaver;
|
||||||
|
|
||||||
class SelfUpdateController extends BaseController
|
class SelfUpdateController extends BaseController
|
||||||
{
|
{
|
||||||
@ -109,11 +110,33 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
$this->buildCache(true);
|
$this->buildCache(true);
|
||||||
|
|
||||||
|
$this->runModelChecks();
|
||||||
|
|
||||||
nlog('Called Artisan commands');
|
nlog('Called Artisan commands');
|
||||||
|
|
||||||
return response()->json(['message' => 'Update completed'], 200);
|
return response()->json(['message' => 'Update completed'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function runModelChecks()
|
||||||
|
{
|
||||||
|
Company::query()
|
||||||
|
->cursor()
|
||||||
|
->each(function ($company){
|
||||||
|
|
||||||
|
$settings = $company->settings;
|
||||||
|
|
||||||
|
if(property_exists($settings->pdf_variables, 'purchase_order_details'))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$pdf_variables = $settings->pdf_variables;
|
||||||
|
$pdf_variables->purchase_order_details = [];
|
||||||
|
$settings->pdf_variables = $pdf_variables;
|
||||||
|
$company->settings = $settings;
|
||||||
|
$company->save();
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private function clearCacheDir()
|
private function clearCacheDir()
|
||||||
{
|
{
|
||||||
$directoryIterator = new \RecursiveDirectoryIterator(base_path('bootstrap/cache'), \RecursiveDirectoryIterator::SKIP_DOTS);
|
$directoryIterator = new \RecursiveDirectoryIterator(base_path('bootstrap/cache'), \RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
|
@ -195,15 +195,15 @@ class PdfSlot extends Component
|
|||||||
|
|
||||||
}
|
}
|
||||||
elseif($this->entity_type == 'quote'){
|
elseif($this->entity_type == 'quote'){
|
||||||
foreach($this->settings->pdf_variables->quote_details as $variable)
|
foreach($this->settings->pdf_variables->quote_details ?? [] as $variable)
|
||||||
$entity_details .= "<div class='flex px-5 block'><p class= w-36 block'>{$variable}_label</p><p class='pl-5 w-36 block entity-field'>{$variable}</p></div>";
|
$entity_details .= "<div class='flex px-5 block'><p class= w-36 block'>{$variable}_label</p><p class='pl-5 w-36 block entity-field'>{$variable}</p></div>";
|
||||||
}
|
}
|
||||||
elseif($this->entity_type == 'credit') {
|
elseif($this->entity_type == 'credit') {
|
||||||
foreach($this->settings->pdf_variables->credit_details as $variable)
|
foreach($this->settings->pdf_variables->credit_details ?? [] as $variable)
|
||||||
$entity_details .= "<div class='flex px-5 block'><p class= w-36 block'>{$variable}_label</p><p class='pl-5 w-36 block entity-field'>{$variable}</p></div>";
|
$entity_details .= "<div class='flex px-5 block'><p class= w-36 block'>{$variable}_label</p><p class='pl-5 w-36 block entity-field'>{$variable}</p></div>";
|
||||||
}
|
}
|
||||||
elseif($this->entity_type == 'purchase_order'){
|
elseif($this->entity_type == 'purchase_order'){
|
||||||
foreach($this->settings->pdf_variables->purchase_order_details as $variable)
|
foreach($this->settings->pdf_variables->purchase_order_details ?? [] as $variable)
|
||||||
$entity_details .= "<div class='flex px-5 block'><p class= w-36 block'>{$variable}_label</p><p class='pl-5 w-36 block entity-field'>{$variable}</p></div>";
|
$entity_details .= "<div class='flex px-5 block'><p class= w-36 block'>{$variable}_label</p><p class='pl-5 w-36 block entity-field'>{$variable}</p></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user