Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-21855 comment code in BAO/RelationshipType #11925

Closed
wants to merge 2 commits into from
Closed

CRM-21855 comment code in BAO/RelationshipType #11925

wants to merge 2 commits into from

Conversation

alexander0205
Copy link

@alexander0205 alexander0205 commented Apr 3, 2018

Overview

Comment if label B to A is blank, insert the value label A to B for it

When editing the "A" side of a relationship from 'civicrm/admin/reltype' the values entered in the "Relationship A to B" column are copied to the "Relationship B to A" column. The reverse is not true.
Go to civicrm/admin/reltype

Edit anything in the "Relationship A to B" column
Save and refresh the page
The "Relationship B to A" column has also been updated

https://issues.civicrm.org/jira/secure/attachment/70672/70672_image-2018-03-27-15-11-54-181.png


When editing the "A" side of a relationship from 'civicrm/admin/reltype' the values entered in the "Relationship A to B" column are copied to the "Relationship B to A" column. The reverse is not true.
 Go to civicrm/admin/reltype
* Edit anything in the "Relationship A to B" column
* Save and refresh the page
* The "Relationship B to A" column has also been updated
@civicrm-builder
Copy link

Can one of the admins verify this patch?

@eileenmcnaughton
Copy link
Contributor

add to whitelist

@colemanw
Copy link
Member

Hi @alexander0205 welcome and congratulations on submitting your first PR to the CiviCRM project :)

The issue underlying this behavior that you're describing is that CiviCRM is historically divided into a QuickForm layer and an underlying BAO (Business Action Object) layer, which then saves to a DAO (Database Access Object). In the early days of the project, it was just those 3 layers and nothing else, so a dev could safely add some extra form processing to the BAO. In this case, if the user leaves a form field blank when saving a relationship type, the BAO will helpfully fill in the blank.

But then along came the API layer which bypasses the form and goes straight to the BAO. Now those form-related hacks don't make so much sense in that flow so @eileenmcnaughton and the API team spearheaded moving that logic out of the BAO and into the Form layer. The inline-edit you are using goes through the API.

So I think the correct fix is to move that php logic you commented out out of the BAO and into the Form postProcess function. Then the BAO will not get confused when saving one side of a relationship and thinking the other side is blank when in fact it is not. Your javascript and tpl changes will then no longer be needed.

@colemanw
Copy link
Member

I've created an alternate PR here: #11965

@colemanw colemanw closed this Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants