When a relationship is disabled by end-date and cron job then in webform it shows blank (no or null) relationship, which it correct. When you then after a period you attempt to re-establish relationship with the same contact, the webform will retrieve the deactivated relationship and allow you to edit and re-enable it.

Although some might consider this a feature, to me this is a bug. When by end date a relationship was ended it should not be retrieved nor edited. To record history of this end date, a new relationship should be created, with a new start date. This bug causes a past relationship to be reused (edited and re-enabled) making it impossible to record the actual interruption of relationships.

If you know a way to still do this, then please could you change the issue Category to "Support request" and help me?

Comments

ñull’s picture

Version: 7.x-4.10 » 7.x-4.11
colemanw’s picture

I think we'd have a hard time getting consensus on whether this is a bug or a feature. But since CiviCRM core does allow this sort of thing, probably it would be good for this module to support the same.
Can you go ahead and submit a patch/PR for this?

ñull’s picture

At the moment, for lack of experience with CiviCRM coding, I try to circumvent it by using rules:

  • Event: Before saving CiviCRM relationship
  • Conditions: comparing civicrm-relationship-unchanged data with civicrm-relationship if there were changes.
  • Actions: Create new entity CiviCRM Relationship with civicrm-relationship-unchanged: data selector, with today's end date.

This theoretically would effectively save a copy of the unchanged relationship to keep a history record.

ñull’s picture

I tried to work around it with rules, but #2512390: civicrm_relationship_update not triggering is hindering me there. When I have time, I try to have a look with a debugger, to see where in the code this is decided. When simple enough, I might even produce a patch.

gemma.potaka’s picture

We have just hit this issue also and would like to find a fix.
We will look at finding a fix that is optional either for the whole site, per webform or per relationship on the webform so that people have the choice as to whether they update an expired relationship or create a new relationship.
Do you have any pointers as to where to start tackling this?

colemanw’s picture

It could be a per-form setting under "additional options"
Based on that setting the function wf_crm_webform_base::getRelationship() can return all or only active relationships.

colemanw’s picture

petednz’s picture

Thanks for merging, and thanks to Jitendra for getting the patch sorted for us.

petednz’s picture

perhaps you can tag me, or fuzion, with the commit?

colemanw’s picture

Sorry what do you mean by tag you with the commit?

petednz’s picture

Doesn't matter much. I thought on drupal there was a 'credit and committing' option so that folks who provide the commit get some sort of community recognition. I see it at the bottom of this form which suggests i can credit it to myself, which seems odd, and not sure if it is the correct thing to do since it seems to alter the 'git commit' msg that shows right at bottom of this page, and i don't want to mess with that unknowingly.
And anyway that credit should go to Jitendra's profile, and he should be linked to fuzion, and that is how the 'company' profile builds reputation.

minor issue. will discuss with jitendra if this needs further discussion

colemanw’s picture

Sorry, this unfortunately has to be done by the committer before merging. Too late now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.