VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: EvanGR on March 22, 2021, 10:45:24 AM

Title: Order editing conflicts (multiple users)
Post by: EvanGR on March 22, 2021, 10:45:24 AM
Hello,

We have 3 employees handling the orders, and we want to prevent an order from being edited by two people at once (accidentally). Is there a provision for that?

(Joomla usually has a lock mechanism to prevent that scenario)
Title: Re: Order editing conflicts (multiple users)
Post by: pinochico on March 22, 2021, 12:25:22 PM
Of course,
you have to create new user group and setup ACL for app VirtueMart:

administrator/index.php?option=com_config&view=component&component=com_virtuemart

Order access
Orders edit
Orders delete
Order status change
Title: Re: Order editing conflicts (multiple users)
Post by: GJC Web Design on March 22, 2021, 14:40:48 PM
Evan means if two admin have the same rights .. and no .. you can test this by opening a product edit in two separate browsers with 2 separate users .. both can edit..

the locked_on etc columns are there but are unused for this purpose
Title: Re: Order editing conflicts (multiple users)
Post by: pinochico on March 22, 2021, 15:07:47 PM
To GJC:
aha. Thanks for explanation

then if virtuemart don't use the same preventing system as joomla for editing articles, modules... you have to add by self develop.
If the collumn in DB now exist (and not used in this time), it should not be so difficult to implement.
Or you can add for these table for orders new collumn and all function in model order or view.html.php have to change.
Title: Re: Order editing conflicts (multiple users)
Post by: Jörgen on March 23, 2021, 07:02:15 AM
This is not an Easy task. You have users that are updating the database att the same time. Checking in and out the order database during editing would interfere with normal order update from customers
Title: Re: Order editing conflicts (multiple users)
Post by: EvanGR on March 23, 2021, 08:36:24 AM
In our experience, customers contact us directly when they want to change or cancel an order. But that's just us.

A proposal on how I think it could work:

1) In the default new order state, the order is available for editing but only by 1 person on the backend (enforced by the familiar lock mechanism).
OR... at least, show a notice that another user X has opened this order for editing at Y date/time.
So that employees can coordinate.

2) When the order status is changed to "Processing" (or equivalent), the customer can no longer edit their order. (Perhaps a "request cancellation" feature would be useful, but this should not change the order state directly)
Title: Re: Order editing conflicts (multiple users)
Post by: Jörgen on March 23, 2021, 08:57:55 AM
You are missing my point.

If You put an lock on the database files related to the order management. You will also put a lock on product related files. This will stop new order from be registered if they are using any of the related database items. The amount of concurrent users will elevate the risk of conflicts. But it is enough for one customer to order one item that is on a locked order.

You can minimize the risk with transaction management where you encapsulate an update to make sure nothing interferes during read and write, but I do not see any easy way to make the conflicts zero. They will happen with unknown sideeffects.

The lock that is done for Joomla articles does work because front end users does not usually update the database files, content is mostly read.

Jörgen @ Kreativ Fotografi
Title: Re: Order editing conflicts (multiple users)
Post by: AH on March 23, 2021, 10:52:04 AM
EvanGR

QuoteIn our experience, customers contact us directly when they want to change or cancel an order. But that's just us.

As can be seen from the answers below - this is not catered for.

Note - below here there is no solution, just observation.

May I suggest that you look at your business processes in the first instance - because I am struggling to envisage a scenario where a customer calls regarding their order and 2 people work on that in parallel.

That is not to say that it is not possible (of course it is!)

I could easily see how one person is working an order in detail view and another updates a load of statuses in list view and that "load" includes the order being worked on - That would be "interesting" .

It would also be a challenge to ensure that "if the locking of orders ever happened"  how the message was reflected to the user doing the status update - because (in my experience) users are really good at ignoring messages!!!
Title: Re: Order editing conflicts (multiple users)
Post by: EvanGR on March 23, 2021, 11:30:59 AM
By the way, just to make sure we are talking about the same thing....

I am not talking about database table locking.

I am only talking about marking an order as being already edited by a user (backend).

It should only take 2 DB columns to implement this: the last edit timestamp and the userid.
No hard locks or anything else.
Title: Re: Order editing conflicts (multiple users)
Post by: Jörgen on March 23, 2021, 11:43:12 AM
Not easy to tell from Your posts what you want, this is in my eyes a 180 turn.

Last edited and edited by is already in the databse table. Override and edit Your BE view to show edited by.


Jörgen
Title: Re: Order editing conflicts (multiple users)
Post by: AH on March 23, 2021, 12:01:53 PM
EvanGR

QuoteI am only talking about marking an order as being already edited by a user (backend).

It should only take 2 DB columns to implement this: the last edit timestamp and the userid.
No hard locks or anything else.

Yes understood - The "checked out" stuff similar to joomla

QuoteIt should only take 2 DB columns to implement this

The option to update this data on edit
The option to remove this data on closed /save
Modification to the order list display "being touched" status
The modification to the order edit display to show "being touched" status

This is likely to be a pain when a user opens an order - then just goes to another page without closing it "properly"
Functions to "clear this status on orders" that are definitely not being touched or open in edit

It is never a "It should only take" - so I am unsure who will take this forward and do the work for it.


This is a very specific request as it only works for an edit function - not for changing the status of an order in admin list that is being edited (which seems to me the most likely scenario)
Title: Re: Order editing conflicts (multiple users)
Post by: EvanGR on March 23, 2021, 12:37:31 PM
Thanks for the replies. Apologies if I am not 100% clear, English is a second language to me.

AH, thanks, that was exactly my thinking. Including the problems you pointed out.

Reminding the original problem:
Sometimes two employees open and process the same order at the same time. Because there is no indication that order is currently being processed by anyone else.

I would imagine this would be a common issue for any company that has 2+ employees working on the VM backend.
Title: Re: Order editing conflicts (multiple users)
Post by: Jörgen on March 23, 2021, 13:44:05 PM
My personal guess is that this is not unique to VM. This is a common approach in many database systems around the world. Checking in and out views is not easy to handle. One of my early bosses called this kind of updating the "optimist method", last to save wins the edit, when two or more users are editing the same data. Not exclusive to VM in any way.

Jörgen @ Kreativ Fotografi
Title: Re: Order editing conflicts (multiple users)
Post by: AH on March 23, 2021, 15:02:48 PM
QuoteI would imagine this would be a common issue for any company that has 2+ employees working on the VM backend.

For more than 9 years we have had more than 4 employees working on VM admin orders - but have yet experience a " double update" problem - so maybe it is a business process issue that can be solved by changing the business process?
Title: Re: Order editing conflicts (multiple users)
Post by: pinochico on March 23, 2021, 15:25:52 PM
heretical idea:

when it comes to jooma articles, Virtuemart orders should not be a problem.

But the right comment - is it even needed and will it be burned out financially?
Our one customer has 8 e-shops and the orders are always edited in the administration by one person so that there is no confusion.
Title: Re: Order editing conflicts (multiple users)
Post by: Jörgen on March 23, 2021, 21:56:49 PM
Editing joomla articles is NOT the sane as editing a VM order. The VM order has a lot of related tables, ,the Joomla article usually none. A joomla article is not beeing updated by a user in front end. Tables related to VM order table are beeing updated from the front end at runtime. Every new order updates a lot of VM tables related to VM order table. Locking these tables out may cause conflicts that have greaterd impact than just two staff editing the same order.

Just my two cents.

Jörgen
Title: Re: Order editing conflicts (multiple users)
Post by: EvanGR on March 24, 2021, 09:11:27 AM
Perhaps the problem can be minimized by better business process (i.e. better communication between staff), but it's still there.

We split order pages to employees for processing...
Person 1 does page 1.
Person 2 does page 2.
etc...

But it's not foolproof... as orders keep coming in, the content changes.


I am not saying this is a simple issue to solve! (it's not)... I am only saying that it's a real issue, and definitely becomes larger as the company scales up.

If not at 5.... then 10 employees handling orders? Without double-processing mistakes? Not a chance.

A simpler (but not simple) way to solve this is by showing an indication (through AJAX, with background checks) that an order is being processed by someone else. Not enforcing locks or anything.

The current implementation cannot scale. It is suitable for a one-man show, or a small team with good communication on order processing.


Title: Re: Order editing conflicts (multiple users)
Post by: Jörgen on March 24, 2021, 09:41:12 AM
There is a way of getting around this in some way. Before the editted record is updated you will make a test and see if the recird that originally was read has been modified. If it has the update will not ne executed. To minimize any loopholes this should be done in the same server request that is used for the update. And the result should be checked. If the update went through noone else has updated the record before this call. Otherwise your update is rejected.

The solution will stop the background data from being overwritten. This may be worth considering by the VM team, but I have no idea of the size of scope for this task.

Jörgen @ Kreativ Fotografi
Title: Re: Order editing conflicts (multiple users)
Post by: pinochico on March 24, 2021, 10:10:54 AM
Quotethen 10 employees handling orders?

is question, why this company not using ERP (SAP, Helios,...) but edit order in VM admin?
Because if 10 people editing orders, then must be big big company, and then process with editing order only in administration are by my think is wrong

We have 8 shop for one customer (max 30 people working in company) and for editing orders have easy solutions:

Orders edit 3-4 people by status
- staff if status is status1 or status2 - then create labels, orders for shipping companies and next change status to status3
- invoicing peoples edit order if status is status3 (creating invoice in ERP) and then change status to status4
- sales manager edit order anytime
- automatic process edit order after order is payied, then change status from basic to status1 or status2
- admin edit order anytime

Of course, everything develop is possible, but back to start - is convertible for customer develop 30-100 hours for creating system for editing order?
I think the best option is using SAP or other ERP.
Title: Re: Order editing conflicts (multiple users)
Post by: EvanGR on March 24, 2021, 14:34:41 PM
Quote from: pinochico on March 24, 2021, 10:10:54 AM
is question, why this company not using ERP (SAP, Helios,...) but edit order in VM admin?
Because if 10 people editing orders, then must be big big company, and then process with editing order only in administration are by my think is wrong
Thank you pinochico. Yes, for a big company they need a different solution.
We had problems (=human mistakes) with editing orders, and we only have 3 employees managing the order processing.

We use an ERP also, but for other logistical tasks. It is not great for order processing, because it is too complex... Virtuemart is a lot better, and easy to understand.
And it can get very expensive for a small business to use a powerful ERP like SAP.


Quote from: pinochico
We have 8 shop for one customer (max 30 people working in company) and for editing orders have easy solutions:
Orders edit 3-4 people by status
This is probably a smart way to do it!


Thank you very much (everyone) for the feedback.
Title: Re: Order editing conflicts (multiple users)
Post by: pinochico on March 24, 2021, 15:26:45 PM
yep,

edit order by status - for this solution we use color for order.
Very simple  - aopen Order list, edit only order with color = XXX

##EDIT by admin - removed image - potential customer data disclosure