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

Phili67 grouplist bug Resolution #3616

Merged
merged 23 commits into from
Dec 9, 2017
Merged

Phili67 grouplist bug Resolution #3616

merged 23 commits into from
Dec 9, 2017

Conversation

phili67
Copy link

@phili67 phili67 commented Dec 4, 2017

Closes #3617
Closes #3663

I rewrote this code in Ajax with the api.

I've added a new method removeGroup to CRMJSOM.js

@ghost ghost assigned phili67 Dec 4, 2017
@ghost ghost added the In Review label Dec 4, 2017
@phili67 phili67 changed the title Phili67 grouplist bug Phili67 grouplist bug Resolution Dec 4, 2017
@ghost ghost assigned crossan007 Dec 5, 2017
$(document).on("click","#AddGroupToCart",function(link){
var groupid = link.toElement.dataset.groupid;
window.CRM.cart.addGroup(groupid);
location.reload();
Copy link
Contributor

@crossan007 crossan007 Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

location.reload() needs to be in the callback of addGroup(). As written, the page will always refresh - even if the add to group fails.

If the call to add group fails, the user should see the error message instead of a generic page reload:
without callback

So you should write,

window.CRM.cart.addGroup(groupid, function() {
location.reload();
});

Using the callback will give this (note that the page does not reload):
with callback

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do note, that in order to test this comment, I had to create a FAKE ERROR in the cart dto:

 public static function RemoveGroup($GroupID)
  {
    throw new \Exception (gettext("blah"),400);

@crossan007 crossan007 added this to the On-Deck milestone Dec 5, 2017
Copy link
Contributor

@crossan007 crossan007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the ajax callback in both addgroup and remove group

@phili67
Copy link
Author

phili67 commented Dec 5, 2017

@crossan007 I will try to fix it this evening.

@crossan007 crossan007 removed their assignment Dec 5, 2017
@ghost ghost assigned crossan007 Dec 5, 2017
@phili67
Copy link
Author

phili67 commented Dec 5, 2017

@crossan007 Ok everything is done, I've added a nice thing too, when the group has no members the "Add all" button should be disable too.
capture d ecran 2017-12-05 a 18 41 41

@phili67 phili67 dismissed crossan007’s stale review December 5, 2017 20:03

Everything is solved

@ghost ghost assigned DawoudIO Dec 6, 2017
@phili67
Copy link
Author

phili67 commented Dec 7, 2017

Why is travis give me a problem ?

@crossan007
Copy link
Contributor

@phili67 Not 100% sure why this errored:

image

Please note that you can re-start a Travis job without adding new commits:
image

@crossan007
Copy link
Contributor

crossan007 commented Dec 9, 2017

Approving this so that we get the functionality back.

This PR opens issue #3663 since the implementation here causes a page reload, which is not good.

@crossan007 crossan007 modified the milestones: On-Deck, 2.9.2 Dec 9, 2017
@crossan007 crossan007 merged commit 15005d5 into master Dec 9, 2017
@crossan007 crossan007 deleted the phili67-grouplist-bug branch December 9, 2017 20:48
@ghost ghost removed the In Review label Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants