CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Can I leave out empty lines in pdf letters?
Pages: [1]

Author Topic: Can I leave out empty lines in pdf letters?  (Read 876 times)

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Can I leave out empty lines in pdf letters?
October 03, 2012, 01:42:15 am
We snail mail out letters with membership cards attached.

We have set up a message template to produce the letters as pdfs, but I am having trouble getting a satisfactory address to display.

Most people just have an entry in the Street_address field, but others also have details in Addt'l Address 1  and Addt'l Address 2 fields, so I need those fields included in the pdf letters.  However, if they are empty they display as blank lines.  The postal service doesn't like that, and we lose our NFP bulk mail discount.

When creating address labels, Addt'l Address 1  and Addt'l Address 2 fields are suppressed if empty so that there are no blank lines on the address label.

Is there a way to do that for pdf letters?

I have tried to use some smarty commands to only include the fields and the line breaks if they are contain data, but that does not seem to work.  I just get the smarty commands embedded amongst the address lines (that could be because my smarty skills are very limited I must admit)

Any help would be much appreciated.




Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Can I leave out empty lines in pdf letters?
October 03, 2012, 02:44:05 am
Hey there,

This this blog post for a solution: http://civicrm.org/blogs/michael-mcandrew/creating-address-block-token

If you have time, adding that to core would be most useful for others in your situation (and you in the future when you upgrade) :)
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Can I leave out empty lines in pdf letters?
October 03, 2012, 03:35:58 am
Thanks for the prompt reply.

I was hoping for a solution that I could implement though the Civi UI as I have no coding skills, but I will include this info when I put in an request to our Civi developer.

I would like to be able to say that I will ask them to submit it as an addition for core, but funds are very tight at the moment. (A familiar refrain I am sure)  I understand the rationale of getting it into core rather than having to re-apply after an upgrade but I just can't fund it at the moment. 

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Can I leave out empty lines in pdf letters?
October 04, 2012, 12:57:18 am
(depending on your developers skills) it might be worth asking them to add this to core rather tha download that module.  since if it is in core, it will be supported with each upgrade, whereas, if it is as a module, it may require tweaking on each upgrade. i.e. you'll pay a little extra now, but will save that over the next 1-2 years (depending on how often you upgrade).
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Can I leave out empty lines in pdf letters?
October 04, 2012, 10:17:44 pm
I haven't gone as far as adding to core but do have an updated version of Michael's module

https://github.com/eileenmcnaughton/tokens/blob/master/address.inc

Changes
1) uses api v3 / assumes class loader
2) only calls api if required fields not present & doesn't require unecessary fields to be returned
3) sits within my civitoken wrapper - this is because I like to move tokens between sites without having a whole module for each mobile set of tokens - probably civix will make this approach obsolete at some point - http://forum.civicrm.org/index.php/topic,23869.msg102017.html
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Can I leave out empty lines in pdf letters?

This forum was archived on 2017-11-26.