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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Direct link to a specific label to a specific group
Pages: [1]

Author Topic: Direct link to a specific label to a specific group  (Read 499 times)

CatorgHans

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.4
  • CMS version: drupal
Direct link to a specific label to a specific group
November 23, 2012, 02:23:23 am
I want to place a direct link in the menu to a search with a certain (smart) group where you have selected all, chosen "create label" with the actions and selected a specific label type.

So every time my customer presses that link he gets a pdf directly with the right addresses (based on that smart group).

I have looked into the civicrm_session table to try to use the variables with the qfkey, but I don't understand it well enough to create a direct URL from it.

Is that possible? Or do you recommend another way to get to that pdf with labels directly?

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: Direct link to a specific label to a specific group
November 23, 2012, 03:41:40 am
Hey there,

That sounds interesting :)

Not 100% sure but I don't think that the session is the right place to look for this kind of stuff.  Have you tried looking at the form that generates labels?  Is there a URL that you can call directly for that page, and if so, is there any parameters that you can pass to it?

e.g. you can call the pdf generator like this: http://drupal.demo.civicrm.org/civicrm/activity/pdf/add?action=add&reset=1&cid=102&selectedChild=activity&atype=22

not sure if you are into this kind of thing and I suspect that this isn't trivial, but this is one way to approach it (others might suggest alternatives).

1) find a URL that calls CRM_Contact_Form_Task_Label or potenially CRM_Contact_Form_Task (or make one if you can't find one)

2) find a way of inserting the group id as a parameter into that URL.  It might involve editing some classes or creating a class that wraps one of the above classes.

3) call that URL.

I suspect there are some ways to bypass the part where you have to hit the create labels button.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

CatorgHans

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.4
  • CMS version: drupal
Re: Direct link to a specific label to a specific group
November 23, 2012, 05:37:29 am
One step further

If I create a form out of it
Code: [Select]
<form action="/civicrm/contact/search/?gid=11&amp;force=1" id="Label" method="post" name="Label">
<input name="_qf_default" type="hidden" value="Label:next" />
        <input id="task" name="task" type="hidden" value="16" />
        <input id="label_name" name="label_name" type="hidden" value="L7162" />
        <input id="radio_ts" name="radio_ts" type="hidden" value="ts_all" />
        <input class="form-submit default" id="_qf_Label_next-bottom" name="_qf_Label_next" type="submit" value="#group name#" /></form>

I get the search on the group, where all contacts are selected and in actions the "Create Label" is selected.
gid in the URL is the group id.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Direct link to a specific label to a specific group

This forum was archived on 2017-11-26.