Merge pull request #8359 from turbo124/v5-develop

v5.5.88
This commit is contained in:
David Bomba 2023-03-12 16:45:11 +11:00 committed by GitHub
commit 1b5b757a95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 360 additions and 343 deletions

View File

@ -1,65 +0,0 @@
APP_NAME="Invoice Ninja"
APP_ENV=local
APP_KEY=base64:xV0ixUbXIGjeWImmcjCYL8/XespgcEk+dTTPlM17dNE=
APP_DEBUG=true
APP_DOMAIN=ninja.test:8000
APP_URL=http://ninja.test:8000/
#APP_URL=https://ninja.test
DB_CONNECTION=mysql
MULTI_DB_ENABLED=false
DB_HOST1=127.0.0.1
DB_DATABASE1=db-ninja-01
DB_USERNAME1=ninja
DB_PASSWORD1=ninja
DB_PORT1=3306
DB_HOST2=127.0.0.1
DB_DATABASE2=db-ninja-02
DB_USERNAME2=ninja
DB_PASSWORD2=ninja
DB_PORT2=3306
DEMO_MODE=false
LOG_CHANNEL=stack
REQUIRE_HTTPS=false
BROADCAST_DRIVER=pusher
CACHE_DRIVER=redis
QUEUE_CONNECTION=database
SESSION_DRIVER=redis
SESSION_DOMAIN=.ninja.test
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
PUSHER_APP_ID="ninja"
PUSHER_APP_KEY="ninja"
PUSHER_APP_SECRET="ninja"
PUSHER_APP_CLUSTER="ninja1"
MAIL_MAILER=log
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=''
MAIL_FROM_NAME=''
GOOGLE_MAPS_API_KEY=
NINJA_ENVIRONMENT=selfhost
HASH_SALT=
FILESYSTEM_DRIVER=public
PDF_GENERATOR=snappdf
MIX_ASSET_URL=false

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ _ide_helper.php
/resources/assets/bower
/public/logo
.env.dusk.local
.env.cypress
/public/vendors/*
*.log

View File

@ -1 +1 @@
5.5.87
5.5.88

View File

@ -109,6 +109,7 @@ class EmailDefaults
$this->template = $this->email->email_object->settings->email_style;
match ($this->email->email_object->settings->email_style) {
'plain' => $this->template = 'email.template.plain',
'light' => $this->template = 'email.template.client',
'dark' => $this->template = 'email.template.client',
'custom' => $this->template = 'email.template.custom',
@ -272,24 +273,41 @@ class EmailDefaults
$documents = [];
/* Return early if the user cannot attach documents */
if (!$this->email->email_object->settings->document_email_attachment || !$this->email->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
if (!$this->email->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
return $this;
}
/** Purchase Order / Invoice / Credit / Quote PDF */
if ($this->email->email_object->entity instanceof PurchaseOrder) {
if ($this->email->email_object->settings->pdf_email_attachment && $this->email->email_object->entity instanceof PurchaseOrder) {
$pdf = (new CreatePurchaseOrderPdf($this->email->email_object->invitation))->rawPdf();
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
} elseif ($this->email->email_object->settings->pdf_email_attachment &&
($this->email->email_object->entity instanceof Invoice ||
$this->email->email_object->entity instanceof Quote ||
$this->email->email_object->entity instanceof Credit)) {
$pdf = ((new CreateRawPdf($this->email->email_object->invitation, $this->email->company->db))->handle());
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
}
/** UBL xml file */
if ($this->email->email_object->entity instanceof Invoice && $this->email->email_object->settings->ubl_email_attachment) {
$ubl_string = (new CreateUbl($this->email->email_object->entity))->handle();
if ($ubl_string) {
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($ubl_string), 'name' => $this->email->email_object->entity->getFileName('xml')]]);
}
}
if(!$this->email->email_object->settings->document_email_attachment)
return $this;
/* Company Documents */
$this->email->email_object->documents = array_merge($this->email->email_object->documents, $this->email->company->documents->pluck('id')->toArray());
@ -336,15 +354,6 @@ class EmailDefaults
}
}
/** UBL xml file */
if ($this->email->email_object->entity instanceof Invoice && $this->email->email_object->settings->ubl_email_attachment) {
$ubl_string = (new CreateUbl($this->email->email_object->entity))->handle();
if ($ubl_string) {
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($ubl_string), 'name' => $this->email->email_object->entity->getFileName('xml')]]);
}
}
return $this;
}

View File

@ -984,6 +984,10 @@ html {
*/
private function buildViewButton(string $link, string $text): string
{
if($this->settings->email_style == 'plain')
return '<a href="'. $link .'" target="_blank">'. $text .'</a>';
return '
<div>
<!--[if (gte mso 9)|(IE)]>

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.87',
'app_tag' => '5.5.87',
'app_version' => '5.5.88',
'app_tag' => '5.5.88',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -30,8 +30,11 @@ use App\Models\GroupSetting;
use App\Models\ClientContact;
use App\Models\VendorContact;
use App\Models\CompanyGateway;
use App\Models\BankIntegration;
use App\Models\BankTransaction;
use Illuminate\Database\Seeder;
use App\Models\RecurringInvoice;
use App\DataMapper\FeesAndLimits;
use App\DataMapper\ClientSettings;
use App\DataMapper\CompanySettings;
use App\Helpers\Invoice\InvoiceSum;
@ -44,8 +47,6 @@ use App\Repositories\InvoiceRepository;
use Illuminate\Database\Eloquent\Model;
use App\Events\Payment\PaymentWasCreated;
use App\Helpers\Invoice\InvoiceSumInclusive;
use App\Models\BankIntegration;
use App\Models\BankTransaction;
class RandomDataSeeder extends Seeder
{
@ -374,6 +375,13 @@ class RandomDataSeeder extends Seeder
$cg->require_shipping_address = true;
$cg->update_details = true;
$cg->config = encrypt(config('ninja.testvars.stripe'));
$gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new \stdClass;
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
$cg->fees_and_limits = $fees_and_limits;
$cg->save();
$cg = new CompanyGateway;

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
"/js/clients/payments/checkout-credit-card.js": "/js/clients/payments/checkout-credit-card.js?id=4bd34a0b160f6f29b3096d870ac4d308",
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=0af9e4910d17cd5c67ceae955488b950",
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=2cb18f2df99d0eca47fa34f1d652c34f",
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=809de47258a681f0ffebe787dd6a9a93",
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=cdcc94a3abdd08dfd981870eaa9d2a85",
"/js/setup/setup.js": "/js/setup/setup.js?id=27560b012f166f8b9417ced2188aab70",
"/js/clients/payments/card-js.min.js": "/js/clients/payments/card-js.min.js?id=8ce33c3deae058ad314fb8357e5be63b",
"/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=be5307abc990bb44f2f92628103b1d98",

View File

@ -198,6 +198,8 @@ class StripeCreditCard {
document
.getElementById('pay-now')
.addEventListener('click', () => {
try {
let tokenInput = document.querySelector('input[name=token]');
if (tokenInput.value) {
@ -205,6 +207,10 @@ class StripeCreditCard {
}
return this.completePaymentWithoutToken();
}catch(error){
console.log(error.message);
}
});
}
}

View File

@ -2,6 +2,16 @@
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@if(\App\Utils\Ninja::isHosted())
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WMJ5W23');</script>
<!-- End Google Tag Manager -->
@endif
<!-- Error: {{ session('error') }} -->
@if (config('services.analytics.tracking_id'))

View File

@ -0,0 +1,54 @@
describe('Test Invoices', () => {
it('Show Invoice List.', () => {
cy.visit('/client/login');
cy.contains('Client Portal');
cy.get('input[name=email]').type('cypress@example.com');
cy.get('input[name=password]').type('password{enter}');
cy.url().should('include', '/invoices');
cy.get('[dusk="pay-now"]').first().click();
cy.url().should('include', '/invoices/payment');
cy.get('[dusk="pay-now-dropdown"]').first().click();
cy.get('[dusk="pay-with-0"]').first().click();
cy.url().should('include', '/payments/process');
cy.get('input[name=client_address_line_1]').clear().type('5 Wallaby Way');
cy.get('input[name=client_city]').clear().type('Perth');
cy.get('input[name=client_state]').clear().type('WA');
cy.get('#client_country').select("840");
cy.get('input[name=client_shipping_address_line_1]').clear().type('5 Wallaby Way');
cy.get('input[name=client_shipping_city]').clear().type('Perth');
cy.get('input[name=client_shipping_state]').clear().type('WA');
cy.get('#client_country').select("840");
cy.contains('Continue').click();
cy.get('#cardholder-name').type('Cypress Test');
cy.get("iframe").then($iframe => {
const $body = $iframe.contents().find("body");
cy.wrap($body)
.find("input[placeholder='Card number']")
.type("4242424242424242");
cy.wrap($body)
.find("input[placeholder='MM / YY']")
.type("1225");
cy.wrap($body)
.find("input[placeholder='CVC']")
.type("100");
});
cy.get('#pay-now').click();
cy.url().should('include', '/payments');
});
});

View File

@ -26,7 +26,9 @@ before(() => {
cy.artisan("migrate:fresh", {
'--seed': true,
});
cy.seed('RandomDataSeeder');
cy.artisan("db:seed", {
'--class': 'RandomDataSeeder',
});
});
after(() => {

File diff suppressed because it is too large Load Diff