PublishItNow 24 Posted May 29, 2017 Report Share Posted May 29, 2017 Hi Raymond, I'm working in the process module, and I'm running into an permission's error when I try to drag and drop an opportunity to a stage above stage 9 in the list. I'm able to move it freely in all stages up to and including 9, then attempting to move it beyond that comes up with a permissions error. I'm able to manually change the stage in the opportunity to a stage number above 9 in the opportunity record. Once manually set to stage 10 or higher, I can freely move it around in stages 10+, however I can't move it back down to stage 9 or below. If I change the order of the stages in editing the process, say swapping stages 9 and 10, I'm able to move to the new stage 9 but not the the new stage 10. I'm using the default web admin user with global permissions. None of the stages have any special user permissions on it. Error message on screen is: You do not have permission to perform that stage change. I'll investigate further, but any assistance you may provide in rectifying this error would be appreciated. If you're able to come up with a bug fix before I am, can you please let me know the Git commit number so I can apply it manually in my system? Warmest regards, Andrew Edit: Added more information Quote Link to post Share on other sites
X2Raymond 164 Posted May 30, 2017 Report Share Posted May 30, 2017 Hello Andrew, I've done a bit of digging and believe this issue is due to the fact that Array.sort() in JavaScript orders the elements in lexicographical order, according to the converted Unicode string (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). Because of this, when trying to order the two stage numbers to move the record between, the sort could fail. For example, as integers, 5 "11", since "1" is before "5". Please update the _checkPermission function in protected/modules/workflow/assets/js/DragAndDropViewManager.js as follows: //var stageRange = [stageA, stageB].sort (); if (stageA <= stageB) var stageRange = [stageA, stageB]; else var stageRange = [stageB, stageA]; hasPermission = auxlib.reduce (function (a, { return a & b; }, this.stagePermissions.slice (stageRange[0] - 1, stageRange[1])); Then remove the compiled assets in assets/* before refreshing the page. Raymond Quote Link to post Share on other sites
PublishItNow 24 Posted June 1, 2017 Author Report Share Posted June 1, 2017 Hi Raymond, Fix works perfectly, thankyou very much! Warmest regards, Andrew Quote Link to post Share on other sites
PublishItNow 24 Posted January 1, 2020 Author Report Share Posted January 1, 2020 Hi Guys, Just wondering when this bugfix will be added to the codebase? Rather strange I need to fix it every single time I update given it's a bug and a simple fix at that. Regards Andrew 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.