-
Notifications
You must be signed in to change notification settings - Fork 443
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
Conversation
src/skin/js/GroupList.js
Outdated
$(document).on("click","#AddGroupToCart",function(link){ | ||
var groupid = link.toElement.dataset.groupid; | ||
window.CRM.cart.addGroup(groupid); | ||
location.reload(); |
There was a problem hiding this comment.
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:
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):
There was a problem hiding this comment.
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);
There was a problem hiding this 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
@crossan007 I will try to fix it this evening. |
…re's any person in the group
@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. |
Why is travis give me a problem ? |
@phili67 Not 100% sure why this errored: Please note that you can re-start a Travis job without adding new commits: |
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. |
Closes #3617
Closes #3663
I rewrote this code in Ajax with the api.
I've added a new method removeGroup to CRMJSOM.js