Make PDF exports writable in SugarCRM

Share This

Just wanted to share quick tip on how to make PDF exports generated by SugarCRM editable. This feature would be especially useful for the Quotes module – when certain corrections must be made. Currently there is no setting anywhere in SugarCRM to disable PDF protection – even though a request has been made, so perhaps this feature will be introduced in the future release.

The modification required to disable PDF protection is fairly trivial, all you have to do is copy “/include/Sugarpdf/sugarpdf_default.php” into “custom/include/Sugarpdf/sugarpdf_default.php” and modify:

"PDF_PROTECTION"=>implode(",",array("print","copy"))

to look like the following (by adding modify action to the list of permit-table actions):

"PDF_PROTECTION"=>implode(",",array("print","copy","modify"))

This would be a non-issue  on a self-hosted instance of SugarCRM Community Edition. In SugarCRM On-Demand however, you are not provided with a direct access to the filesystem, so the only way to copy the file and make the necessary modifications is to create a proper SugarCRM module.

Every module in SugarCRM starts with a manifest.php, which described the module itself and the installation procedure. The following is an example of a manifest that can be used in our situation:

global $sugar_config;
 
$upload_dir = $sugar_config['upload_dir'];
$manifest = array(
'acceptable_sugar_versions' => array(
'regex_matches' => array(
0 => '6\.*'
),
),
'acceptable_sugar_flavors' => array(
0 => 'CE',
1 => 'PRO',
2 => 'ENT',
3 => 'CORP'
),
'name' => 'Editable PDF Config',
'description' => 'Editable PDF Config installation package.',
'is_uninstallable' => true,
'author' => 'BlackRiver',
'published_date' => 'July 29, 2013',
'version' => '1.0.0',
'type' => 'module',
);
 
$installdefs = array(
'id' => 'CG_LogicHook',
'mkdir' => array(
array('path' => 'custom/include/Sugarpdf'),
),
'copy' => array(
array(
'from' => '<basepath>/NewFiles/sugarpdf_default.php',
'to' => 'custom/include/Sugarpdf/sugarpdf_default.php',
),
)
);

The most important bit here is the copy element included into the $installdefs array. It tells SugarCRM which files to copy where. The new and already modified sugarpdf_default.php file is already included with the module (make sure to use the latest source from the SugarCRM repository). The module now can be zipped using the following structure:

InstallerTemp (dir)
-manifest.php
-NewFiles (dir)
--sugarpdf_default.php

The resultant zip file can be installed and activated through the SugarCRM Module management tool in the admin panel. You can also download the complete module here.


One Response to “Make PDF exports writable in SugarCRM”

  1. Dan says:

    Excellent Info! I have been looking for this!

Leave a Reply to Dan

Recent Revive AdServer (Formerly OpenX Source) Expandable Banners

Revive AdServer (Formerly OpenX Source)  Expandable Banners The following example demonstrates a 600px by 150px banner served by Revive AdServer (Formerly OpenX Source)  and expanded to 600px by 300px on rollover. The flash creative can be either uploaded to creatives directory directly (FTP) or just as an another Revive AdServer (Formerly OpenX Source)  banner (preferred). When uploading the SWF creative, you do not need to replace any hardcoded URLs or indicate a destination URL – that would be done in the HTML banner setup. Essentially, we are just using it as a storage container for our creative, all impressions and clicks will be … read more

 Twitter  LinkedIn  Google+  Skype RSS

Get in Touch

  • r Phone:
    (416) 877 2844 / (647) 258 4847
  • h Email:
    [email protected]
  • m Address:
    1454 Dundas St. East, Suite 124
    Mississauga, Ontario
    L4X1L4, Canada

Any Questions?

    Email

    Message