Hello,
You could only retrieve fields from current module with this free plugin
Hello,
You could only retrieve fields from current module with this free plugin
SYNOLIA
Oldest SugarCRM partner in the world and Gold Partner / Partenaire GOLD SugarCRM
Official French Translator / Responsable de la traduction Française
51 Avenue Jean Jaurès - 69007 LYON - FRANCE - Tel : +33 4 27 70 53 70
www.synolia.com | @synolia sur Twitter
www.crm-france.com | Forum CRM-France
I just upgraded from 6.2 to 6.4 and noticed the PDF button stopped appearing.
I did some debugging and found that for some reason SugarView.php is no longer setting the javascript variable "module_sugar_grp1". Also, "action_sugar_grp1" is getting set to something like ajax_ui instead of "DetailView".
I decided I could get the appropriate values from the GET params passed in as a parameter.
All you have to do to make it work in 6.4 is to copy the code snippet below and paste it right under the var addSynoPdfButton=function() { line of: /modules/SYNO_Pdf_templates/js/syno_pdf_template_load.js
Here's the entire /modules/SYNO_Pdf_templates/js/syno_pdf_template_load.js file:Code:var urlParams = {}; (function () { var e, a = /\+/g, // Regex for replacing addition symbol with a space r = /([^&=]+)=?([^&]*)/g, d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, q = window.location.search.substring(1); while (e = r.exec(q)) urlParams[d(e[1])] = d(e[2]); })(); var module_sugar_grp1 = urlParams["module"]; var action_sugar_grp1 = urlParams["action"];
Code:var addSynoPdfButton = function(){ var urlParams = {}; (function () { var e, a = /\+/g, // Regex for replacing addition symbol with a space r = /([^&=]+)=?([^&]*)/g, d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, q = window.location.search.substring(1); while (e = r.exec(q)) urlParams[d(e[1])] = d(e[2]); })(); var module_sugar_grp1 = urlParams["module"]; var action_sugar_grp1 = urlParams["action"]; if(module_sugar_grp1 != null && action_sugar_grp1 != null && action_sugar_grp1 == 'DetailView') { var successAddSynoPdfButton = function(data) { dataResponse = data.responseText; if (dataResponse.length > 0) { var allForms = document.getElementsByTagName('form'); for(i=0; i<allForms.length; i++) { if (allForms[i].getAttribute('name') == 'DetailView') { var trButtons = YAHOO.util.Dom.getAncestorByTagName(allForms[i], 'tr'); var listTd = trButtons.getElementsByTagName('td'); var latestTdButtons = listTd[listTd.length-2]; var tdPDF = document.createElement('td'); tdPDF.setAttribute('class', 'buttons'); tdPDF.setAttribute('nowrap', 'nowrap'); tdPDF.innerHTML = dataResponse; YAHOO.util.Dom.insertAfter(tdPDF, latestTdButtons); break; } } } else { //alert('PAS DE PDF' + dataResponse); } } url = 'index.php?module=SYNO_Pdf_templates&to_pdf=1&action=checkPdfAvailable&base_module=' + module_sugar_grp1 + '&base_id=' + window.document.forms['DetailView'].record.value; var cObj = YAHOO.util.Connect.asyncRequest('GET', url, {success: successAddSynoPdfButton, failure: successAddSynoPdfButton}); } }; var initialisationSynoJS = function(){ addSynoPdfButton(); } YAHOO.util.Event.onDOMReady(initialisationSynoJS);
Sugar 6 Pro, On-Site (Apache 2.0, MySQL 5.1, PHP 5.2.6)
My SugarForge Projects:
Email To Sugar - Archive emails in any mail client by adding a BCC line.
Task Dashlets Plus- Adds custom dashlets for: tasks assigned to me by others, delegated tasks, overdue tasks, and open tasks past start date
www.blakerobertson.com
Is there any Plan to put related fields in PDF?
how to extract data from different modules e.g. Accounts and Contacts in one PDF?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks