Printer PDF advice needed

Hi all,

I’m building a custom module on 7.10.6 and adding a Print PDF button, I’ve done this using theinstructions I found here

The button shows as expected but it doesn’t do anything, no errors, no nothing.

I assume at this point it relates to a mistake I’ve made in the view.details.php but I’m not experienced enough to say…

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');


class RemedialsViewDetail extends ViewDetail{

        function RemedialsViewDetail(){

        function display(){

        function populateInvoiceTemplates(){
        global $app_list_strings;
        $sql = "SELECT id, name FROM aos_pdf_templates WHERE deleted = 0 AND type='remedials' AND active = 1";

                $res = $this->bean->db->query($sql);
        $app_list_strings['template_ddown_c_list'] = array();
                while($row = $this->bean->db->fetchByAssoc($res)){
                        $app_list_strings['template_ddown_c_list'][$row['id']] = $row['name'];

Could someone point me in the right direction? Anything to check? My module is called Remedials although on the database and install path its remed_Remedials. I’m not sure which to use in some instances.


Are you looking at php_errors.log? Or whatever your web server log is calle.d You should have a PHP error there.

find / -name php_errors.log 2>/dev/null

If that doesn’t give you anything, look in your Apache configuration file to determine where it is, and what it is called.

Hi pgr, I’ve enabled the logging and still nothing.

It’s like the button doesn’t action trigger the function

Did you remember to do the Quick Repair and Rebuild?


I’ve made a little progress; I copied the view.detail.php from another module and now the button sort of works.

It prompts me to select a template; which I have setup; but then I get an Invalid Module error on a white page.

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, see or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".


class remed_RemedialsViewDetail extends ViewDetail {

        function __construct(){

     * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
    function remed_RemedialsViewDetail(){
        $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
        if(isset($GLOBALS['log'])) {
        else {
            trigger_error($deprecatedMessage, E_USER_DEPRECATED);

         * display
         * Override the display method to support customization for the buttons that display
         * a popup and allow you to copy the account's address into the selected contacts.
         * The custom_code_billing and custom_code_shipping Smarty variables are found in
         * include/SugarFields/Fields/Address/DetailView.tpl (default).  If it's a English U.S.
         * locale then it'll use file include/SugarFields/Fields/Address/en_us.DetailView.tpl.
        function display(){

                        global $app_strings;



                if(ACLController::checkAccess('Contacts', 'edit', true)) {
                        $push_billing = $this->generatePushCode('billing');
                        $push_shipping = $this->generatePushCode('shipping');
                } else {
                        $push_billing = '';
                        $push_shipping = '';

                $this->ss->assign("custom_code_billing", $push_billing);
                $this->ss->assign("custom_code_shipping", $push_shipping);

                        global $app_strings;
                echo $this->dv->display();

        function generatePushCode($param)
            global $mod_strings;
            $address_fields = array('street', 'city', 'state', 'postalcode','country');

    //        $html = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] .
                     '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' .
                     $this->bean->name . '&html=change_address';

            foreach ($address_fields as $value) {
                $field_name = $param.'_address_'.$value;
     //           $html .= '&primary_address_'.$value.'='.str_replace(array("\rn", "\r", "\n"), array('','','<br>'), urlencode($this->bean->$field_name)) ;

          //  $html .= '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE']. '">';
          //  return $html;

so it looks like it stopping when it hits this bit of code in

    sugar_die("Invalid Module");

in AOS_PDF_Templates/formLetterPdf.php

Why wouldn’t it pass the module name to $bean? I’m not a developer so these things take a little bit longer for me!


I would find it very strange if your PHP error log was empty. Normally there are plenty of messages there.

If you add this line to your code

$kaboom = 3/0;

You will surely get a “division by zero” warning in your PHP log. Make sure you see it (so you know you are in the right log, and it’s working).

There you will find the reason for your white screen.

After commenting out the code

sugar_die("Invalid Module");

I get this error…

Fatal error: Uncaught Error: Call to a member function retrieve() on boolean in /var/www/html/suitecrm/modules/AOS_PDF_Templates/formLetterPdf.php:87 Stack trace: #0 /var/www/html/suitecrm/include/MVC/Controller/SugarController.php(1014): require_once() #1 /var/www/html/suitecrm/include/MVC/Controller/SugarController.php(465): SugarController->handleEntryPoint() #2 /var/www/html/suitecrm/include/MVC/Controller/SugarController.php(373): SugarController->process() #3 /var/www/html/suitecrm/include/MVC/SugarApplication.php(109): SugarController->execute() #4 /var/www/html/suitecrm/index.php(52): SugarApplication->execute() #5 {main} thrown in /var/www/html/suitecrm/modules/AOS_PDF_Templates/formLetterPdf.php on line 87

ok, getting somewhere. Looks like the reason the code I commented out was saying invalid module was because I used Remedials instead of remed_Remedials in my view.details.php. Now getting a new php error.

Catchable fatal error: Object of class remed_Remedials could not be converted to string in /var/www/html/suitecrm/modules/AOS_PDF_Templates/formLetterPdf.php on line 49

It looks like your passing an object of that class where it’s expecting just a string (maybe the module name).

What exactly do you have in that file on line 49?