Problem/Motivation
When having a team / employees entering orders in the admin area for customers (that can't be bothered to do so by themselves) there currently is little (to no) evidence on who placed the order (besides looking at the commerce_log entries in case they have been enabled).
Having extra modules or commerce_log might seem like a legit alternative - but - won't do as soon as the information is needed in views or other reference enabled means.
Proposed resolution
Add an optional `author` field that is being set when using Drupal\commerce_order\Form\OrderAddForm (perhaps there are some other places that would fit the need too).
Remaining tasks
Review and enhance my patch / MR.
User interface changes
Little to none.
API changes
None
Data model changes
Adding a field to orders.
Issue fork commerce-3269294
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
attisanComment #4
rszrama commentedSince we don't really talk about orders having "authors", it would make more sense for this to be the "creator". I'm not sure what the impact of adding a new field would be - will discuss w/ jsacksick in out next roadmap meeting.
Comment #5
rszrama commentedComment #6
jsacksick commentedI agree with Ryan on this, this would make more sense for this to be "creator". Also, is this a UI thing only? Perhaps we should set the value to the current user on order insert (the current user when the order got saved for the first time basically)...
Well, we've done this in the past, I believe changing an existing field is more "risky" than adding a new field (performance wise).
Comment #7
attisanThanks for the input. Pushed the suggested changes and went for the
preSavevariant as hinted by jsacksick (instead of relying on theAddOrderFormBUT decided against unsinggetCurrentUserIdas the fieldsetDefaultValueCallback. Why? In order not to have the field set for every order but only when orders are placed by a user other than the customer himself (guess that will help when dealing with views / filters ...).Comment #8
attisanAs for reviews / public need; I have the feeling this is one of those features you will only need after you have been subject to trouble and are trying to figure out why a given order is in the system.