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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • [Fixed] Issue creating add household/member/spouse flow
Pages: [1]

Author Topic: [Fixed] Issue creating add household/member/spouse flow  (Read 1385 times)

apolloblundr

  • Guest
[Fixed] Issue creating add household/member/spouse flow
March 04, 2009, 11:56:32 am
Hi,

Thanks for all the great work done on CiviCRM!

I know that an improved household flow is planned for version 2.3, but many of the contacts in my database are couples and so I have been working on some simple customizations of my own to make it easier to add a household, add a member and then add their spouse successively.  I am fairly new to civicrm/drupal so I am in a little over my head.

I took what I thought would be a simple approach: I added a button for "Save and Add Member" on the add household form, then "Save and Add Spouse" and "Save and Add Member" on the ensuing add individual form. 

I then used:

Code: [Select]
$session->replaceUserContext(CRM_Utils_System::url($url))
in Contact/edit.php to conditionally redirect the url to add individual forms and also pass variables like the household contact id (i.e /civicrm/contact/add?reset=1&ct=Individual&cst=Member&hid=4263) where hid is the household id (to populate the individual's address with that of the household and create the "Member of Household" relationship) and cst is the contact sub type (i.e. Member or Spouse).  I then $_GET the variables and assign them to public class variables so I can use them within the functions of the class.

That all worked fine, but I ran into an issue with the postProcess() function in edit.php.  The public class variables I defined to hold the household and contact sub type ids are NULL in this function.  I did notice that other public class variables such as contact type and contact id are still assigned at this point.

Hopefully that all makes sense - any idea what is happening and how I would make all the public class variables available in the postProcess() function?  Is there a better way to achieve this? :)
« Last Edit: March 05, 2009, 08:31:07 am by apolloblundr »

apolloblundr

  • Guest
Re: Issue creating add household/member/spouse flow
March 05, 2009, 08:30:27 am
Ahhh, looking back at the CRM_Utils_Request::retrieve() function I see that it is a utility function that does the $_GET work for me.  Using the third parameter &$store and passing in $this (the class object) allows me to retain the value of the class variables for the postProcess function.

Code: [Select]
$this->_householdId = CRM_Utils_Request::retrieve( 'hid','Integer',
                                                                  $this,
                                                                  false,null,'GET' );

Maybe that will help someone down the line.  Another question: Is the Contact Sub Type variable going to be used in the future to define sub types? It seems to duplicate the idea of Tags and Groups somewhat.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: [Fixed] Issue creating add household/member/spouse flow
March 05, 2009, 08:43:09 am

apologies for not responding on the prior post. things are getting a bit hectic :(

we used contactSubType in the 1.x series for some client consulting project. i'm not sure if we'll use it in the future or not at this stage. Ideally not :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • [Fixed] Issue creating add household/member/spouse flow

This forum was archived on 2017-11-26.