Fixes for entity images

This commit is contained in:
David Bomba 2023-10-10 21:00:38 +11:00
parent e17029223c
commit e5997128d6
4 changed files with 22 additions and 5 deletions

View File

@ -63,11 +63,18 @@ class CreateAccount extends Command
private function createAccount()
{
$settings = CompanySettings::defaults();
$settings->name = "Untitled Company";
$settings->currency_id = '1';
$settings->language_id = '1';
$account = Account::factory()->create();
$company = Company::factory()->create([
'account_id' => $account->id,
'portal_domain' => config('ninja.app_url'),
'portal_mode' => 'domain',
'settings' => $settings,
]);
$company->client_registration_fields = ClientRegistrationFields::generate();

View File

@ -841,6 +841,8 @@ class CompanySettings extends BaseSettings
{
$notification = new stdClass;
$notification->email = [];
$notification->email = ['invoice_sent_all'];
// $notification->email = ['all_notifications'];
return $notification;

View File

@ -1013,9 +1013,9 @@ html {
*/
protected function generateEntityImagesMarkup()
{
if ($this->client->getSetting('embed_documents') === false) {
return '';
}
// if ($this->client->getSetting('embed_documents') === false) {
// return '';
// }
$dom = new \DOMDocument('1.0', 'UTF-8');
@ -1029,7 +1029,7 @@ html {
$image = $dom->createElement('img');
$image->setAttribute('src', $document->generateUrl());
$image->setAttribute('src', "data:image/png;base64,".base64_encode($document->getFile()));
$image->setAttribute('style', 'max-height: 100px; margin-top: 20px;');
$container->appendChild($image);
@ -1040,6 +1040,8 @@ html {
$html = $dom->saveHTML();
$dom = null;
nlog($html);
return $html;
}

View File

@ -89,10 +89,16 @@ class RandomDataSeeder extends Seeder
Model::unguard();
$faker = \Faker\Factory::create();
$settings= CompanySettings::defaults();
$settings->name = "Random Test Company";
$settings->currency_id = '1';
$settings->language_id = '1';
$account = Account::factory()->create();
$company = Company::factory()->create([
'account_id' => $account->id,
'settings' => $settings,
]);
$account->default_company_id = $company->id;