From 658615016b75cfbfdcb8926be905206e60daaf13 Mon Sep 17 00:00:00 2001 From: yashodha Date: Fri, 12 Jun 2015 15:34:01 +0530 Subject: [PATCH] CRM-16661 : Custom PDF page format margin bug ---------------------------------------- * CRM-16661: Custom PDF page format margin bug https://issues.civicrm.org/jira/browse/CRM-16661 --- .../CRM/Contact/Form/Task/PDFLetterCommon.tpl | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/templates/CRM/Contact/Form/Task/PDFLetterCommon.tpl b/templates/CRM/Contact/Form/Task/PDFLetterCommon.tpl index 44a9545e01..b4be3b2407 100644 --- a/templates/CRM/Contact/Form/Task/PDFLetterCommon.tpl +++ b/templates/CRM/Contact/Form/Task/PDFLetterCommon.tpl @@ -175,28 +175,35 @@ function updateFormatLabel() { updateFormatLabel(); -function selectFormat( val, bind ) -{ +function fillFormatInfo( data, bind ) { + cj("#format_id").val( data.id ); + cj("#paper_size").val( data.paper_size ); + cj("#orientation").val( data.orientation ); + cj("#metric").val( data.metric ); + cj("#margin_top").val( data.margin_top ); + cj("#margin_bottom").val( data.margin_bottom ); + cj("#margin_left").val( data.margin_left ); + cj("#margin_right").val( data.margin_right ); + selectPaper( data.paper_size ); + cj("#update_format").prop({checked: false}).parent().hide(); + document.getElementById('bind_format').checked = bind; + showBindFormatChkBox(); +} + +function selectFormat( val, bind ) { updateFormatLabel(); - if (!val) { - val = 0; - bind = false; - } + if (!val) { + val = 0; + bind = false; var dataUrl = {/literal}"{crmURL p='civicrm/ajax/pdfFormat' h=0 }"{literal}; cj.post( dataUrl, {formatId: val}, function( data ) { - cj("#format_id").val( data.id ); - cj("#paper_size").val( data.paper_size ); - cj("#orientation").val( data.orientation ); - cj("#metric").val( data.metric ); - cj("#margin_top").val( data.margin_top ); - cj("#margin_bottom").val( data.margin_bottom ); - cj("#margin_left").val( data.margin_left ); - cj("#margin_right").val( data.margin_right ); - selectPaper( data.paper_size ); - cj("#update_format").prop({checked: false}).parent().hide(); - document.getElementById('bind_format').checked = bind; - showBindFormatChkBox(); - }, 'json'); + fillFormatInfo(data, bind); + }, 'json'); + } + else { + data=JSON.parse(val); + fillFormatInfo(data, bind); + } } function selectPaper( val ) -- 2.25.1