1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00

Merge pull request #4281 from turbo124/v5-develop

Fixes for migration
This commit is contained in:
David Bomba 2020-11-07 21:13:56 +11:00 committed by GitHub
commit a79447d4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 49 deletions

View File

@ -181,11 +181,6 @@ class EmailEntity extends BaseMailerJob implements ShouldQueue
}
}
private function findReminderTemplate()
{
}
private function resolveEmailBuilder()
{
$class = 'App\Mail\Engine\\' . ucfirst(Str::camel($this->entity_string)) . "EmailEngine";

View File

@ -214,14 +214,18 @@ class SendReminders implements ShouldQueue
$invoice->invitations->each(function ($invitation) use($template, $invoice){
//only send if enable_reminder setting is toggled to yes
if($this->checkSendSetting($invoice, $template))
EmailEntity::dispatch($invitation, $invitation->company, $template);
if($this->checkSendSetting($invoice, $template)) {
EmailEntity::dispatchNow($invitation, $invitation->company, $template);
event(new InvoiceWasEmailed($invitation, $invoice->company, Ninja::eventVars()));
}
});
if ($invoice->invitations->count() > 0)
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars()));
$invoice->last_sent_date = now();
$invoice->next_send_date = $this->calculateNextSendDate($invoice);

View File

@ -261,7 +261,7 @@ class Import implements ShouldQueue
$company_repository = new CompanyRepository();
$company_repository->save($data, $this->company);
if(isset($data['settings']->company_logo)) {
if(isset($data['settings']->company_logo) && strlen($data['settings']->company_logo) > 0) {
$tempImage = tempnam(sys_get_temp_dir(), basename($data['settings']->company_logo));
copy($data['settings']->company_logo, $tempImage);

View File

@ -11,6 +11,7 @@
namespace App\Mail\Engine;
use App\DataMapper\EmailTemplateDefaults;
use App\Utils\HtmlEngine;
use App\Utils\Number;
@ -43,8 +44,10 @@ class InvoiceEmailEngine extends BaseEmailEngine
if(is_array($this->template_data) && array_key_exists('body', $this->template_data) && strlen($this->template_data['body']) > 0)
$body_template = $this->template_data['body'];
else
$body_template = $this->client->getSetting('email_template_'.$this->reminder_template);
else{
//$body_template = $this->client->getSetting('email_template_'.$this->reminder_template);
$body_template = EmailTemplateDefaults::getDefaultTemplate($this->client->getSetting('email_template_'.$this->reminder_template), $this->client->locale());
}
/* Use default translations if a custom message has not been set*/
if (iconv_strlen($body_template) == 0) {
@ -62,8 +65,10 @@ class InvoiceEmailEngine extends BaseEmailEngine
if(is_array($this->template_data) && array_key_exists('subject', $this->template_data) && strlen($this->template_data['subject']) > 0)
$subject_template = $this->template_data['subject'];
else
$subject_template = $this->client->getSetting('email_subject_'.$this->reminder_template);
else{
$subject_template = EmailTemplateDefaults::getDefaultTemplate($this->client->getSetting('email_subject_'.$this->reminder_template), $this->client->locale());
// $subject_template = $this->client->getSetting('email_subject_'.$this->reminder_template);
}
if (iconv_strlen($subject_template) == 0) {

View File

@ -84,38 +84,6 @@ class MigrationTest extends TestCase
$this->assertEquals($co->count(), 1);
$this->assertEquals($inv->count(), 1);
// DB::statement( 'DELETE FROM `clients` WHERE `company_id`=:company_id', array('company_id' => $this->company->id) );
// $co = Client::whereCompanyId($this->company->id)->get();
// $inv = Invoice::whereCompanyId($this->company->id)->get();
// $this->assertEquals($co->count(),0);
// $this->assertEquals($inv->count(),0);
// $this->assertNotNull($this->company);
// $this->assertNotNull($this->company->settings);
// $this->assertNotNull($this->company->settings->timezone_id);
}
// public function testMigrationFileUpload()
// {
// $file = new UploadedFile(base_path('tests/Unit/Migration/migration.zip'), 'migration.zip');
// $data = [
// 'migration' => $file,
// 'force' => true,
// ];
// $token = $this->company->tokens->first()->token;
// $response = $this->withHeaders([
// 'X-API-TOKEN' => $token,
// 'X-API-SECRET' => config('ninja.api_secret'),
// 'X-Requested-With' => 'XMLHttpRequest',
// 'X-API-PASSWORD' => 'ALongAndBriliantPassword',
// ])->post('/api/v1/migration/start', $data);
// $response->assertStatus(200);
// $this->assertTrue(file_exists(base_path('storage/migrations/migration/migration.json')));
// }
}

View File

@ -65638,7 +65638,7 @@
"accepted_credit_cards": 0,
"require_cvv": 1,
"require_billing_address": null,
"show_shipping_address": 0,
"require_shipping_address": 0,
"update_details": null,
"config": "{\"apiKey\":\"345345345\",\"publishableKey\":\"5435345\",\"plaidClientId\":\"\",\"plaidSecret\":\"\",\"plaidPublicKey\":\"\",\"enableAlipay\":false,\"enableSofort\":false,\"enableSepa\":false,\"enableBitcoin\":false,\"enableApplePay\":false,\"enableAch\":false}",
"fees_and_limits": {
@ -65667,7 +65667,7 @@
"accepted_credit_cards": 0,
"require_cvv": 1,
"require_billing_address": null,
"show_shipping_address": 0,
"require_shipping_address": 0,
"update_details": null,
"config": "{\"apiKey\":\"345345345\",\"publishableKey\":\"5435345\",\"plaidClientId\":\"\",\"plaidSecret\":\"\",\"plaidPublicKey\":\"\",\"enableAlipay\":false,\"enableSofort\":false,\"enableSepa\":false,\"enableBitcoin\":false,\"enableApplePay\":false,\"enableAch\":false}",
"fees_and_limits": {},