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

Fix for dev channel Chrome crash

This commit is contained in:
Hillel Coren 2015-12-29 12:23:50 +02:00
parent 15ec7ce5b5
commit 6d6f8f5cab
7 changed files with 16 additions and 30 deletions

View File

@ -14,7 +14,7 @@ class AddInvoiceDesignTable extends Migration {
{
Schema::table('invoice_designs', function($table)
{
$table->text('javascript')->nullable();
$table->mediumText('javascript')->nullable();
});
Schema::table('accounts', function($table)

View File

@ -14,7 +14,7 @@ class AddPdfmakeSupport extends Migration {
{
Schema::table('invoice_designs', function($table)
{
$table->text('pdfmake')->nullable();
$table->mediumText('pdfmake')->nullable();
});
}

View File

@ -29885,15 +29885,13 @@ var isChrome = !!window.chrome && !isOpera && !isEdge; // Chrome 1+
var isChromium = isChrome && navigator.userAgent.indexOf('Chromium') >= 0;
var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
var pdfDoc;
var invoiceOld;
var refreshTimer;
function generatePDF(invoice, javascript, force, cb) {
if (!invoice || !javascript) {
return;
}
//console.log('== generatePDF - force: %s', force);
if (force || !invoiceOld) {
if (force) {
refreshTimer = null;
} else {
if (refreshTimer) {
@ -29902,17 +29900,11 @@ function generatePDF(invoice, javascript, force, cb) {
refreshTimer = setTimeout(function() {
generatePDF(invoice, javascript, true, cb);
}, 500);
return pdfDoc;
return;
}
invoice = calculateAmounts(invoice);
var a = copyObject(invoice);
var b = copyObject(invoiceOld);
if (_.isEqual(a, b)) {
return pdfDoc;
}
invoiceOld = invoice;
pdfDoc = GetPdfMake(invoice, javascript, cb);
var pdfDoc = GetPdfMake(invoice, javascript, cb);
if (cb) {
pdfDoc.getDataUrl(cb);

View File

@ -7,15 +7,13 @@ var isChrome = !!window.chrome && !isOpera && !isEdge; // Chrome 1+
var isChromium = isChrome && navigator.userAgent.indexOf('Chromium') >= 0;
var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
var pdfDoc;
var invoiceOld;
var refreshTimer;
function generatePDF(invoice, javascript, force, cb) {
if (!invoice || !javascript) {
return;
}
//console.log('== generatePDF - force: %s', force);
if (force || !invoiceOld) {
if (force) {
refreshTimer = null;
} else {
if (refreshTimer) {
@ -24,17 +22,11 @@ function generatePDF(invoice, javascript, force, cb) {
refreshTimer = setTimeout(function() {
generatePDF(invoice, javascript, true, cb);
}, 500);
return pdfDoc;
return;
}
invoice = calculateAmounts(invoice);
var a = copyObject(invoice);
var b = copyObject(invoiceOld);
if (_.isEqual(a, b)) {
return pdfDoc;
}
invoiceOld = invoice;
pdfDoc = GetPdfMake(invoice, javascript, cb);
var pdfDoc = GetPdfMake(invoice, javascript, cb);
if (cb) {
pdfDoc.getDataUrl(cb);

View File

@ -735,11 +735,12 @@
$('.client-input').val(getClientDisplayName(selected));
// if there's an invoice number pattern we'll apply it now
setInvoiceNumber(selected);
refreshPDF(true);
} else if (oldId) {
model.loadClient($.parseJSON(ko.toJSON(new ClientModel())));
model.invoice().client().country = false;
}
refreshPDF(true);
}
});
// If no clients exists show the client form when clicking on the client select input
@ -841,6 +842,7 @@
}
@endif
model.product_key(key);
onItemChange();
break;
}
}

View File

@ -128,7 +128,7 @@ function ViewModel(data) {
var email = $("[name='client[contacts][0][email]']").val();
var firstName = $("[name='client[contacts][0][first_name]']").val();
var lastName = $("[name='client[contacts][0][last_name]']").val();
var name = $('#name').val();
var name = $("[name='client[name]']").val();
if (name) {
//
@ -141,7 +141,7 @@ function ViewModel(data) {
var isValid = true;
$('input.client-email').each(function(item, value) {
var email = $(value).val();
if (!name && (!email || !isValidEmailAddress(email))) {
if (!first_name && (!email || !isValidEmailAddress(email))) {
isValid = false;
}
});

View File

@ -9,7 +9,7 @@
},
{
"stack": "$clientDetails",
"margin": [260, 80, 0, 0]
"margin": [0, 80, 0, 0]
}
]
},