Rank: Advanced Member
Groups: Authorized User, Developers Joined: 2/17/2019(UTC) Posts: 909
Thanks: 3 times Was thanked: 15 time(s) in 15 post(s)
|
What would be the best way to prevent a user in the admin backend from editing an order, (not being able to change anything at all, including the line items), if a specific condition is met?
Thank you
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
In a Gold site, I disabled links like the change status link, or the delete/edit order item buttons.
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 2/17/2019(UTC) Posts: 909
Thanks: 3 times Was thanked: 15 time(s) in 15 post(s)
|
Hey Judy,
That is my concern, there are so many different buttons and links inside the order form view. If this was a desktop application, I would check the before edit event of the table itself, then issue an abort statement after displaying a friendly message.
We are trying to prevent any orders that are set to "complete" or "cancel" status, that are over 35 days old, from being deleted, modify, or changed in any way. This is determined by a custom field in the orders table, and the manipulation of this field is based on a desktop app.
I am assuming that AbleCommerce version 9, current version, does not have access to table events?
Any reply from anyone, would be useful.
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
There is a Save method in the repository class. You can try to add the prevent logic in that method and abort the final save process. CommerceBuilder\Orders\OrderRepository.cs Code:AbleContext.Current.Database.RollbackTransaction();
You can try using this method to roll back the SQL changes. Hope this helps!
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 2/17/2019(UTC) Posts: 909
Thanks: 3 times Was thanked: 15 time(s) in 15 post(s)
|
Not the best way to do this since an editing process is underway, and we are also talking about the order line items as well. I wish there was a "before edit event" that we could tap into.
It is also a waste of time to have somebody make lots of changes, and then try to abort the moment you try to save, it's better to address this issue before trying to edit in the first place, and trying to prevent the edit by displaying a friendly message.
Remember it's not only the orders table, it's payments, shipping, and so many other factors that revolves around orders.
Besides going into the order view and capturing every single click there, any other way that you can see this happening with this current version?
I know you guys are planning on increasing events in the future, this is definitely one area you may wish to look into.
Any feedback would be helpful. -Thanks
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 2/17/2019(UTC) Posts: 909
Thanks: 3 times Was thanked: 15 time(s) in 15 post(s)
|
Just to give you an idea what it would look like in Object Pascal by tapping into Before a Table Edit Event. - Six lines of code
If database.FieldByName("cf_OrderLock").Value = 1 then begin MessageDlg,info("This Order is LOCKED, please see your supervisor."); Abort; end;
The above is self-explanatory, it just shows and demonstrates what I'm trying to accomplish.
Again many thanks for anyone who can help.
-Ray
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
You could try putting javascript on the page to disable all fields if the order has a particular order status. We have a specialized version of Gold for some clients that does that on the edit product page because all the product data is supposed to come from an import.
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 2/17/2019(UTC) Posts: 909
Thanks: 3 times Was thanked: 15 time(s) in 15 post(s)
|
Thanks Judy,
We are looking at many options to try to get this done, the lack of events, especially those that tie directly to a table is making it a little bit more complicated than it needs to be.
The good news is, in order to manipulate any change in an order, you need to click something first. In the order view only, not including the line items, they are 21 different areas were someone can click to manipulated an order.
Right now I'm trying to acquire as much information as possible, to discuss this with a developer to see which is the best way to proceed. Another way would be to capture this with a trigger at the table level, but that could create havoc in the admin section.
I wish that Able's documentation was more up-to-date, especially with the MVC stuff, everything pretty much just reference Gold and even that lacks detail.
Still waiting on support to see what they would advise, a before edit method in the repository class would be ideal.
Your feedback is highly appreciated, -Ray
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close