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

Fix for branding logo with custom designs

This commit is contained in:
Hillel Coren 2016-07-14 22:58:26 +03:00
parent 8590f9ad17
commit d2d70eb12a
2 changed files with 36 additions and 20 deletions

View File

@ -31118,23 +31118,31 @@ function GetPdfMake(invoice, javascript, callback) {
return val; return val;
} }
// Add ninja logo to the footer // Add ninja logo to the footer
var dd = JSON.parse(javascript, jsonCallBack); var dd = JSON.parse(javascript, jsonCallBack);
var designId = invoice.invoice_design_id; var designId = invoice.invoice_design_id;
if (!invoice.features.remove_created_by) { if (!invoice.features.remove_created_by) {
var footer = (typeof dd.footer === 'function') ? dd.footer() : dd.footer; var footer = (typeof dd.footer === 'function') ? dd.footer() : dd.footer;
if (footer) { if (footer) {
if (designId == NINJA.TEMPLATES.ELEGANT) { if (footer.hasOwnProperty('columns')) {
footer[0].columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, -20, 20, 0]})
} else if (designId == NINJA.TEMPLATES.PLAYFUL) {
footer.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 10, 10]})
} else if (designId == NINJA.TEMPLATES.BOLD) {
footer[1].columns.push({image: logoImages.imageLogo2, alignment: 'right', width: 130, margin: [0, -20, 20, 0]})
} else if (designId == NINJA.TEMPLATES.MODERN) {
footer[1].columns[0].stack.push({image: logoImages.imageLogo3, alignment: 'left', width: 130, margin: [40, 6, 0, 0]});
} else {
footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 0, 0]}) footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 0, 0]})
} else {
var foundColumns;
for (var i=0; i<footer.length; i++) {
var item = footer[i];
if (item.hasOwnProperty('columns')) {
foundColumns = true;
var columns = item.columns;
if (columns[0].hasOwnProperty('stack')) {
columns[0].stack.push({image: logoImages.imageLogo3, alignment: 'left', width: 130, margin: [40, 6, 0, 0]});
} else {
columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, -20, 20, 0]})
}
}
}
if (!foundColumns) {
footer.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 10, 10]})
}
} }
} }
} }

View File

@ -82,23 +82,31 @@ function GetPdfMake(invoice, javascript, callback) {
return val; return val;
} }
// Add ninja logo to the footer // Add ninja logo to the footer
var dd = JSON.parse(javascript, jsonCallBack); var dd = JSON.parse(javascript, jsonCallBack);
var designId = invoice.invoice_design_id; var designId = invoice.invoice_design_id;
if (!invoice.features.remove_created_by) { if (!invoice.features.remove_created_by) {
var footer = (typeof dd.footer === 'function') ? dd.footer() : dd.footer; var footer = (typeof dd.footer === 'function') ? dd.footer() : dd.footer;
if (footer) { if (footer) {
if (designId == NINJA.TEMPLATES.ELEGANT) { if (footer.hasOwnProperty('columns')) {
footer[0].columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, -20, 20, 0]})
} else if (designId == NINJA.TEMPLATES.PLAYFUL) {
footer.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 10, 10]})
} else if (designId == NINJA.TEMPLATES.BOLD) {
footer[1].columns.push({image: logoImages.imageLogo2, alignment: 'right', width: 130, margin: [0, -20, 20, 0]})
} else if (designId == NINJA.TEMPLATES.MODERN) {
footer[1].columns[0].stack.push({image: logoImages.imageLogo3, alignment: 'left', width: 130, margin: [40, 6, 0, 0]});
} else {
footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 0, 0]}) footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 0, 0]})
} else {
var foundColumns;
for (var i=0; i<footer.length; i++) {
var item = footer[i];
if (item.hasOwnProperty('columns')) {
foundColumns = true;
var columns = item.columns;
if (columns[0].hasOwnProperty('stack')) {
columns[0].stack.push({image: logoImages.imageLogo3, alignment: 'left', width: 130, margin: [40, 6, 0, 0]});
} else {
columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, -20, 20, 0]})
}
}
}
if (!foundColumns) {
footer.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 10, 10]})
}
} }
} }
} }